Artifact
fa11034f8b0f609388b0658fcc0dd185ce06a68d:
Wiki page
[Stored Procedures] by
sandro
2017-11-02 13:24:03.
0000: 44 20 32 30 31 37 2d 31 31 2d 30 32 54 31 33 3a D 2017-11-02T13:
0010: 32 34 3a 30 33 2e 35 38 35 0a 4c 20 53 74 6f 72 24:03.585.L Stor
0020: 65 64 5c 73 50 72 6f 63 65 64 75 72 65 73 0a 55 ed\sProcedures.U
0030: 20 73 61 6e 64 72 6f 0a 57 20 37 30 33 38 0a 3c sandro.W 7038.<
0040: 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e table cellspacin
0050: 67 3d 22 31 32 22 20 77 69 64 74 68 3d 22 31 30 g="12" width="10
0060: 30 25 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 63 6f 0%">..<tr><td co
0070: 6c 73 70 61 6e 3d 22 32 22 3e 0d 0a 3c 74 61 62 lspan="2">..<tab
0080: 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 20 le width="100%"
0090: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 bgcolor="#f0f0f8
00a0: 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 ">..<tr><td alig
00b0: 6e 3d 22 63 65 6e 74 65 72 22 3e 0d 0a 3c 2f 74 n="center">..</t
00c0: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d d></tr></table>.
00d0: 0a 3c 74 61 62 6c 65 20 77 69 64 74 68 3d 22 31 .<table width="1
00e0: 30 30 25 22 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 00%"><tr>..<td w
00f0: 69 64 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e idth="33%" align
0100: 3d 22 6c 65 66 74 22 3e 3c 2f 74 64 3e 0d 0a 3c ="left"></td>..<
0110: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 td align="center
0120: 22 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 "><a href="https
0130: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e ://www.gaia-gis.
0140: 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 it/fossil/libspa
0150: 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d tialite/wiki?nam
0160: 65 3d 34 2e 33 2e 30 2b 64 6f 63 22 3e 62 61 63 e=4.3.0+doc">bac
0170: 6b 20 74 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f k to index</a></
0180: 74 64 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 td>..<td width="
0190: 33 33 25 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 33%" align="righ
01a0: 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c t"></td>..</tr><
01b0: 2f 74 61 62 6c 65 3e 0d 0a 3c 68 31 3e 53 51 4c /table>..<h1>SQL
01c0: 20 50 72 6f 63 65 64 75 72 65 73 2c 20 53 74 6f Procedures, Sto
01d0: 72 65 64 20 50 72 6f 63 65 64 75 72 65 73 20 61 red Procedures a
01e0: 6e 64 20 53 74 6f 72 65 64 20 56 61 72 69 61 62 nd Stored Variab
01f0: 6c 65 73 3a 20 61 20 71 75 69 63 6b 20 69 6e 74 les: a quick int
0200: 72 6f 3c 2f 68 31 3e 0d 0a 53 74 61 72 74 69 6e ro</h1>..Startin
0210: 67 20 73 69 6e 63 65 20 76 65 72 73 69 6f 6e 20 g since version
0220: 3c 62 3e 34 2e 35 2e 30 3c 2f 62 3e 20 53 70 61 <b>4.5.0</b> Spa
0230: 74 69 61 4c 69 74 65 20 73 75 70 70 6f 72 74 73 tiaLite supports
0240: 20 61 6e 20 61 64 76 61 6e 63 65 64 20 6d 65 63 an advanced mec
0250: 68 61 6e 69 73 6d 20 69 6e 74 65 6e 64 65 64 20 hanism intended
0260: 74 6f 20 73 69 67 6e 69 66 69 63 61 6e 74 6c 79 to significantly
0270: 20 65 78 74 65 6e 64 20 74 68 65 20 73 63 72 69 extend the scri
0280: 70 74 69 6e 67 20 74 65 63 68 6e 69 71 75 65 73 pting techniques
0290: 20 61 6c 6c 6f 77 69 6e 67 20 66 6f 72 20 61 20 allowing for a
02a0: 70 6f 77 65 72 66 75 6c 20 61 6e 64 20 66 6c 65 powerful and fle
02b0: 78 69 62 6c 65 20 61 75 74 6f 6d 61 74 69 6f 6e xible automation
02c0: 20 6f 66 20 63 6f 6d 70 6c 65 78 20 77 6f 72 6b of complex work
02d0: 66 6c 6f 77 73 2e 3c 62 72 3e 0d 0a 54 68 69 6e flows.<br>..Thin
02e0: 6b 20 6f 66 20 74 68 65 20 6e 69 63 65 20 66 6c k of the nice fl
02f0: 65 78 69 62 69 6c 69 74 79 20 61 6c 6c 6f 77 65 exibility allowe
0300: 64 20 62 79 20 6d 69 78 69 6e 67 20 73 74 61 6e d by mixing stan
0310: 64 61 72 64 20 3c 62 3e 3c 69 3e 53 51 4c 20 73 dard <b><i>SQL s
0320: 63 72 69 70 74 73 3c 2f 69 3e 3c 2f 62 3e 20 61 cripts</i></b> a
0330: 6e 64 20 3c 62 3e 3c 69 3e 56 61 72 69 61 62 6c nd <b><i>Variabl
0340: 65 73 3c 2f 69 3e 3c 2f 62 3e 20 74 6f 20 62 65 es</i></b> to be
0350: 20 72 65 70 6c 61 63 65 64 20 6a 75 73 74 20 62 replaced just b
0360: 65 66 6f 72 65 20 61 63 74 75 61 6c 20 65 78 65 efore actual exe
0370: 63 75 74 69 6f 6e 2e 0d 0a 4e 6f 74 20 6f 6e 6c cution...Not onl
0380: 79 3a 20 74 68 69 6e 6b 20 6f 66 20 6d 61 6e 79 y: think of many
0390: 20 77 6f 6e 64 65 72 66 75 6c 20 6f 70 70 6f 72 wonderful oppor
03a0: 74 75 6e 69 74 69 65 73 20 64 65 72 69 76 69 6e tunities derivin
03b0: 67 20 66 72 6f 6d 20 70 65 72 6d 61 6e 65 6e 74 g from permanent
03c0: 6c 79 20 73 74 6f 72 69 6e 67 20 77 69 74 68 69 ly storing withi
03d0: 6e 20 61 20 64 61 74 61 62 61 73 65 20 73 75 63 n a database suc
03e0: 68 20 3c 62 3e 3c 69 3e 53 51 4c 20 53 63 72 69 h <b><i>SQL Scri
03f0: 70 74 73 20 77 69 74 68 20 56 61 72 69 61 62 6c pts with Variabl
0400: 65 73 3c 2f 69 3e 3c 2f 62 3e 20 73 6f 20 74 6f es</i></b> so to
0410: 20 6d 61 6b 65 20 61 73 20 73 69 6d 70 6c 65 20 make as simple
0420: 61 73 20 70 6f 73 73 69 62 6c 65 20 61 75 74 6f as possible auto
0430: 6d 61 74 69 6e 67 20 63 6f 6d 6d 6f 6e 20 77 6f mating common wo
0440: 72 6b 66 6c 6f 77 73 20 74 6f 20 62 65 20 72 65 rkflows to be re
0450: 70 65 61 74 65 64 6c 79 20 65 78 65 63 75 74 65 peatedly execute
0460: 64 2e 0d 0a 54 68 69 73 20 65 78 61 63 74 6c 79 d...This exactly
0470: 20 69 73 20 74 68 65 20 69 6e 74 65 6e 64 65 64 is the intended
0480: 20 73 63 6f 70 65 20 6f 66 20 74 68 69 73 20 6e scope of this n
0490: 65 77 20 6d 6f 64 75 6c 65 2e 3c 62 72 3e 3c 62 ew module.<br><b
04a0: 72 3e 0d 0a 57 65 27 6c 6c 20 73 74 61 72 74 20 r>..We'll start
04b0: 66 69 72 73 74 20 62 79 20 66 6f 72 6d 61 6c 6c first by formall
04c0: 79 20 64 65 66 69 6e 69 6e 67 20 66 65 77 20 62 y defining few b
04d0: 61 73 69 63 20 63 6f 6e 63 65 70 74 73 20 61 6e asic concepts an
04e0: 64 20 6f 62 6a 65 63 74 73 20 73 6f 20 74 6f 20 d objects so to
04f0: 61 76 6f 69 64 20 61 6e 79 20 70 6f 73 73 69 62 avoid any possib
0500: 6c 65 20 63 6f 6e 66 75 73 69 6f 6e 2e 3c 62 72 le confusion.<br
0510: 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 32 ><br>..<hr>..<h2
0520: 3e 42 61 73 69 63 20 44 65 66 69 6e 69 74 69 6f >Basic Definitio
0530: 6e 73 20 61 6e 64 20 43 6f 6e 63 65 70 74 73 3c ns and Concepts<
0540: 2f 68 32 3e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e /h2>..<ol>..<li>
0550: 0d 0a 3c 68 34 3e 53 51 4c 20 53 74 61 74 65 6d ..<h4>SQL Statem
0560: 65 6e 74 3c 2f 68 34 3e 0d 0a 54 68 65 20 6d 69 ent</h4>..The mi
0570: 6e 69 6d 61 6c 20 65 78 65 63 75 74 69 6f 6e 20 nimal execution
0580: 75 6e 69 74 20 61 6c 6c 6f 77 65 64 20 62 79 20 unit allowed by
0590: 53 51 4c 20 73 79 6e 74 61 78 3b 20 61 20 73 74 SQL syntax; a st
05a0: 61 6e 64 2d 61 6c 6f 6e 65 20 53 51 4c 20 64 69 and-alone SQL di
05b0: 72 65 63 74 69 76 65 20 74 6f 20 62 65 20 61 74 rective to be at
05c0: 6f 6d 69 63 61 6c 6c 79 20 65 78 65 63 75 74 65 omically execute
05d0: 64 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 73 74 d in a single st
05e0: 65 70 2e 20 45 78 61 6d 70 6c 65 73 3a 0d 0a 3c ep. Examples:..<
05f0: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 verbatim>..SELEC
0600: 54 20 69 64 2c 20 6e 61 6d 65 2c 20 6d 65 61 73 T id, name, meas
0610: 75 72 65 20 46 52 4f 4d 20 73 6f 6d 65 5f 74 61 ure FROM some_ta
0620: 62 6c 65 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ble;..----------
0630: 2d 2d 0d 0a 44 45 4c 45 54 45 20 46 52 4f 4d 20 --..DELETE FROM
0640: 73 6f 6d 65 5f 74 61 62 6c 65 20 57 48 45 52 45 some_table WHERE
0650: 20 6d 65 61 73 75 72 65 20 3e 20 31 30 30 30 3b measure > 1000;
0660: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a ..------------..
0670: 55 50 44 41 54 45 20 73 6f 6d 65 5f 74 61 62 6c UPDATE some_tabl
0680: 65 20 53 45 54 20 6d 65 61 73 75 72 65 20 3d 20 e SET measure =
0690: 6d 65 61 73 75 72 65 20 2f 20 31 30 2e 30 0d 0a measure / 10.0..
06a0: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e </verbatim>..<u>
06b0: 4e 6f 74 65 3c 2f 75 3e 3a 20 53 51 4c 20 53 74 Note</u>: SQL St
06c0: 61 74 65 6d 65 6e 74 73 20 61 72 65 20 75 73 75 atements are usu
06d0: 61 6c 6c 79 20 65 78 70 65 63 74 65 64 20 74 6f ally expected to
06e0: 20 62 65 20 65 78 70 6c 69 63 69 74 6c 79 20 74 be explicitly t
06f0: 65 72 6d 69 6e 61 74 65 64 20 62 79 20 61 20 3c erminated by a <
0700: 62 3e 3c 69 3e 73 65 6d 69 63 6f 6c 6f 6e 3c 2f b><i>semicolon</
0710: 69 3e 3c 2f 62 3e 20 28 3c 62 3e 3c 69 3e 3b 3c i></b> (<b><i>;<
0720: 2f 69 3e 3c 2f 62 3e 29 2e 3c 62 72 3e 0d 0a 54 /i></b>).<br>..T
0730: 68 65 20 73 65 6d 69 63 6f 6c 6f 6e 20 74 65 72 he semicolon ter
0740: 6d 69 6e 61 74 6f 72 20 63 61 6e 20 62 65 20 73 minator can be s
0750: 61 66 65 6c 79 20 73 75 70 70 72 65 73 73 65 64 afely suppressed
0760: 20 6f 6e 6c 79 20 77 68 65 6e 20 74 68 65 20 53 only when the S
0770: 51 4c 20 53 74 61 74 65 6d 65 6e 74 20 69 73 20 QL Statement is
0780: 69 6d 6d 65 64 69 61 74 65 6c 79 20 66 6f 6c 6c immediately foll
0790: 6f 77 65 64 20 62 79 20 61 20 73 74 72 69 6e 67 owed by a string
07a0: 20 74 65 72 6d 69 6e 61 74 6f 72 20 28 6c 65 61 terminator (lea
07b0: 64 69 6e 67 20 61 6e 64 20 74 72 61 69 6c 69 6e ding and trailin
07c0: 67 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 61 g sequences of a
07d0: 6c 6c 20 3c 62 3e 3c 69 3e 62 6c 61 6e 6b 73 3c ll <b><i>blanks<
07e0: 2f 69 3e 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 20 /i></b> will be
07f0: 61 6c 77 61 79 73 20 69 67 6e 6f 72 65 64 29 2e always ignored).
0800: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c ..</li>..<li>..<
0810: 68 34 3e 53 51 4c 20 53 63 72 69 70 74 3c 2f 68 h4>SQL Script</h
0820: 34 3e 0d 0a 41 20 6d 6f 72 65 20 6f 72 20 6c 65 4>..A more or le
0830: 73 73 20 63 6f 6d 70 6c 65 78 20 73 65 71 75 65 ss complex seque
0840: 6e 63 65 20 6f 66 20 3c 62 3e 3c 69 3e 53 51 4c nce of <b><i>SQL
0850: 20 53 74 61 74 65 6d 65 6e 74 73 3c 2f 69 3e 3c Statements</i><
0860: 2f 62 3e 2c 20 70 6f 73 73 69 62 6c 79 20 69 6e /b>, possibly in
0870: 63 6c 75 64 69 6e 67 20 69 6e 74 65 72 6c 65 61 cluding interlea
0880: 76 65 64 20 3c 62 3e 3c 69 3e 43 6f 6d 6d 65 6e ved <b><i>Commen
0890: 74 73 3c 2f 69 3e 3c 2f 62 3e 20 61 6e 64 2f 6f ts</i></b> and/o
08a0: 72 20 3c 62 3e 3c 69 3e 44 6f 74 20 4d 61 63 72 r <b><i>Dot Macr
08b0: 6f 73 3c 2f 69 3e 3c 2f 62 3e 2e 3c 62 72 3e 0d os</i></b>.<br>.
08c0: 0a 53 51 4c 20 53 63 72 69 70 74 73 20 61 72 65 .SQL Scripts are
08d0: 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 62 65 20 intended to be
08e0: 65 78 65 63 75 74 65 64 20 69 6e 20 61 20 73 69 executed in a si
08f0: 6e 67 6c 65 20 6d 6f 6e 6f 6c 69 74 68 69 63 20 ngle monolithic
0900: 70 61 73 73 20 28 61 74 6f 6d 69 63 20 6f 72 20 pass (atomic or
0910: 6e 6f 74 2c 20 64 65 70 65 6e 64 69 6e 67 20 6f not, depending o
0920: 6e 20 69 6e 74 65 72 6e 61 6c 20 3c 62 3e 3c 69 n internal <b><i
0930: 3e 54 72 61 6e 73 61 63 74 69 6f 6e 3c 2f 69 3e >Transaction</i>
0940: 3c 2f 62 3e 20 68 61 6e 64 6c 69 6e 67 29 2e 20 </b> handling).
0950: 45 78 61 6d 70 6c 65 3a 0d 0a 3c 76 65 72 62 61 Example:..<verba
0960: 74 69 6d 3e 0d 0a 2e 65 63 68 6f 20 6f 6e 0d 0a tim>...echo on..
0970: 0d 0a 2d 2d 0d 0a 2d 2d 20 73 74 61 72 74 69 6e ..--..-- startin
0980: 67 20 61 20 54 72 61 6e 73 61 63 74 69 6f 6e 0d g a Transaction.
0990: 0a 2d 2d 0d 0a 42 45 47 49 4e 3b 0d 0a 0d 0a 2d .--..BEGIN;....-
09a0: 2d 0d 0a 2d 2d 20 63 72 65 61 74 69 6e 67 20 61 -..-- creating a
09b0: 20 74 61 62 6c 65 0d 0a 2d 2d 0d 0a 43 52 45 41 table..--..CREA
09c0: 54 45 20 54 41 42 4c 45 20 65 78 61 6d 70 6c 65 TE TABLE example
09d0: 20 28 0d 0a 20 20 69 64 20 49 4e 54 45 47 45 52 (.. id INTEGER
09e0: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 PRIMARY KEY AUT
09f0: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0d 0a 20 20 6e OINCREMENT,.. n
0a00: 61 6d 65 20 54 45 58 54 20 4e 4f 54 20 4e 55 4c ame TEXT NOT NUL
0a10: 4c 2c 0d 0a 20 20 76 61 6c 75 65 20 44 4f 55 42 L,.. value DOUB
0a20: 4c 45 29 3b 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 70 LE);....--..-- p
0a30: 6f 70 75 6c 61 74 69 6e 67 20 74 68 65 20 74 61 opulating the ta
0a40: 62 6c 65 0d 0a 2d 2d 0d 0a 49 4e 53 45 52 54 20 ble..--..INSERT
0a50: 49 4e 54 4f 20 65 78 61 6d 70 6c 65 20 28 69 64 INTO example (id
0a60: 2c 20 6e 61 6d 65 2c 20 76 61 6c 75 65 29 20 56 , name, value) V
0a70: 41 4c 55 45 53 20 28 4e 55 4c 4c 2c 20 27 66 69 ALUES (NULL, 'fi
0a80: 72 73 74 27 2c 20 31 32 2e 33 34 29 3b 0d 0a 49 rst', 12.34);..I
0a90: 4e 53 45 52 54 20 49 4e 54 4f 20 65 78 61 6d 70 NSERT INTO examp
0aa0: 6c 65 20 28 69 64 2c 20 6e 61 6d 65 2c 20 76 61 le (id, name, va
0ab0: 6c 75 65 29 20 56 41 4c 55 45 53 20 28 4e 55 4c lue) VALUES (NUL
0ac0: 4c 2c 20 27 73 65 63 6f 6e 64 27 2c 20 35 36 2e L, 'second', 56.
0ad0: 37 38 29 3b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 78);..INSERT INT
0ae0: 4f 20 65 78 61 6d 70 6c 65 20 28 69 64 2c 20 6e O example (id, n
0af0: 61 6d 65 2c 20 76 61 6c 75 65 29 20 56 41 4c 55 ame, value) VALU
0b00: 45 53 20 28 4e 55 4c 4c 2c 20 27 74 68 69 72 64 ES (NULL, 'third
0b10: 22 2c 20 4e 55 4c 4c 29 3b 0d 0a 0d 0a 2d 2d 0d ", NULL);....--.
0b20: 0a 2d 2d 20 63 6f 6d 6d 69 74 74 69 6e 67 20 74 .-- committing t
0b30: 68 65 20 70 65 6e 64 69 6e 67 20 54 72 61 6e 73 he pending Trans
0b40: 61 63 74 69 6f 6e 0d 0a 2d 2d 0d 0a 43 4f 4d 4d action..--..COMM
0b50: 49 54 3b 0d 0a 0d 0a 2e 71 75 69 74 0d 0a 3c 2f IT;.....quit..</
0b60: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 2f 6c 69 3e verbatim>..</li>
0b70: 0d 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 53 51 4c 20 ..<li>..<h4>SQL
0b80: 56 61 72 69 61 62 6c 65 3c 2f 68 34 3e 0d 0a 41 Variable</h4>..A
0b90: 20 3c 62 3e 3c 69 3e 53 51 4c 20 56 61 72 69 61 <b><i>SQL Varia
0ba0: 62 6c 65 3c 2f 69 3e 3c 2f 62 3e 20 69 73 20 6a ble</i></b> is j
0bb0: 75 73 74 20 61 20 3c 69 3e 3c 75 3e 6d 6e 65 6d ust a <i><u>mnem
0bc0: 6f 6e 69 63 20 73 79 6d 62 6f 6c 3c 2f 75 3e 3c onic symbol</u><
0bd0: 2f 69 3e 20 65 6e 63 6c 6f 73 65 64 20 62 65 74 /i> enclosed bet
0be0: 77 65 65 6e 20 74 77 6f 20 3c 69 3e 3c 75 3e 73 ween two <i><u>s
0bf0: 70 65 63 69 61 6c 20 6d 61 72 6b 65 72 73 3c 2f pecial markers</
0c00: 75 3e 3c 2f 69 3e 20 28 3c 62 3e 3c 69 3e 40 3c u></i> (<b><i>@<
0c10: 2f 69 3e 3c 2f 62 3e 20 6f 72 20 3c 62 3e 3c 69 /i></b> or <b><i
0c20: 3e 24 3c 2f 69 3e 3c 2f 62 3e 29 2e 20 45 78 61 >$</i></b>). Exa
0c30: 6d 70 6c 65 73 3a 0d 0a 3c 76 65 72 62 61 74 69 mples:..<verbati
0c40: 6d 3e 0d 0a 40 74 61 62 6c 65 5f 6e 61 6d 65 40 m>..@table_name@
0c50: 0d 0a 40 63 6f 6c 5f 6e 61 6d 65 40 0d 0a 24 76 ..@col_name@..$v
0c60: 61 6c 75 65 24 0d 0a 24 72 61 64 69 75 73 24 0d alue$..$radius$.
0c70: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 .</verbatim>..<u
0c80: 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 75 73 69 6e 67 >Note</u>: using
0c90: 20 74 68 65 20 3c 62 3e 3c 69 3e 40 3c 2f 69 3e the <b><i>@</i>
0ca0: 3c 2f 62 3e 20 6f 72 20 74 68 65 20 3c 62 3e 3c </b> or the <b><
0cb0: 69 3e 24 3c 2f 69 3e 3c 2f 62 3e 20 6d 61 72 6b i>$</i></b> mark
0cc0: 65 72 73 20 69 73 20 6a 75 73 74 20 61 6e 20 3c ers is just an <
0cd0: 69 3e 3c 75 3e 61 65 73 74 68 65 74 69 63 20 63 i><u>aesthetic c
0ce0: 68 6f 69 63 65 3c 2f 75 3e 3c 2f 69 3e 3b 20 62 hoice</u></i>; b
0cf0: 6f 74 68 20 68 61 76 65 20 69 64 65 6e 74 69 63 oth have identic
0d00: 61 6c 20 6d 65 61 6e 69 6e 67 20 61 6e 64 20 70 al meaning and p
0d10: 72 61 63 74 69 63 61 6c 20 65 66 66 65 63 74 2e ractical effect.
0d20: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c ..</li>..<li>..<
0d30: 68 34 3e 53 51 4c 20 42 6f 64 79 3c 2f 68 34 3e h4>SQL Body</h4>
0d40: 0d 0a 41 20 3c 62 3e 3c 69 3e 53 51 4c 20 53 63 ..A <b><i>SQL Sc
0d50: 72 69 70 74 3c 2f 69 3e 3c 2f 62 3e 20 69 6e 74 ript</i></b> int
0d60: 65 72 6e 61 6c 6c 79 20 75 73 69 6e 67 20 3c 62 ernally using <b
0d70: 3e 3c 69 3e 56 61 72 69 61 62 6c 65 73 3c 2f 69 ><i>Variables</i
0d80: 3e 3c 2f 62 3e 2e 20 45 78 61 6d 70 6c 65 3a 0d ></b>. Example:.
0d90: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 2e 65 63 .<verbatim>...ec
0da0: 68 6f 20 6f 6e 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 ho on....--..--
0db0: 73 74 61 72 74 69 6e 67 20 61 20 54 72 61 6e 73 starting a Trans
0dc0: 61 63 74 69 6f 6e 0d 0a 2d 2d 0d 0a 42 45 47 49 action..--..BEGI
0dd0: 4e 3b 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 63 72 65 N;....--..-- cre
0de0: 61 74 69 6e 67 20 61 20 74 61 62 6c 65 0d 0a 2d ating a table..-
0df0: 2d 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 -..CREATE TABLE
0e00: 40 74 61 62 6c 65 40 20 28 0d 0a 20 20 40 70 6b @table@ (.. @pk
0e10: 40 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 @ INTEGER PRIMAR
0e20: 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d Y KEY AUTOINCREM
0e30: 45 4e 54 2c 0d 0a 20 20 40 63 6f 6c 31 40 20 54 ENT,.. @col1@ T
0e40: 45 58 54 20 4e 4f 54 20 4e 55 4c 4c 2c 0d 0a 20 EXT NOT NULL,..
0e50: 20 40 63 6f 6c 32 40 20 44 4f 55 42 4c 45 29 3b @col2@ DOUBLE);
0e60: 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 70 6f 70 75 6c ....--..-- popul
0e70: 61 74 69 6e 67 20 74 68 65 20 74 61 62 6c 65 0d ating the table.
0e80: 0a 2d 2d 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f .--..INSERT INTO
0e90: 20 40 74 61 62 6c 65 40 20 28 40 70 6b 40 2c 20 @table@ (@pk@,
0ea0: 40 63 6f 6c 31 40 2c 20 40 63 6f 6c 32 40 29 20 @col1@, @col2@)
0eb0: 56 41 4c 55 45 53 20 28 4e 55 4c 4c 2c 20 27 66 VALUES (NULL, 'f
0ec0: 69 72 73 74 27 2c 20 31 32 2e 33 34 29 3b 0d 0a irst', 12.34);..
0ed0: 49 4e 53 45 52 54 20 49 4e 54 4f 20 40 74 61 62 INSERT INTO @tab
0ee0: 6c 65 40 20 28 40 70 6b 40 2c 20 40 63 6f 6c 31 le@ (@pk@, @col1
0ef0: 40 2c 20 40 63 6f 6c 32 40 29 20 56 41 4c 55 45 @, @col2@) VALUE
0f00: 53 20 28 4e 55 4c 4c 2c 20 27 73 65 63 6f 6e 64 S (NULL, 'second
0f10: 27 2c 20 35 36 2e 37 38 29 3b 0d 0a 49 4e 53 45 ', 56.78);..INSE
0f20: 52 54 20 49 4e 54 4f 20 40 74 61 62 6c 65 40 20 RT INTO @table@
0f30: 28 40 70 6b 40 2c 20 40 63 6f 6c 32 40 2c 20 40 (@pk@, @col2@, @
0f40: 63 6f 6c 32 40 29 20 56 41 4c 55 45 53 20 28 4e col2@) VALUES (N
0f50: 55 4c 4c 2c 20 27 74 68 69 72 64 22 2c 20 4e 55 ULL, 'third", NU
0f60: 4c 4c 29 3b 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 63 LL);....--..-- c
0f70: 6f 6d 6d 69 74 74 69 6e 67 20 74 68 65 20 70 65 ommitting the pe
0f80: 6e 64 69 6e 67 20 54 72 61 6e 73 61 63 74 69 6f nding Transactio
0f90: 6e 0d 0a 2d 2d 0d 0a 43 4f 4d 4d 49 54 3b 0d 0a n..--..COMMIT;..
0fa0: 0d 0a 2e 71 75 69 74 0d 0a 3c 2f 76 65 72 62 61 ...quit..</verba
0fb0: 74 69 6d 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 tim>..<u>Note</u
0fc0: 3e 3a 20 74 68 69 73 20 73 65 63 6f 6e 64 20 76 >: this second v
0fd0: 65 72 73 69 6f 6e 20 69 73 20 6f 62 76 69 6f 75 ersion is obviou
0fe0: 73 6c 79 20 6d 6f 72 65 20 66 6c 65 78 69 62 6c sly more flexibl
0ff0: 65 20 74 68 61 6e 20 74 68 65 20 69 6e 69 74 69 e than the initi
1000: 61 6c 20 53 51 4c 20 73 63 72 69 70 74 2c 20 6a al SQL script, j
1010: 75 73 74 20 62 65 63 61 75 73 65 20 74 68 65 72 ust because ther
1020: 65 20 61 72 65 6e 27 74 20 3c 75 3e 3c 69 3e 68 e aren't <u><i>h
1030: 61 72 64 77 69 72 65 64 3c 2f 69 3e 3c 2f 75 3e ardwired</i></u>
1040: 20 74 61 62 6c 65 2d 6e 61 6d 65 73 20 61 6e 64 table-names and
1050: 20 63 6f 6c 75 6d 6e 2d 6e 61 6d 65 73 2c 20 61 column-names, a
1060: 6c 6c 20 74 68 65 6d 20 61 72 65 20 6e 6f 77 20 ll them are now
1070: 62 65 63 6f 6d 65 20 3c 75 3e 3c 69 3e 73 79 6d become <u><i>sym
1080: 62 6f 6c 69 63 3c 2f 69 3e 3c 2f 75 3e 2e 3c 62 bolic</i></u>.<b
1090: 72 3e 0d 0a 53 6f 20 77 65 20 61 72 65 20 6e 6f r>..So we are no
10a0: 77 20 66 72 65 65 20 74 6f 20 72 65 75 73 65 20 w free to reuse
10b0: 6d 6f 72 65 20 74 69 6d 65 73 20 74 68 69 73 20 more times this
10c0: 53 51 4c 20 42 6f 64 79 20 69 6e 20 64 69 66 66 SQL Body in diff
10d0: 65 72 65 6e 74 20 63 6f 6e 74 65 78 74 73 3b 20 erent contexts;
10e0: 77 65 20 6a 75 73 74 20 68 61 76 65 20 74 6f 20 we just have to
10f0: 61 70 70 72 6f 70 72 69 61 74 65 6c 79 20 73 65 appropriately se
1100: 74 20 74 68 65 20 56 61 72 69 61 62 6c 65 20 56 t the Variable V
1110: 61 6c 75 65 73 20 6a 75 73 74 20 69 6d 6d 65 64 alues just immed
1120: 69 61 74 65 6c 79 20 62 65 66 6f 72 65 20 61 63 iately before ac
1130: 74 75 61 6c 20 65 78 65 63 75 74 69 6f 6e 2e 3c tual execution.<
1140: 62 72 3e 3c 62 72 3e 0d 0a 3c 62 3e 3c 69 3e 53 br><br>..<b><i>S
1150: 51 4c 20 42 6f 64 69 65 73 3c 2f 69 3e 3c 2f 62 QL Bodies</i></b
1160: 3e 20 65 78 69 73 74 20 69 6e 20 74 77 6f 20 64 > exist in two d
1170: 69 66 66 65 72 65 6e 74 20 66 6f 72 6d 73 3a 0d ifferent forms:.
1180: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 72 61 .<ul>..<li><b>ra
1190: 77 3c 2f 62 3e 3a 20 73 74 69 6c 6c 20 69 6e 63 w</b>: still inc
11a0: 6c 75 64 69 6e 67 20 73 79 6d 62 6f 6c 69 63 20 luding symbolic
11b0: 56 61 72 69 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d Variables.</li>.
11c0: 0a 3c 6c 69 3e 3c 62 3e 63 6f 6f 6b 65 64 3c 2f .<li><b>cooked</
11d0: 62 3e 3a 20 70 72 65 73 65 6e 74 69 6e 67 20 61 b>: presenting a
11e0: 6c 6c 20 73 79 6d 62 6f 6c 73 20 70 72 6f 70 65 ll symbols prope
11f0: 72 6c 79 20 72 65 70 6c 61 63 65 64 20 62 79 20 rly replaced by
1200: 74 68 65 69 72 20 61 63 74 75 61 6c 20 76 61 6c their actual val
1210: 75 65 73 2e 3c 62 72 3e 0d 0a 52 61 74 68 65 72 ues.<br>..Rather
1220: 20 6f 62 76 69 6f 75 73 6c 79 2c 20 79 6f 75 20 obviously, you
1230: 63 61 6e 20 73 75 63 63 65 73 73 66 75 6c 6c 79 can successfully
1240: 20 65 78 65 63 75 74 65 20 6f 6e 6c 79 20 74 68 execute only th
1250: 65 20 3c 62 3e 3c 69 3e 63 6f 6f 6b 65 64 3c 2f e <b><i>cooked</
1260: 69 3e 3c 2f 62 3e 20 66 6f 72 6d 2e 3c 2f 6c 69 i></b> form.</li
1270: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d >..</ul>..</li>.
1280: 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 53 51 4c 20 50 .<li>..<h4>SQL P
1290: 72 6f 63 65 64 75 72 65 20 42 4c 4f 42 20 6f 62 rocedure BLOB ob
12a0: 6a 65 63 74 3c 2f 68 34 3e 0d 0a 54 68 69 73 20 ject</h4>..This
12b0: 73 69 6d 70 6c 79 20 69 73 20 61 20 3c 62 3e 3c simply is a <b><
12c0: 69 3e 42 4c 4f 42 20 65 6e 63 6f 64 65 64 3c 2f i>BLOB encoded</
12d0: 69 3e 3c 2f 62 3e 20 70 72 65 2d 63 6f 6d 70 69 i></b> pre-compi
12e0: 6c 65 64 20 3c 62 3e 3c 69 3e 53 51 4c 20 42 6f led <b><i>SQL Bo
12f0: 64 79 3c 2f 69 3e 3c 2f 62 3e 2c 20 61 6e 64 20 dy</i></b>, and
1300: 69 73 20 74 68 65 20 75 73 75 61 6c 20 74 61 72 is the usual tar
1310: 67 65 74 20 65 78 70 65 63 74 65 64 20 74 6f 20 get expected to
1320: 62 65 20 68 61 6e 64 6c 65 64 20 62 79 20 70 72 be handled by pr
1330: 61 63 74 69 63 61 6c 6c 79 20 61 6c 6c 20 53 51 actically all SQ
1340: 4c 20 66 75 6e 63 74 69 6f 6e 73 20 73 75 70 70 L functions supp
1350: 6f 72 74 69 6e 67 20 53 74 6f 72 65 64 20 50 72 orting Stored Pr
1360: 6f 63 65 64 75 72 65 73 20 61 6e 64 20 61 6c 69 ocedures and ali
1370: 6b 65 2e 20 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 ke. ..</li>..<li
1380: 3e 0d 0a 3c 68 34 3e 53 74 6f 72 65 64 20 50 72 >..<h4>Stored Pr
1390: 6f 63 65 64 75 72 65 3c 2f 68 34 3e 0d 0a 41 20 ocedure</h4>..A
13a0: 3c 62 3e 3c 69 3e 53 51 4c 20 50 72 6f 63 65 64 <b><i>SQL Proced
13b0: 75 72 65 20 42 4c 4f 42 20 6f 62 6a 65 63 74 3c ure BLOB object<
13c0: 2f 69 3e 3c 2f 62 3e 20 70 65 72 6d 61 6e 65 6e /i></b> permanen
13d0: 74 6c 79 20 73 74 6f 72 65 64 20 69 6e 74 6f 20 tly stored into
13e0: 61 20 64 61 74 61 62 61 73 65 2e 20 54 68 69 73 a database. This
13f0: 20 77 69 6c 6c 20 6d 61 6b 65 20 65 61 73 69 65 will make easie
1400: 72 20 72 65 75 73 69 6e 67 20 6d 6f 72 65 20 74 r reusing more t
1410: 69 6d 65 73 20 74 68 65 20 73 61 6d 65 20 53 51 imes the same SQ
1420: 4c 20 77 6f 72 6b 66 6c 6f 77 2c 20 70 65 72 68 L workflow, perh
1430: 61 70 73 20 73 6f 20 74 6f 20 69 6d 70 6c 65 6d aps so to implem
1440: 65 6e 74 20 72 6f 75 74 69 6e 65 6c 79 20 70 65 ent routinely pe
1450: 72 69 6f 64 69 63 20 74 61 73 6b 73 20 28 74 6f riodic tasks (to
1460: 20 62 65 20 65 78 65 63 75 74 65 64 20 64 61 69 be executed dai
1470: 6c 79 20 2f 20 77 65 65 6b 6c 79 20 2f 20 6d 6f ly / weekly / mo
1480: 6e 74 68 6c 79 20 61 6e 64 20 73 6f 20 6f 6e 29 nthly and so on)
1490: 2e 3c 62 72 3e 0d 0a 53 74 6f 72 65 64 20 50 72 .<br>..Stored Pr
14a0: 6f 63 65 64 75 72 65 73 20 61 6c 77 61 79 73 20 ocedures always
14b0: 68 61 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 have the followi
14c0: 6e 67 20 65 6c 65 6d 65 6e 74 73 3a 0d 0a 3c 75 ng elements:..<u
14d0: 6c 3e 0d 0a 3c 6c 69 3e 61 20 3c 62 3e 6e 61 6d l>..<li>a <b>nam
14e0: 65 3c 2f 62 3e 2c 20 69 6e 74 65 6e 64 65 64 20 e</b>, intended
14f0: 74 6f 20 62 65 20 61 6e 20 75 6e 69 71 75 65 20 to be an unique
1500: 69 64 65 6e 74 69 66 69 65 72 20 28 3c 62 3e 3c identifier (<b><
1510: 69 3e 50 72 69 6d 61 72 79 20 4b 65 79 3c 2f 69 i>Primary Key</i
1520: 3e 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c ></b>).</li>..<l
1530: 69 3e 61 20 3c 62 3e 74 69 74 6c 65 3c 2f 62 3e i>a <b>title</b>
1540: 2c 20 69 2e 65 2e 20 61 20 73 68 6f 72 74 20 64 , i.e. a short d
1550: 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 escription of th
1560: 65 20 69 6e 74 65 6e 64 65 64 20 73 63 6f 70 65 e intended scope
1570: 20 6f 66 20 74 68 65 20 53 74 6f 72 65 64 20 50 of the Stored P
1580: 72 6f 63 65 64 75 72 65 2e 3c 2f 6c 69 3e 0d 0a rocedure.</li>..
1590: 3c 6c 69 3e 61 20 3c 62 3e 53 51 4c 20 50 72 6f <li>a <b>SQL Pro
15a0: 63 65 64 75 72 65 20 42 4c 4f 42 20 4f 62 6a 65 cedure BLOB Obje
15b0: 63 74 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f ct</b>.</li>..</
15c0: 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ul>..</li>..<li>
15d0: 0d 0a 3c 68 34 3e 56 61 72 69 61 62 6c 65 20 77 ..<h4>Variable w
15e0: 69 74 68 20 56 61 6c 75 65 20 73 74 72 69 6e 67 ith Value string
15f0: 73 3c 2f 68 34 3e 0d 0a 42 65 66 6f 72 65 20 65 s</h4>..Before e
1600: 78 65 63 75 74 69 6e 67 20 61 20 3c 62 3e 3c 69 xecuting a <b><i
1610: 3e 53 51 4c 20 42 6f 64 79 3c 2f 69 3e 3c 2f 62 >SQL Body</i></b
1620: 3e 20 69 6e 63 6c 75 64 69 6e 67 20 3c 62 3e 3c > including <b><
1630: 69 3e 56 61 72 69 61 62 6c 65 73 3c 2f 69 3e 3c i>Variables</i><
1640: 2f 62 3e 20 79 6f 75 20 61 72 65 20 6f 62 76 69 /b> you are obvi
1650: 6f 75 73 6c 79 20 65 78 70 65 63 74 65 64 20 74 ously expected t
1660: 6f 20 73 65 74 20 73 6f 6d 65 20 61 70 70 72 6f o set some appro
1670: 70 72 69 61 74 65 20 3c 62 3e 3c 69 3e 56 61 6c priate <b><i>Val
1680: 75 65 3c 2f 69 3e 3c 2f 62 3e 20 66 6f 72 20 65 ue</i></b> for e
1690: 61 63 68 20 56 61 72 69 61 62 6c 65 2c 20 73 6f ach Variable, so
16a0: 20 74 6f 20 61 6c 6c 6f 77 20 66 6f 72 20 72 65 to allow for re
16b0: 70 6c 61 63 69 6e 67 20 3c 75 3e 3c 69 3e 53 79 placing <u><i>Sy
16c0: 6d 62 6f 6c 73 3c 2f 69 3e 3c 2f 75 3e 20 77 69 mbols</i></u> wi
16d0: 74 68 20 61 63 74 75 61 6c 20 3c 75 3e 3c 69 3e th actual <u><i>
16e0: 56 61 6c 75 65 73 3c 2f 69 3e 3c 2f 75 3e 20 28 Values</i></u> (
16f0: 69 2e 65 2e 20 66 6f 72 20 70 72 6f 70 65 72 6c i.e. for properl
1700: 79 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 20 3c y transforming <
1710: 62 3e 72 61 77 3c 2f 62 3e 20 53 51 4c 20 69 6e b>raw</b> SQL in
1720: 74 6f 20 3c 62 3e 63 6f 6f 6b 65 64 3c 2f 62 3e to <b>cooked</b>
1730: 20 53 51 4c 29 2e 3c 62 72 3e 0d 0a 41 20 3c 62 SQL).<br>..A <b
1740: 3e 3c 69 3e 56 61 72 69 61 62 6c 65 20 77 69 74 ><i>Variable wit
1750: 68 20 56 61 6c 75 65 3c 2f 69 3e 3c 2f 62 3e 20 h Value</i></b>
1760: 73 74 72 69 6e 67 20 73 69 6d 70 6c 79 20 69 73 string simply is
1770: 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 6c an appropriatel
1780: 79 20 77 65 6c 6c 2d 66 6f 72 6d 61 74 74 65 64 y well-formatted
1790: 20 54 65 78 74 20 73 74 72 69 6e 67 20 64 65 63 Text string dec
17a0: 6c 61 72 69 6e 67 20 62 6f 74 68 20 74 68 65 20 laring both the
17b0: 53 79 6d 62 6f 6c 20 61 6e 64 20 74 68 65 20 63 Symbol and the c
17c0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 72 65 70 orresponding rep
17d0: 6c 61 63 65 6d 65 6e 74 20 56 61 6c 75 65 20 28 lacement Value (
17e0: 65 78 70 72 65 73 73 65 64 20 69 6e 20 69 74 73 expressed in its
17f0: 20 74 65 78 74 75 61 6c 20 72 65 70 72 65 73 65 textual represe
1800: 6e 74 61 74 69 6f 6e 29 2e 20 45 78 61 6d 70 6c ntation). Exampl
1810: 65 73 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d es:..<verbatim>.
1820: 0a 27 40 76 61 6c 75 65 5f 31 40 3d 31 32 33 34 .'@value_1@=1234
1830: 27 20 20 20 20 20 20 20 20 20 20 2d 2d 20 69 6e ' -- in
1840: 74 65 67 65 72 20 76 61 6c 75 65 0d 0a 27 40 76 teger value..'@v
1850: 61 6c 75 65 5f 32 40 3d 31 32 2e 33 34 27 20 20 alue_2@=12.34'
1860: 20 20 20 20 20 20 20 2d 2d 20 64 6f 75 62 6c 65 -- double
1870: 20 76 61 6c 75 65 0d 0a 27 40 76 61 6c 75 65 5f value..'@value_
1880: 33 40 3d 4e 65 77 20 59 6f 72 6b 20 43 69 74 79 3@=New York City
1890: 27 20 2d 2d 20 74 65 78 74 20 76 61 6c 75 65 0d ' -- text value.
18a0: 0a 27 40 76 61 6c 75 65 5f 34 40 3d 78 27 27 30 .'@value_4@=x''0
18b0: 31 32 33 61 62 63 64 27 27 27 20 2d 2d 20 62 6c 123abcd''' -- bl
18c0: 6f 62 20 76 61 6c 75 65 0d 0a 27 40 76 61 6c 75 ob value..'@valu
18d0: 65 5f 35 40 3d 4e 55 4c 4c 27 20 20 20 20 20 20 e_5@=NULL'
18e0: 20 20 20 20 2d 2d 20 6e 75 6c 6c 20 76 61 6c 75 -- null valu
18f0: 65 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a e..</verbatim>..
1900: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 34 </li>..<li>..<h4
1910: 3e 53 74 6f 72 65 64 20 56 61 72 69 61 62 6c 65 >Stored Variable
1920: 3c 2f 68 34 3e 0d 0a 41 20 3c 62 3e 3c 69 3e 56 </h4>..A <b><i>V
1930: 61 72 69 61 62 6c 65 20 77 69 74 68 20 56 61 6c ariable with Val
1940: 75 65 20 73 74 72 69 6e 67 3c 2f 69 3e 3c 2f 62 ue string</i></b
1950: 3e 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 73 74 > permanently st
1960: 6f 72 65 64 20 69 6e 74 6f 20 61 20 64 61 74 61 ored into a data
1970: 62 61 73 65 2e 3c 62 72 3e 0d 0a 53 74 6f 72 65 base.<br>..Store
1980: 64 20 56 61 72 69 61 62 6c 65 73 20 61 6c 77 61 d Variables alwa
1990: 79 73 20 68 61 76 65 20 74 68 65 20 66 6f 6c 6c ys have the foll
19a0: 6f 77 69 6e 67 20 65 6c 65 6d 65 6e 74 73 3a 0d owing elements:.
19b0: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 20 3c 62 3e .<ul>..<li>a <b>
19c0: 6e 61 6d 65 3c 2f 62 3e 2c 20 69 6e 74 65 6e 64 name</b>, intend
19d0: 65 64 20 74 6f 20 62 65 20 61 6e 20 75 6e 69 71 ed to be an uniq
19e0: 75 65 20 69 64 65 6e 74 69 66 69 65 72 20 28 3c ue identifier (<
19f0: 62 3e 3c 69 3e 50 72 69 6d 61 72 79 20 4b 65 79 b><i>Primary Key
1a00: 3c 2f 69 3e 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d </i></b>).</li>.
1a10: 0a 3c 6c 69 3e 61 20 3c 62 3e 74 69 74 6c 65 3c .<li>a <b>title<
1a20: 2f 62 3e 2c 20 69 2e 65 2e 20 61 20 73 68 6f 72 /b>, i.e. a shor
1a30: 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 t description of
1a40: 20 74 68 65 20 69 6e 74 65 6e 64 65 64 20 73 63 the intended sc
1a50: 6f 70 65 20 6f 66 20 74 68 65 20 53 74 6f 72 65 ope of the Store
1a60: 64 20 56 61 72 69 61 62 6c 65 2e 3c 2f 6c 69 3e d Variable.</li>
1a70: 0d 0a 3c 6c 69 3e 61 20 3c 62 3e 56 61 72 69 61 ..<li>a <b>Varia
1a80: 62 6c 65 20 77 69 74 68 20 56 61 6c 75 65 20 73 ble with Value s
1a90: 74 72 69 6e 67 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d tring</b>.</li>.
1aa0: 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c .</ul>..</li>..<
1ab0: 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 3c 62 72 3e 0d /li>..</ol><br>.
1ac0: 0a 3c 68 72 3e 0d 0a 0d 0a 0d 0a 0d 0a 3c 62 72 .<hr>........<br
1ad0: 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 ><br>..<table wi
1ae0: 64 74 68 3d 22 31 30 30 25 22 3e 3c 74 72 3e 0d dth="100%"><tr>.
1af0: 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 22 .<td width="33%"
1b00: 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e 3c 2f align="left"></
1b10: 74 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 td>..<td align="
1b20: 63 65 6e 74 65 72 22 3e 3c 61 20 68 72 65 66 3d center"><a href=
1b30: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 "https://www.gai
1b40: 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f a-gis.it/fossil/
1b50: 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 libspatialite/wi
1b60: 6b 69 3f 6e 61 6d 65 3d 34 2e 33 2e 30 2b 64 6f ki?name=4.3.0+do
1b70: 63 22 3e 62 61 63 6b 20 74 6f 20 69 6e 64 65 78 c">back to index
1b80: 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 77 </a></td>..<td w
1b90: 69 64 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e idth="33%" align
1ba0: 3d 22 72 69 67 68 74 22 3e 3c 2f 74 64 3e 0d 0a ="right"></td>..
1bb0: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a 5a 20 </tr></table>.Z
1bc0: 34 37 65 39 35 63 66 33 33 39 30 34 64 62 32 64 47e95cf33904db2d
1bd0: 36 62 37 36 38 38 36 30 39 66 37 65 35 35 61 38 6b7688609f7e55a8
1be0: 0a .