sql1992.txt 1.6 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793
  1. Information Technology -
  2. Database Language SQL
  3. (Proposed revised text of DIS 9075)
  4. July 1992
  5. (Second Informal Review Draft) ISO/IEC 9075:1992, Database
  6. Language SQL- July 30, 1992
  7. Digital Equipment Corporation
  8. Maynard, Massachusetts
  9. Contents Page
  10. Foreword.........................................................xi
  11. Introduction.....................................................xiii
  12. 1 Scope ........................................................ 1
  13. 2 Normative references ......................................... 3
  14. 3 Definitions, notations, and conventions ...................... 5
  15. 3.1 Definitions ................................................ 5
  16. 3.1.1Definitions taken from ISO/IEC 10646 ....................... 5
  17. 3.1.2Definitions taken from ISO 8601 ............................ 5
  18. 3.1.3Definitions provided in this International Standard ........ 5
  19. 3.2 Notation ................................................... 7
  20. 3.3 Conventions ................................................ 9
  21. 3.3.1Informative elements ....................................... 9
  22. 3.3.2Specification of syntactic elements ........................ 9
  23. 3.3.3Specification of the Information Schema ....................10
  24. 3.3.4Use of terms ...............................................10
  25. 3.3.4Exceptions .................................................10
  26. 3.3.4Syntactic containment ......................................11
  27. 3.3.4Terms denoting rule requirements ...........................12
  28. 3.3.4Rule evaluation order ......................................12
  29. 3.3.4Conditional rules ..........................................13
  30. 3.3.4Syntactic substitution .....................................13
  31. 3.3.4Other terms ................................................14
  32. 3.3.5Descriptors ................................................14
  33. 3.3.6Index typography ...........................................15
  34. 3.4 Object identifier for Database Language SQL ................16
  35. 4 Concepts .....................................................19
  36. 4.1 Data types .................................................19
  37. 4.2 Character strings ..........................................20
  38. 4.2.1Character strings and collating sequences ..................20
  39. 4.2.2Operations involving character strings .....................22
  40. 4.2.2Operators that operate on character strings and return char-
  41. acter strings...............................................22
  42. 4.2.2Other operators involving character strings ................23
  43. 4.2.3Rules determining collating sequence usage .................23
  44. 4.3 Bit strings ................................................26
  45. 4.3.1Bit string comparison and assignment .......................27
  46. 4.3.2Operations involving bit strings ...........................27
  47. 4.3.2Operators that operate on bit strings and return bit strings
  48. ............................................................27
  49. 4.3.2Other operators involving bit strings ......................27
  50. ii Database Language SQL
  51. 4.4 Numbers ....................................................27
  52. 4.4.1Characteristics of numbers .................................28
  53. 4.4.2Operations involving numbers ...............................29
  54. 4.5 Datetimes and intervals ....................................29
  55. 4.5.1Datetimes ..................................................30
  56. 4.5.2Intervals ..................................................32
  57. 4.5.3Operations involving datetimes and intervals ...............34
  58. 4.6 Type conversions and mixing of data types ..................34
  59. 4.7 Domains ....................................................35
  60. 4.8 Columns ....................................................36
  61. 4.9 Tables .....................................................37
  62. 4.10 Integrity constraints ......................................40
  63. 4.10.Checking of constraints ....................................41
  64. 4.10.Table constraints ..........................................41
  65. 4.10.Domain constraints .........................................43
  66. 4.10.Assertions .................................................43
  67. 4.11 SQL-schemas ................................................44
  68. 4.12 Catalogs ...................................................45
  69. 4.13 Clusters of catalogs .......................................45
  70. 4.14 SQL-data ...................................................45
  71. 4.15 SQL-environment ............................................46
  72. 4.16 Modules ....................................................46
  73. 4.17 Procedures .................................................47
  74. 4.18 Parameters .................................................47
  75. 4.18.Status parameters ..........................................47
  76. 4.18.Data parameters ............................................48
  77. 4.18.Indicator parameters .......................................48
  78. 4.19 Diagnostics area ...........................................48
  79. 4.20 Standard programming languages .............................49
  80. 4.21 Cursors ....................................................49
  81. 4.22 SQL-statements .............................................51
  82. 4.22.Classes of SQL-statements ..................................51
  83. 4.22.SQL-statements classified by function ......................52
  84. 4.22.Embeddable SQL-statements ..................................55
  85. 4.22.Preparable and immediately executable SQL-statements .......56
  86. 4.22.Directly executable SQL-statements .........................58
  87. 4.22.SQL-statements and transaction states ......................59
  88. 4.23 Embedded syntax ............................................61
  89. 4.24 SQL dynamic statements .....................................61
  90. 4.25 Direct invocation of SQL ...................................64
  91. 4.26 Privileges .................................................64
  92. 4.27 SQL-agents .................................................66
  93. 4.28 SQL-transactions ...........................................67
  94. 4.29 SQL-connections ............................................70
  95. 4.30 SQL-sessions ...............................................72
  96. Table of Contents iii
  97. 4.31 Client-server operation ....................................74
  98. 4.32 Information Schema .........................................75
  99. 4.33 Leveling ...................................................75
  100. 4.34 SQL Flagger ................................................76
  101. 5 Lexical elements .............................................79
  102. 5.1 <SQL terminal character> ...................................79
  103. 5.2 <token> and <separator> ....................................82
  104. 5.3 <literal> ..................................................89
  105. 5.4 Names and identifiers ......................................98
  106. 6 Scalar expressions ...........................................107
  107. 6.1 <data type> ................................................107
  108. 6.2 <value specification> and <target specification> ...........114
  109. 6.3 <table reference> ..........................................118
  110. 6.4 <column reference> .........................................121
  111. 6.5 <set function specification> ...............................124
  112. 6.6 <numeric value function> ...................................128
  113. 6.7 <string value function> ....................................132
  114. 6.8 <datetime value function> ..................................139
  115. 6.9 <case expression> ..........................................141
  116. 6.10 <cast specification> .......................................144
  117. 6.11 <value expression> .........................................155
  118. 6.12 <numeric value expression> .................................157
  119. 6.13 <string value expression> ..................................160
  120. 6.14 <datetime value expression> ................................165
  121. 6.15 <interval value expression> ................................168
  122. 7 Query expressions ............................................173
  123. 7.1 <row value constructor> ....................................173
  124. 7.2 <table value constructor> ..................................176
  125. 7.3 <table expression> .........................................177
  126. 7.4 <from clause> ..............................................178
  127. 7.5 <joined table> .............................................180
  128. 7.6 <where clause> .............................................185
  129. 7.7 <group by clause> ..........................................187
  130. 7.8 <having clause> ............................................189
  131. 7.9 <query specification> ......................................191
  132. 7.10 <query expression> .........................................196
  133. 7.11 <scalar subquery>, <row subquery>, and <table subquery> ....203
  134. 8 Predicates ...................................................205
  135. 8.1 <predicate> ................................................205
  136. 8.2 <comparison predicate> .....................................207
  137. 8.3 <between predicate> ........................................211
  138. 8.4 <in predicate> .............................................212
  139. iv Database Language SQL
  140. 8.5 <like predicate> ...........................................214
  141. 8.6 <null predicate> ...........................................218
  142. 8.7 <quantified comparison predicate> ..........................220
  143. 8.8 <exists predicate> .........................................222
  144. 8.9 <unique predicate> .........................................223
  145. 8.10 <match predicate> ..........................................224
  146. 8.11 <overlaps predicate> .......................................227
  147. 8.12 <search condition> .........................................229
  148. 9 Data assignment rules ........................................231
  149. 9.1 Retrieval assignment .......................................231
  150. 9.2 Store assignment ...........................................234
  151. 9.3 Set operation result data types ............................237
  152. 10 Additional common elements ...................................239
  153. 10.1 <interval qualifier> .......................................239
  154. 10.2 <language clause> ..........................................243
  155. 10.3 <privileges> ...............................................245
  156. 10.4 <character set specification> ..............................248
  157. 10.5 <collate clause> ...........................................251
  158. 10.6 <constraint name definition> and <constraint attributes> ...252
  159. 11 Schema definition and manipulation ...........................255
  160. 11.1 <schema definition> ........................................255
  161. 11.2 <drop schema statement> ....................................258
  162. 11.3 <table definition> .........................................260
  163. 11.4 <column definition> ........................................262
  164. 11.5 <default clause> ...........................................266
  165. 11.6 <table constraint definition> ..............................270
  166. 11.7 <unique constraint definition> .............................272
  167. 11.8 <referential constraint definition> ........................274
  168. 11.9 <check constraint definition> ..............................281
  169. 11.10<alter table statement> ....................................283
  170. 11.11<add column definition> ....................................284
  171. 11.12<alter column definition> ..................................286
  172. 11.13<set column default clause> ................................287
  173. 11.14<drop column default clause> ...............................288
  174. 11.15<drop column definition> ...................................289
  175. 11.16<add table constraint definition> ..........................291
  176. 11.17<drop table constraint definition> .........................292
  177. 11.18<drop table statement> .....................................294
  178. 11.19<view definition> ..........................................296
  179. 11.20<drop view statement> ......................................300
  180. 11.21<domain definition> ........................................301
  181. 11.22<alter domain statement> ...................................304
  182. 11.23<set domain default clause> ................................305
  183. Table of Contents v
  184. 11.24<drop domain default clause> ...............................306
  185. 11.25<add domain constraint definition> .........................307
  186. 11.26<drop domain constraint definition> ........................308
  187. 11.27<drop domain statement> ....................................309
  188. 11.28<character set definition> .................................311
  189. 11.29<drop character set statement> .............................313
  190. 11.30<collation definition> .....................................314
  191. 11.31<drop collation statement> .................................318
  192. 11.32<translation definition> ...................................320
  193. 11.33<drop translation statement> ...............................323
  194. 11.34<assertion definition> .....................................325
  195. 11.35<drop assertion statement> .................................328
  196. 11.36<grant statement> ..........................................329
  197. 11.37<revoke statement> .........................................333
  198. 12 Module .......................................................341
  199. 12.1 <module> ...................................................341
  200. 12.2 <module name clause> .......................................344
  201. 12.3 <procedure> ................................................346
  202. 12.4 Calls to a <procedure> .....................................352
  203. 12.5 <SQL procedure statement> ..................................368
  204. 13 Data manipulation ............................................371
  205. 13.1 <declare cursor> ...........................................371
  206. 13.2 <open statement> ...........................................375
  207. 13.3 <fetch statement> ..........................................377
  208. 13.4 <close statement> ..........................................381
  209. 13.5 <select statement: single row> .............................382
  210. 13.6 <delete statement: positioned> .............................384
  211. 13.7 <delete statement: searched> ...............................386
  212. 13.8 <insert statement> .........................................388
  213. 13.9 <update statement: positioned> .............................391
  214. 13.10<update statement: searched> ...............................394
  215. 13.11<temporary table declaration> ..............................397
  216. 14 Transaction management .......................................399
  217. 14.1 <set transaction statement> ................................399
  218. 14.2 <set constraints mode statement> ...........................401
  219. 14.3 <commit statement> .........................................403
  220. 14.4 <rollback statement> .......................................405
  221. 15 Connection management ........................................407
  222. 15.1 <connect statement> ........................................407
  223. 15.2 <set connection statement> .................................410
  224. 15.3 <disconnect statement> .....................................412
  225. vi Database Language SQL
  226. 16 Session management ...........................................415
  227. 16.1 <set catalog statement> ....................................415
  228. 16.2 <set schema statement> .....................................417
  229. 16.3 <set names statement> ......................................419
  230. 16.4 <set session authorization identifier statement> ...........420
  231. 16.5 <set local time zone statement> ............................422
  232. 17 Dynamic SQL ..................................................425
  233. 17.1 Description of SQL item descriptor areas ...................425
  234. 17.2 <allocate descriptor statement> ............................431
  235. 17.3 <deallocate descriptor statement> ..........................433
  236. 17.4 <get descriptor statement> .................................434
  237. 17.5 <set descriptor statement> .................................438
  238. 17.6 <prepare statement> ........................................442
  239. 17.7 <deallocate prepared statement> ............................449
  240. 17.8 <describe statement> .......................................450
  241. 17.9 <using clause> .............................................451
  242. 17.10<execute statement> ........................................459
  243. 17.11<execute immediate statement> ..............................462
  244. 17.12<dynamic declare cursor> ...................................464
  245. 17.13<allocate cursor statement> ................................465
  246. 17.14<dynamic open statement> ...................................467
  247. 17.15<dynamic fetch statement> ..................................469
  248. 17.16<dynamic close statement> ..................................471
  249. 17.17<dynamic delete statement: positioned> .....................472
  250. 17.18<dynamic update statement: positioned> .....................474
  251. 17.19<preparable dynamic delete statement: positioned> ..........476
  252. 17.20<preparable dynamic update statement: positioned> ..........477
  253. 18 Diagnostics management .......................................479
  254. 18.1 <get diagnostics statement> ................................479
  255. 19 Embedded SQL .................................................489
  256. 19.1 <embedded SQL host program> ................................489
  257. 19.2 <embedded exception declaration> ...........................497
  258. 19.3 <embedded SQL Ada program> .................................500
  259. 19.4 <embedded SQL C program> ...................................504
  260. 19.5 <embedded SQL COBOL program> ...............................508
  261. 19.6 <embedded SQL Fortran program> .............................512
  262. 19.7 <embedded SQL MUMPS program> ...............................515
  263. 19.8 <embedded SQL Pascal program> ..............................517
  264. 19.9 <embedded SQL PL/I program> ................................520
  265. 20 Direct invocation of SQL .....................................525
  266. 20.1 <direct SQL statement> .....................................525
  267. 20.2 <direct select statement: multiple rows> ...................530
  268. Table of Contents vii
  269. 21 Information Schema and Definition Schema .....................533
  270. 21.1 Introduction ...............................................533
  271. 21.2 Information Schema .........................................535
  272. 21.2.INFORMATION_SCHEMA Schema ..................................535
  273. 21.2.INFORMATION_SCHEMA_CATALOG_NAME base table .................536
  274. 21.2.INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY assertion ......537
  275. 21.2.SCHEMATA view ..............................................538
  276. 21.2.DOMAINS view ...............................................539
  277. 21.2.DOMAIN_CONSTRAINTS view ....................................541
  278. 21.2.TABLES view ................................................542
  279. 21.2.VIEWS view .................................................543
  280. 21.2.COLUMNS view ...............................................544
  281. 21.2.TABLE_PRIVILEGES view ......................................546
  282. 21.2.COLUMN_PRIVILEGES view .....................................547
  283. 21.2.USAGE_PRIVILEGES view ......................................548
  284. 21.2.TABLE_CONSTRAINTS view .....................................549
  285. 21.2.REFERENTIAL_CONSTRAINTS view ...............................550
  286. 21.2.CHECK_CONSTRAINTS view .....................................551
  287. 21.2.KEY_COLUMN_USAGE view ......................................552
  288. 21.2.ASSERTIONS view ............................................553
  289. 21.2.CHARACTER_SETS view ........................................554
  290. 21.2.COLLATIONS view ............................................555
  291. 21.2.TRANSLATIONS view ..........................................556
  292. 21.2.VIEW_TABLE_USAGE view ......................................557
  293. 21.2.VIEW_COLUMN_USAGE view .....................................558
  294. 21.2.CONSTRAINT_TABLE_USAGE view ................................559
  295. 21.2.CONSTRAINT_COLUMN_USAGE view ...............................561
  296. 21.2.COLUMN_DOMAIN_USAGE view ...................................562
  297. 21.2.SQL_LANGUAGES view .........................................563
  298. 21.2.SQL_IDENTIFIER domain ......................................564
  299. 21.2.CHARACTER_DATA domain ......................................564
  300. 21.2.CARDINAL_NUMBER domain .....................................565
  301. 21.3 Definition Schema ..........................................566
  302. 21.3.Introduction ...............................................566
  303. 21.3.DEFINITION_SCHEMA Schema ...................................567
  304. 21.3.USERS base table ...........................................568
  305. 21.3.SCHEMATA base table ........................................569
  306. 21.3.DATA_TYPE_DESCRIPTOR base table ............................570
  307. 21.3.DOMAINS base table .........................................573
  308. 21.3.DOMAIN_CONSTRAINTS base table ..............................574
  309. 21.3.TABLES base table ..........................................576
  310. 21.3.VIEWS base table ...........................................578
  311. 21.3.COLUMNS base table .........................................580
  312. 21.3.VIEW_TABLE_USAGE base table ................................583
  313. 21.3.VIEW_COLUMN_USAGE base table ...............................584
  314. viii Database Language SQL
  315. 21.3.TABLE_CONSTRAINTS base table ...............................585
  316. 21.3.KEY_COLUMN_USAGE base table ................................588
  317. 21.3.REFERENTIAL_CONSTRAINTS base table .........................590
  318. 21.3.CHECK_CONSTRAINTS base table ...............................593
  319. 21.3.CHECK_TABLE_USAGE base table ...............................595
  320. 21.3.CHECK_COLUMN_USAGE base table ..............................596
  321. 21.3.ASSERTIONS base table ......................................598
  322. 21.3.TABLE_PRIVILEGES base table ................................600
  323. 21.3.COLUMN_PRIVILEGES base table ...............................602
  324. 21.3.USAGE_PRIVILEGES base table ................................604
  325. 21.3.CHARACTER_SETS base table ..................................606
  326. 21.3.COLLATIONS base table ......................................608
  327. 21.3.TRANSLATIONS base table ....................................610
  328. 21.3.SQL_LANGUAGES base table ...................................612
  329. 21.4 Assertions on the base tables ..............................616
  330. 21.4.UNIQUE_CONSTRAINT_NAME assertion ...........................616
  331. 21.4.EQUAL_KEY_DEGREES assertion ................................617
  332. 21.4.KEY_DEGREE_GREATER_THAN_OR_EQUAL_TO_1 assertion ............618
  333. 22 Status codes .................................................619
  334. 22.1 SQLSTATE ...................................................619
  335. 22.2 SQLCODE ....................................................624
  336. 23 Conformance ..................................................625
  337. 23.1 Introduction ...............................................625
  338. 23.2 Claims of conformance ......................................625
  339. 23.3 Extensions and options .....................................626
  340. 23.4 Flagger requirements .......................................626
  341. 23.5 Processing methods .........................................627
  342. Annex A Leveling the SQL Language..............................629
  343. A.1 Intermediate SQL Specifications ............................629
  344. A.2 Entry SQL Specifications ...................................640
  345. Annex B Implementation-defined elements........................653
  346. Annex C Implementation-dependent elements......................667
  347. Annex D Deprecated features....................................675
  348. Annex E Incompatibilities with ISO/IEC 9075:1989...............677
  349. Annex F Maintenance and interpretation of SQL..................685
  350. Index
  351. Table of Contents ix
  352. TABLES
  353. Table Page
  354. 1 Collating coercibility rules for monadic operators .........24
  355. 2 Collating coercibility rules for dyadic operators ..........24
  356. 3 Collating sequence usage for comparisons ...................25
  357. 4 Fields in datetime items ...................................30
  358. 5 Fields in year-month INTERVAL items ........................32
  359. 6 Fields in day-time INTERVAL items ..........................32
  360. 7 Valid values for fields in INTERVAL items ..................33
  361. 8 Valid operators involving datetimes and intervals ..........34
  362. 9 SQL-transaction isolation levels and the three phenomena ...69
  363. 10 Valid values for fields in datetime items ..................112
  364. 11 Valid values for fields in INTERVAL items ..................113
  365. 12 <null predicate> semantics .................................218
  366. 13 Truth table for the AND boolean ............................230
  367. 14 Truth table for the OR boolean .............................230
  368. 15 Truth table for the IS boolean .............................230
  369. 16 Standard programming languages .............................243
  370. 17 Data types of <key word>s used in SQL item descriptor areas
  371. ............................................................427
  372. 18 Codes used for SQL data types in Dynamic SQL ...............429
  373. 19 Codes associated with datetime data types in Dynamic SQL ...429
  374. 20 Codes used for <interval qualifier>s in Dynamic SQL ........430
  375. 21 <identifier>s for use with <get diagnostics statement> .....481
  376. 22 SQL-statement character codes for use in the diagnostics
  377. area........................................................482
  378. 23 SQLSTATE class and subclass values .........................619
  379. 24 SQLCODE values .............................................624
  380. x Database Language SQL
  381. X3H2-92-154/DBL CBR-002
  382. Foreword
  383. ISO (the International Organization for Standardization) is a
  384. worldwide federation of national standards bodies (ISO member
  385. bodies). The work of preparing International Standards is nor-
  386. mally carried out through ISO technical committees. Each member
  387. body interested in a subject for which a technical committee has
  388. been established has the right to be represented on that committee.
  389. International organizations, governmental and non-governmental,
  390. in liaison with ISO, also take part in the work. ISO collaborates
  391. closely with the International Electrotechnical Commission (IEC) on
  392. all matters of electrotechnical standardization.
  393. Draft International Standards adopted by the technical committees
  394. are circulated to the member bodies for approval before their ac-
  395. ceptance as International Standards by the ISO Council. They are
  396. approved in accordance with ISO procedures requiring at least 75%
  397. approval by the member bodies voting.
  398. International Standard ISO/IEC 9075:1992 was prepared by Joint
  399. Technical Committee ISO/IEC JTC1, Information Processing Systems.
  400. It cancels and replaces International Standard ISO/IEC 9075:1989,
  401. Database Language-SQL, of which it constitutes a technical revi-
  402. sion.
  403. This International Standard contains seven informative annexes:
  404. - Annex A (informative): Leveling the SQL Language;
  405. - Annex B (informative): Implementation-defined elements;
  406. - Annex C (informative): Implementation-dependent elements;
  407. - Annex D (informative): Deprecated features;
  408. - Annex E (informative): Incompatibilities with ISO/IEC 9075:1989;
  409. and
  410. - Annex F (informative): Maintenance and interpretation of SQL.
  411. Foreword xi
  412. X3H2-92-154/DBL CBR-002
  413. Introduction
  414. This International Standard was approved in 1992.
  415. This International Standard was developed from ISO/IEC 9075:1989,
  416. Information Systems, Database Language SQL with Integrity
  417. Enhancements, and replaces that International Standard. It adds
  418. significant new features and capabilities to the specifications.
  419. It is generally compatible with ISO/IEC 9075:1989, in the sense
  420. that, with very few exceptions, SQL language that conforms to
  421. ISO/IEC 9075:1989 also conforms to this International Standard,
  422. and will be treated in the same way by an implementation of this
  423. International Standard as it would by an implementation of ISO/IEC
  424. 9075:1989. The known incompatibilities between ISO/IEC 9075:1989
  425. and this International Standard are stated in informative Annex E,
  426. "Incompatibilities with ISO/IEC 9075:1989".
  427. Technical changes between ISO/IEC 9075:1989 and this International
  428. Standard include both improvements or enhancements to existing fea-
  429. tures and the definition of new features. Significant improvements
  430. in existing features include:
  431. - A better definition of direct invocation of SQL language;
  432. - Improved diagnostic capabilities, especially a new status param-
  433. eter (SQLSTATE), a diagnostics area, and supporting statements.
  434. Significant new features are:
  435. 1) Support for additional data types (DATE, TIME, TIMESTAMP,
  436. INTERVAL, BIT string, variable-length character and bit strings,
  437. and NATIONAL CHARACTER strings),
  438. 2) Support for character sets beyond that required to express SQL
  439. language itself and support for additional collations,
  440. 3) Support for additional scalar operations, such as string opera-
  441. tions for concatenate and substring, date and time operations,
  442. and a form for conditional expressions,
  443. 4) Increased generality and orthogonality in the use of scalar-
  444. valued and table-valued query expressions,
  445. 5) Additional set operators (for example, union join, natural join,
  446. set difference, and set intersection),
  447. 6) Capability for domain definitions in the schema,
  448. 7) Support for Schema Manipulation capabilities (especially DROP
  449. and ALTER statements),
  450. Introduction xiii
  451. X3H2-92-154/DBL CBR-002
  452. 8) Support for bindings (modules and embedded syntax) in the Ada,
  453. C, and MUMPS languages,
  454. 9) Additional privilege capabilities,
  455. 10)Additional referential integrity facilities, including ref-
  456. erential actions, subqueries in CHECK constraints, separate
  457. assertions, and user-controlled deferral of constraints,
  458. 11)Definition of an Information Schema,
  459. 12)Support for dynamic execution of SQL language,
  460. 13)Support for certain facilities required for Remote Database
  461. Access (especially connection management statements and quali-
  462. fied schema names),
  463. 14)Support for temporary tables,
  464. 15)Support for transaction consistency levels,
  465. 16)Support for data type conversions (CAST expressions among data
  466. types),
  467. 17)Support for scrolled cursors, and
  468. 18)A requirement for a flagging capability to aid in portability of
  469. application programs.
  470. The organization of this International Standard is as follows:
  471. 1) Clause 1, "Scope", specifies the scope of this International
  472. Standard.
  473. 2) Clause 2, "Normative references", identifies additional stan-
  474. dards that, through reference in this International Standard,
  475. constitute provisions of this International Standard.
  476. 3) Clause 3, "Definitions, notations, and conventions", defines the
  477. notations and conventions used in this International Standard.
  478. 4) Clause 4, "Concepts", presents concepts used in the definition
  479. of SQL.
  480. 5) Clause 5, "Lexical elements", defines the lexical elements of
  481. the language.
  482. 6) Clause 6, "Scalar expressions", defines the elements of the
  483. language that produce scalar values.
  484. 7) Clause 7, "Query expressions", defines the elements of the lan-
  485. guage that produce rows and tables of data.
  486. 8) Clause 8, "Predicates", defines the predicates of the language.
  487. xiv Database Language SQL
  488. X3H2-92-154/DBL CBR-002
  489. 9) Clause 9, "Data assignment rules", specifies the rules for
  490. assignments that retrieve data from or store data into the
  491. database, and formation rules for set operations.
  492. 10)Clause 10, "Additional common elements", defines additional lan-
  493. guage elements that are used in various parts of the language.
  494. 11)Clause 11, "Schema definition and manipulation", defines facili-
  495. ties for creating and managing a schema.
  496. 12)Clause 12, "Module", defines modules and procedures.
  497. 13)Clause 13, "Data manipulation", defines the data manipulation
  498. statements.
  499. 14)Clause 14, "Transaction management", defines the SQL-transaction
  500. management statements.
  501. 15)Clause 15, "Connection management" defines the SQL-connection
  502. management statements.
  503. 16)Clause 16, "Session management", defines the SQL-session manage-
  504. ment statements.
  505. 17)Clause 17, "Dynamic SQL", defines the facilities for executing
  506. SQL-statements dynamically.
  507. 18)Clause 18, "Diagnostics management", defines the diagnostics
  508. management facilities.
  509. 19)Clause 19, "Embedded SQL", defines syntax for embedding SQL in
  510. certain standard programming languages.
  511. 20)Clause 20, "Direct invocation of SQL", defines the direct invo-
  512. cation of SQL language.
  513. 21)Clause 21, "Information Schema and Definition Schema", defines
  514. viewed tables that contain schema information.
  515. 22)Clause 22, "Status codes", defines values that identify the
  516. status of the execution of SQL-statements and the mechanisms by
  517. which those values are returned.
  518. 23)Clause 23, "Conformance", defines the criteria for conformance
  519. to this International standard.
  520. 24)Annex A, "Leveling the SQL Language", is an informative
  521. Annex. It lists the leveling rules defining the Entry SQL and
  522. Intermediate SQL subset levels of the SQL language.
  523. 25)Annex B, "Implementation-defined elements", is an informa-
  524. tive Annex. It lists those features for which the body of the
  525. International Standard states that the syntax or meaning or ef-
  526. fect on the database is partly or wholly implementation-defined,
  527. and describes the defining information that an implementor shall
  528. provide in each case.
  529. Introduction xv
  530. X3H2-92-154/DBL CBR-002
  531. 26)Annex C, "Implementation-dependent elements", is an informa-
  532. tive Annex. It lists those features for which the body of the
  533. International Standard states explicitly that the meaning or
  534. effect on the database is implementation-dependent.
  535. 27)Annex D, "Deprecated features", is an informative Annex. It
  536. lists features that the responsible Technical Committee in-
  537. tends will not appear in a future revised version of this
  538. International Standard.
  539. 28)Annex E, "Incompatibilities with ISO/IEC 9075:1989", is an in-
  540. formative Annex. It lists the incompatibilities between this
  541. version of this International Standard and ISO/IEC 9075:1989.
  542. 29)Annex F, "Maintenance and interpretation of SQL", is an infor-
  543. mative Annex. It identifies SQL interpretations and corrections
  544. that have been processed by ISO/IEC JTC1/SC21 since adoption of
  545. ISO/IEC 9075:1989.
  546. In the text of this International Standard, Clauses begin a new
  547. odd-numbered page, and in Clause 5, "Lexical elements", through
  548. Clause 22, "Status codes", Subclauses begin a new page. Any result-
  549. ing blank space is not significant.
  550. xvi Database Language SQL
  551. X3H2-92-154/DBL CBR-002
  552. Information Technology - Database Language SQL
  553. 1 Scope
  554. This International Standard defines the data structures and basic
  555. operations on SQL-data. It provides functional capabilities for
  556. creating, accessing, maintaining, controlling, and protecting SQL-
  557. data.
  558. Note: The framework for this International Standard is described by
  559. the Reference Model of Data Management (ISO/IEC DIS 10032:1991).
  560. This International Standard specifies the syntax and semantics of a
  561. database language
  562. - for specifying and modifying the structure and the integrity
  563. constraints of SQL-data,
  564. - for declaring and invoking operations on SQL-data and cursors,
  565. and
  566. - for declaring database language procedures and embedding them
  567. into a standard programming language.
  568. It also specifies an Information Schema that describes the struc-
  569. ture and the integrity constraints of SQL-data.
  570. This International Standard
  571. - provides a vehicle for portability of data definitions and com-
  572. pilation units between SQL-implementations,
  573. - provides a vehicle for interconnection of SQL-implementations,
  574. - specifies syntax for embedding SQL-statements in a compilation
  575. unit that otherwise conforms to the standard for a particular
  576. programming language. It defines how an equivalent compilation
  577. unit may be derived that conforms to the particular programming
  578. language standard. In that equivalent compilation unit, each
  579. embedded SQL-statement has been replaced by statements that
  580. invoke a database language procedure that contains the SQL-
  581. statement, and
  582. - specifies syntax for direct invocation of SQL-statements.
  583. Scope 1
  584. X3H2-92-154/DBL CBR-002
  585. This International Standard does not define the method or time of
  586. binding between any of:
  587. - database management system components,
  588. - SQL data definition declarations,
  589. - SQL procedures, or
  590. - compilation units, including those containing embedded SQL.
  591. Implementations of this International Standard may exist in en-
  592. vironments that also support application programming languages,
  593. end-user query languages, report generator systems, data dictionary
  594. systems, program library systems, and distributed communication
  595. systems, as well as various tools for database design, data admin-
  596. istration, and performance optimization.
  597. 2 Database Language SQL
  598. X3H2-92-154/DBL CBR-002
  599. 2 Normative references
  600. The following standards contain provisions that, through reference
  601. in this text, constitute provisions of this International Standard.
  602. At the time of publication, the editions indicated were valid.
  603. All standards are subject to revision, and parties to agreements
  604. based on this International Standard are encouraged to investigate
  605. the possibility of applying the most recent editions of the stan-
  606. dards listed below. Members of IEC and ISO maintain registers of
  607. currently valid International Standards.
  608. - ISO/IEC 646:1991, Information technology-ISO 7-bit coded charac-
  609. ter set for information interchange.
  610. - ISO/IEC 1539:1991, Information technology-Programming languages-
  611. Fortran.
  612. - ISO 1989:1985, Programming languages-COBOL.
  613. (Endorsement of ANSI X3.23-1985).
  614. - ISO 2022:1986, Information technology-ISO 7-bit and 8-bit coded
  615. character sets-code extension techniques.
  616. - ISO 6160:1979, Programming languages-PL/I
  617. (Endorsement of ANSI X3.53-1976).
  618. - ISO 7185:1990, Information technology-Programming languages-
  619. Pascal.
  620. - ISO 8601:1988, Data elements and interchange formats - Information
  621. interchange-Representation of dates and times.
  622. - ISO 8652:1987, Programming languages-Ada.
  623. (Endorsement of ANSI/MIL-STD-1815A-1983).
  624. - ISO/IEC 8824:1990, Information technology-Open Systems Interconnection-
  625. Specification of Abstract Syntax Notation One (ASN.1).
  626. - ISO/IEC 9579-2:[1], Information technology - Open Systems
  627. Interconnection - Remote Database Access, Part 2: SQL special-
  628. ization.
  629. - ISO/IEC 9899:1990, Programming languages - C.
  630. - ISO/IEC 10206:1991, Information technology-Programming languages-
  631. Extended Pascal.
  632. - ISO/IEC 10646:[1], Information technology-Multiple-octet coded
  633. character set.
  634. ____________________
  635. [1] To be published
  636. Normative references 3
  637. X3H2-92-154/DBL CBR-002
  638. - ISO/IEC 11756:[1], Information technology-Programming languages-
  639. MUMPS.
  640. 4 Database Language SQL
  641. X3H2-92-154/DBL CBR-002
  642. 3 Definitions, notations, and conventions
  643. 3.1 Definitions
  644. For the purposes of this International Standard, the following
  645. definitions apply.
  646. 3.1.1 Definitions taken from ISO/IEC 10646
  647. This International Standard makes use of the following terms de-
  648. fined in ISO/IEC 10646:
  649. a) character
  650. b) octet
  651. c) variable-length coding
  652. d) fixed-length coding
  653. 3.1.2 Definitions taken from ISO 8601
  654. This International Standard makes use of the following terms de-
  655. fined in ISO 8601:
  656. a) Coordinated Universal Time (UTC)
  657. b) date ("date, calendar" in ISO 8601)
  658. 3.1.3 Definitions provided in this International Standard
  659. This International Standard defines the following terms:
  660. a) assignable: The characteristic of a value or of a data type
  661. that permits that value or the values of that data type to be
  662. assigned to data instances of a specified data type.
  663. b) cardinality (of a collection): The number of objects in that
  664. collection. Those objects need not necessarily have distinct
  665. values.
  666. c) character repertoire; repertoire: A set of characters used for a
  667. specific purpose or application. Each character repertoire has
  668. an implied default collating sequence.
  669. d) coercibility: An attribute of character string data items that
  670. governs how a collating sequence for the items is determined.
  671. Definitions, notations, and conventions 5
  672. X3H2-92-154/DBL CBR-002
  673. 3.1 Definitions
  674. e) collation; collating sequence: A method of ordering two com-
  675. parable character strings. Every character set has a default
  676. collation.
  677. f) comparable: The characteristic of two data objects that per-
  678. mits the value of one object to be compared with the value of
  679. the other object. Also said of data types: Two data types are
  680. comparable if objects of those data types are comparable.
  681. g) descriptor: A coded description of an SQL object. It includes
  682. all of the information about the object that a conforming SQL-
  683. implementation requires.
  684. h) distinct: Two values are said to be not distinct if either:
  685. both are the null value, or they compare equal according to
  686. Subclause 8.2, "<comparison predicate>". Otherwise they are
  687. distinct. Two rows (or partial rows) are distinct if at least
  688. one of their pairs of respective values is distinct. Otherwise
  689. they are not distinct. The result of evaluating whether or not
  690. two values or two rows are distinct is never unknown.
  691. i) duplicate: Two or more values or rows are said to be duplicates
  692. (of each other) if and only if they are not distinct.
  693. j) dyadic operator: An operator having two operands: a left operand
  694. and a right operand. An example of a dyadic arithmetic operator
  695. in this International Standard is "-", specifying the subtrac-
  696. tion of the right operand from the left operand.
  697. k) form-of-use: A convention (or encoding) for representing charac-
  698. ters (in character strings). Some forms-of-use are fixed-length
  699. codings and others are variable-length codings.
  700. l) form-of-use conversion: A method of converting character strings
  701. from one form-of-use to another form-of-use.
  702. m) implementation-defined: Possibly differing between SQL-
  703. implementations, but specified by the implementor for each
  704. particular SQL-implementation.
  705. n) implementation-dependent: Possibly differing between SQL-
  706. implementations, but not specified by this International
  707. Standard and not required to be specified by the implementor
  708. for any particular SQL-implementations.
  709. o) monadic operator: An operator having one operand. An example of
  710. a monadic arithmetic operator in this International Standard is
  711. "-", specifying the negation of the operand.
  712. p) multiset: An unordered collection of objects that are not neces-
  713. sarily distinct. The collection may be empty.
  714. q) n-adic operator: An operator having a variable number of
  715. operands (informally: n operands). An example of an n-adic
  716. operator in this International Standard is COALESCE.
  717. 6 Database Language SQL
  718. X3H2-92-154/DBL CBR-002
  719. 3.1 Definitions
  720. r) null value (null): A special value, or mark, that is used to
  721. indicate the absence of any data value.
  722. s) persistent: Continuing to exist indefinitely, until destroyed
  723. deliberately. Referential and cascaded actions are regarded
  724. as deliberate. Actions incidental to the ending of an SQL-
  725. transaction (see Subclause 4.28, "SQL-transactions") or an SQL-
  726. session (see Subclause 4.30, "SQL-sessions") are not regarded as
  727. deliberate.
  728. t) redundant duplicates: All except one of any multiset of dupli-
  729. cate values or rows.
  730. u) repertoire: See character repertoire.
  731. v) sequence: An ordered collection of objects that are not neces-
  732. sarily distinct.
  733. w) set: An unordered collection of distinct objects. The collection
  734. may be empty.
  735. x) SQL-implementation: A database management system that conforms
  736. to this International Standard.
  737. y) translation: A method of translating characters in one character
  738. repertoire into characters of the same or a different character
  739. repertoire.
  740. 3.2 Notation
  741. The syntactic notation used in this International Standard is
  742. an extended version of BNF ("Backus Naur Form" or "Backus Normal
  743. Form").
  744. In BNF, each syntactic element of the language is defined by means
  745. of a production rule. This defines the element in terms of a for-
  746. mula consisting of the characters, character strings, and syntactic
  747. elements that can be used to form an instance of it.
  748. The version of BNF used in this International Standard makes use of
  749. the following symbols:
  750. SymbolMeaning
  751. < > Angle brackets delimit character strings that are the names
  752. of syntactic elements, the non-terminal symbols of the SQL
  753. language.
  754. ::= The definition operator. This is used in a production rule to
  755. separate the element defined by the rule from its definition.
  756. The element being defined appears to the left of the opera-
  757. tor and the formula that defines the element appears to the
  758. right.
  759. Definitions, notations, and conventions 7
  760. X3H2-92-154/DBL CBR-002
  761. 3.2 Notation
  762. [ ] Square brackets indicate optional elements in a formula. The
  763. portion of the formula within the brackets may be explicitly
  764. specified or may be omitted.
  765. { } Braces group elements in a formula. The portion of the for-
  766. mula within the braces shall be explicitly specified.
  767. | The alternative operator. The vertical bar indicates that
  768. the portion of the formula following the bar is an alterna-
  769. tive to the portion preceding the bar. If the vertical bar
  770. appears at a position where it is not enclosed in braces
  771. or square brackets, it specifies a complete alternative for
  772. the element defined by the production rule. If the vertical
  773. bar appears in a portion of a formula enclosed in braces or
  774. square brackets, it specifies alternatives for the contents
  775. of the innermost pair of such braces or brackets.
  776. . . . The ellipsis indicates that the element to which it applies
  777. in a formula may be repeated any number of times. If the el-
  778. lipsis appears immediately after a closing brace "}", then it
  779. applies to the portion of the formula enclosed between that
  780. closing brace and the corresponding opening brace "{". If
  781. an ellipsis appears after any other element, then it applies
  782. only to that element.
  783. !! Introduces ordinary English text. This is used when the defi-
  784. nition of a syntactic element is not expressed in BNF.
  785. Spaces are used to separate syntactic elements. Multiple spaces and
  786. line breaks are treated as a single space. Apart from those symbols
  787. to which special functions were given above, other characters and
  788. character strings in a formula stand for themselves. In addition,
  789. if the symbols to the right of the definition operator in a produc-
  790. tion consist entirely of BNF symbols, then those symbols stand for
  791. themselves and do not take on their special meaning.
  792. Pairs of braces and square brackets may be nested to any depth,
  793. and the alternative operator may appear at any depth within such a
  794. nest.
  795. A character string that forms an instance of any syntactic element
  796. may be generated from the BNF definition of that syntactic element
  797. by application of the following steps:
  798. 1) Select any one option from those defined in the right hand side
  799. of a production rule for the element, and replace the element
  800. with this option.
  801. 2) Replace each ellipsis and the object to which it applies with
  802. one or more instances of that object.
  803. 3) For every portion of the string enclosed in square brackets,
  804. either delete the brackets and their contents or change the
  805. brackets to braces.
  806. 8 Database Language SQL
  807. X3H2-92-154/DBL CBR-002
  808. 3.2 Notation
  809. 4) For every portion of the string enclosed in braces, apply steps
  810. 1 through 5 to the substring between the braces, then remove the
  811. braces.
  812. 5) Apply steps 1 through 5 to any non-terminal syntactic element
  813. (i.e., name enclosed in angle brackets) that remains in the
  814. string.
  815. The expansion or production is complete when no further non-
  816. terminal symbols remain in the character string.
  817. 3.3 Conventions
  818. 3.3.1 Informative elements
  819. In several places in the body of this International Standard, in-
  820. formative notes appear. For example:
  821. Note: This is an example of a note.
  822. Those notes do not belong to the normative part of this International
  823. Standard and conformance to material specified in those notes shall
  824. not be claimed.
  825. 3.3.2 Specification of syntactic elements
  826. Syntactic elements are specified in terms of:
  827. - Function: A short statement of the purpose of the element.
  828. - Format: A BNF definition of the syntax of the element.
  829. - Syntax Rules: A specification of the syntactic properties of the
  830. element, or of additional syntactic constraints, not expressed
  831. in BNF, that the element shall satisfy, or both.
  832. - Access Rules: A specification of rules governing the accessibil-
  833. ity of schema objects that shall hold before the General Rules
  834. may be successfully applied.
  835. - General Rules: A specification of the run-time effect of the
  836. element. Where more than one General Rule is used to specify the
  837. effect of an element, the required effect is that which would be
  838. obtained by beginning with the first General Rule and applying
  839. the Rules in numerical sequence unless a Rule is applied that
  840. specifies or implies a change in sequence or termination of the
  841. application of the Rules. Unless otherwise specified or implied
  842. by a specific Rule that is applied, application of General Rules
  843. terminates when the last in the sequence has been applied.
  844. - Leveling Rules: A specification of how the element shall be
  845. supported for each of the levels of SQL.
  846. Definitions, notations, and conventions 9
  847. X3H2-92-154/DBL CBR-002
  848. 3.3 Conventions
  849. The scope of notational symbols is the Subclause in which those
  850. symbols are defined. Within a Subclause, the symbols defined in
  851. Syntax Rules, Access Rules, or General Rules can be referenced in
  852. other rules provided that they are defined before being referenced.
  853. 3.3.3 Specification of the Information Schema
  854. The objects of the Information Schema in this International
  855. Standard are specified in terms of:
  856. - Function: A short statement of the purpose of the definition.
  857. - Definition: A definition, in SQL, of the object being defined.
  858. - Description: A specification of the run-time value of the ob-
  859. ject, to the extent that this is not clear from the definition.
  860. The definitions used to define the views in the Information Schema
  861. are used only to specify clearly the contents of those viewed
  862. tables. The actual objects on which these views are based are
  863. implementation-dependent.
  864. 3.3.4 Use of terms
  865. 3.3.4.1 Exceptions
  866. The phrase "an exception condition is raised:", followed by the
  867. name of a condition, is used in General Rules and elsewhere to
  868. indicate that the execution of a statement is unsuccessful, ap-
  869. plication of General Rules, other than those of Subclause 12.3,
  870. "<procedure>", and Subclause 20.1, "<direct SQL statement>", may
  871. be terminated, diagnostic information is to be made available,
  872. and execution of the statement is to have no effect on SQL-data or
  873. schemas. The effect on <target specification>s and SQL descriptor
  874. areas of an SQL-statement that terminates with an exception condi-
  875. tion, unless explicitly defined by this International Standard, is
  876. implementation-dependent.
  877. The phrase "a completion condition is raised:", followed by the
  878. name of a condition, is used in General Rules and elsewhere to
  879. indicate that application of General Rules is not terminated and
  880. diagnostic information is to be made available; unless an excep-
  881. tion condition is also raised, the execution of the statement is
  882. successful.
  883. If more than one condition could have occurred as a result of a
  884. statement, it is implementation-dependent whether diagnostic infor-
  885. mation pertaining to more than one condition is made available.
  886. 10 Database Language SQL
  887. X3H2-92-154/DBL CBR-002
  888. 3.3 Conventions
  889. 3.3.4.2 Syntactic containment
  890. In a Format, a syntactic element <A> is said to immediately contain
  891. a syntactic element <B> if <B> appears on the right-hand side of
  892. the BNF production rule for <A>. A syntactic element <A> is said
  893. to contain or specify a syntactic element <C> if <A> immediately
  894. contains <C> or if <A> immediately contains a syntactic element <B>
  895. that contains <C>.
  896. In SQL language, an instance A1 of <A> is said to immediately con-
  897. tain an instance B1 of <B> if <A> immediately contains <B> and the
  898. text of B1 is part of the text of A1. An instance A1 of <A> is said
  899. to contain or specify an instance C1 of <C> if A1 immediately con-
  900. tains C1 or if A1 immediately contains an instance B1 of <B> that
  901. contains C1.
  902. An instance A1 of <A> is said to contain an instance B1 of <B> with
  903. an intervening <C> if A1 contains B1 and A1 contains an instance C1
  904. of <C> that contains B1. An instance A1 of <A> is said to contain
  905. an instance B1 of <B> without an intervening <C> if A1 contains B1
  906. and A1 does not contain an instance C1 of <C> that contains B1.
  907. An instance A1 of <A> simply contains an instance B1 of <B> if
  908. A1 contains B1 without an intervening instance A2 of <A> or an
  909. intervening instance B2 of <B>.
  910. If <A> contains <B>, then <B> is said to be contained in <A> and
  911. <A> is said to be a containing production symbol for <B>. If <A>
  912. simply contains <B>, then <B> is said to be simply contained in
  913. <A> and <A> is said to be a simply containing production symbol for
  914. <B>.
  915. Let A1 be an instance of <A> and let B1 be an instance of <B>. If
  916. <A> contains <B>, then A1 is said to contain B1 and B1 is said to
  917. be contained in A1. If <A> simply contains <B>, then A1 is said to
  918. simply contain B1 and B1 is said to be simply contained in A1.
  919. An instance A1 of <A> is the innermost <A> satisfying a condition
  920. C if A1 satisfies C and A1 does not contain an instance A2 of <A>
  921. that satisfies C. An instance A1 of <A> is the outermost <A> satis-
  922. fying a condition C if A1 satisfies C and A1 is not contained in an
  923. instance A2 of <A> that satisfies C.
  924. If <A> contains a <table name> that identifies a view that is
  925. defined by a <view definition> V, then <A> is said to generally
  926. contain the <query expression> contained in V. If <A> contains <B>,
  927. then <A> generally contains <B>. If <A> generally contains <B> and
  928. <B> generally contains <C>, then <A> generally contains <C>.
  929. An instance A1 of <A> directly contains an instance B1 of <B> if A1
  930. contains B1 without an intervening <set function specification> or
  931. <subquery>.
  932. Definitions, notations, and conventions 11
  933. X3H2-92-154/DBL CBR-002
  934. 3.3 Conventions
  935. 3.3.4.3 Terms denoting rule requirements
  936. In the Syntax Rules, the term shall defines conditions that are
  937. required to be true of syntactically conforming SQL language. When
  938. such conditions depend on the contents of the schema, then they
  939. are required to be true just before the actions specified by the
  940. General Rules are performed. The treatment of language that does
  941. not conform to the SQL Formats and Syntax Rules is implementation-
  942. dependent. If any condition required by Syntax Rules is not sat-
  943. isfied when the evaluation of Access or General Rules is attempted
  944. and the implementation is neither processing non-conforming SQL
  945. language nor processing conforming SQL language in a non-conforming
  946. manner, then an exception condition is raised: syntax error or
  947. access rule violation (if this situation occurs during dynamic ex-
  948. ecution of an SQL-statement, then the exception that is raised is
  949. syntax error or access rule violation in dynamic SQL statement; if
  950. the situation occurs during direct invocation of an SQL-statement,
  951. then the exception that is raised is syntax error or access rule
  952. violation in direct SQL statement).
  953. In the Access Rules, the term shall defines conditions that are
  954. required to be satisfied for the successful application of the
  955. General Rules. If any such condition is not satisfied when the
  956. General Rules are applied, then an exception condition is raised:
  957. syntax error or access rule violation (if this situation occurs
  958. during dynamic execution of an SQL-statement, then the exception
  959. that is raised is syntax error or access rule violation in dynamic
  960. SQL statement; if the situation occurs during direct invocation of
  961. an SQL-statement, then the exception that is raised is syntax error
  962. or access rule violation in direct SQL statement).
  963. In the Leveling Rules, the term shall defines conditions that are
  964. required to be true of SQL language for it to syntactically conform
  965. to the specified level of conformance.
  966. 3.3.4.4 Rule evaluation order
  967. A conforming implementation is not required to perform the exact
  968. sequence of actions defined in the General Rules, but shall achieve
  969. the same effect on SQL-data and schemas as that sequence. The term
  970. effectively is used to emphasize actions whose effect might be
  971. achieved in other ways by an implementation.
  972. The Syntax Rules and Access Rules for contained syntactic elements
  973. are effectively applied at the same time as the Syntax Rules and
  974. Access Rules for the containing syntactic elements. The General
  975. Rules for contained syntactic elements are effectively applied be-
  976. fore the General Rules for the containing syntactic elements. Where
  977. the precedence of operators is determined by the Formats of this
  978. International Standard or by parentheses, those operators are ef-
  979. fectively applied in the order specified by that precedence. Where
  980. the precedence is not determined by the Formats or by parentheses,
  981. effective evaluation of expressions is generally performed from
  982. 12 Database Language SQL
  983. X3H2-92-154/DBL CBR-002
  984. 3.3 Conventions
  985. left to right. However, it is implementation-dependent whether ex-
  986. pressions are actually evaluated left to right, particularly when
  987. operands or operators might cause conditions to be raised or if
  988. the results of the expressions can be determined without completely
  989. evaluating all parts of the expression. In general, if some syn-
  990. tactic element contains more than one other syntactic element, then
  991. the General Rules for contained elements that appear earlier in the
  992. production for the containing syntactic element are applied before
  993. the General Rules for contained elements that appear later.
  994. For example, in the production:
  995. <A> ::= <B> <C>
  996. the Syntax Rules and Access Rules for <A>, <B>, and <C> are ef-
  997. fectively applied simultaneously. The General Rules for <B> are
  998. applied before the General Rules for <C>, and the General Rules for
  999. <A> are applied after the General Rules for both <B> and <C>.
  1000. If the result of an expression or search condition can be deter-
  1001. mined without completely evaluating all parts of the expression or
  1002. search condition, then the parts of the expression or search condi-
  1003. tion whose evaluation is not necessary are called the inessential
  1004. parts. If the Access Rules pertaining to inessential parts are not
  1005. satisfied, then the syntax error or access rule violation exception
  1006. condition is raised regardless of whether or not the inessential
  1007. parts are actually evaluated. If evaluation of the inessential
  1008. parts would cause an exception condition to be raised, then it is
  1009. implementation-dependent whether or not that exception condition is
  1010. raised.
  1011. 3.3.4.5 Conditional rules
  1012. Conditional rules are specified with "If" or "Case" conventions.
  1013. Rules specified with "Case" conventions include a list of con-
  1014. ditional sub-rules using "If" conventions. The first such "If"
  1015. sub-rule whose condition is true is the effective sub-rule of
  1016. the "Case" rule. The last sub-rule of a "Case" rule may specify
  1017. "Otherwise". Such a sub-rule is the effective sub-rule of the
  1018. "Case" rule if no preceding "If" sub-rule in the "Case" rule has
  1019. a true condition.
  1020. 3.3.4.6 Syntactic substitution
  1021. In the Syntax and General Rules, the phrase "X is implicit" indi-
  1022. cates that the Syntax and General Rules are to be interpreted as if
  1023. the element X had actually been specified.
  1024. In the Syntax and General Rules, the phrase "the following <X> is
  1025. implicit: Y" indicates that the Syntax and General Rules are to be
  1026. interpreted as if a syntactic element <X> containing Y had actually
  1027. been specified.
  1028. Definitions, notations, and conventions 13
  1029. X3H2-92-154/DBL CBR-002
  1030. 3.3 Conventions
  1031. In the Syntax Rules and General Rules, the phrase "former is equiv-
  1032. alent to latter" indicates that the Syntax Rules and General Rules
  1033. are to be interpreted as if all instances of former in the element
  1034. had been instances of latter.
  1035. If a BNF nonterminal is referenced in a Subclause without speci-
  1036. fying how it is contained in a BNF production that the Subclause
  1037. defines, then
  1038. Case:
  1039. - If the BNF nonterminal is itself defined in the Subclause, then
  1040. the reference shall be assumed to be the occurrence of that BNF
  1041. nonterminal on the left side of the defining production.
  1042. - Otherwise, the reference shall be assumed to be to a BNF pro-
  1043. duction in which the particular BNF nonterminal is immediately
  1044. contained.
  1045. 3.3.4.7 Other terms
  1046. Some Syntax Rules define terms, such as T1, to denote named or
  1047. unnamed tables. Such terms are used as table names or correlation
  1048. names. Where such a term is used as a correlation name, it does
  1049. not imply that any new correlation name is actually defined for
  1050. the denoted table, nor does it affect the scopes of any actual
  1051. correlation names.
  1052. An SQL-statement S1 is said to be executed as a direct result of
  1053. executing an SQL-statement if S1 is the SQL-statement contained
  1054. in a <procedure> that has been executed, or if S1 is the value of
  1055. an <SQL statement variable> referenced by an <execute immediate
  1056. statement> contained in a <procedure> that has been executed, or if
  1057. S1 was the value of the <SQL statement variable> that was associ-
  1058. ated with an <SQL statement name> by a <prepare statement> and that
  1059. same <SQL statement name> is referenced by an <execute statement>
  1060. contained in a <procedure> that has been executed.
  1061. 3.3.5 Descriptors
  1062. A descriptor is a conceptual structured collection of data that
  1063. defines the attributes of an instance of an object of a specified
  1064. type. The concept of descriptor is used in specifying the seman-
  1065. tics of SQL. It is not necessary that any descriptor exist in any
  1066. particular form in any database or environment.
  1067. Some SQL objects cannot exist except in the context of other SQL
  1068. objects. For example, columns cannot exist except in tables. Those
  1069. objects are independently described by descriptors, and the de-
  1070. scriptors of enabling objects (e.g., tables) are said to include
  1071. the descriptors of enabled objects (e.g., columns or table con-
  1072. straints). Conversely, the descriptor of an enabled object is said
  1073. to be included in the descriptor of an enabling object.
  1074. 14 Database Language SQL
  1075. X3H2-92-154/DBL CBR-002
  1076. 3.3 Conventions
  1077. In other cases, certain SQL objects cannot exist unless some other
  1078. SQL object exists, even though there is not an inclusion relation-
  1079. ship. For example, SQL does not permit an assertion to exist if the
  1080. tables referenced by the assertion do not exist. Therefore, an as-
  1081. sertion descriptor is dependent on or depends on zero or more table
  1082. descriptors (equivalently, an assertion is dependent on or depends
  1083. on zero or more tables). In general, a descriptor D1 can be said to
  1084. depend on, or be dependent on, some descriptor D2.
  1085. There are two ways of indicating dependency of one construct on
  1086. another. In many cases, the descriptor of the dependent construct
  1087. is said to "include the name of" the construct on which it is de-
  1088. pendent. In this case "the name of" is to be understood as meaning
  1089. "sufficient information to identify the descriptor of"; thus an
  1090. implementor might choose to use a pointer or a concatenation of
  1091. <catalog name>, <schema name>, etc. Alternatively, the descrip-
  1092. tor may be said to include text (e.g., <query expression>, <search
  1093. condition>). In such cases, whether the implementation includes ac-
  1094. tual text (with defaults and implications made explicit) or its own
  1095. style of parse tree is irrelevant; the validity of the descriptor
  1096. is clearly "dependent on" the existence of descriptors for objects
  1097. that are referred to in it.
  1098. The statement that a column "is based on" a domain, is equivalent
  1099. to a statement that a column "is dependent on" that domain.
  1100. An attempt to destroy a descriptor may fail if other descriptors
  1101. are dependent on it, depending on how the destruction is specified.
  1102. Such an attempt may also fail if the descriptor to be destroyed
  1103. is included in some other descriptor. Destruction of a descriptor
  1104. results in the destruction of all descriptors included in it, but
  1105. has no effect on descriptors on which it is dependent.
  1106. 3.3.6 Index typography
  1107. In the Index to this International Standard, the following conven-
  1108. tions are used:
  1109. - Index entries appearing in boldface indicate the page where the
  1110. word, phrase, or BNF nonterminal was defined;
  1111. - Index entries appearing in italics indicate a page where the BNF
  1112. nonterminal was used in a Format; and
  1113. - Index entries appearing in roman type indicate a page where
  1114. the word, phrase, or BNF nonterminal was used in a heading,
  1115. Function, Syntax Rule, Access Rule, General Rule, Leveling Rule,
  1116. Table, or other descriptive text.
  1117. Definitions, notations, and conventions 15
  1118. X3H2-92-154/DBL CBR-002
  1119. 3.4 Object identifier for Database Language SQL
  1120. 3.4 Object identifier for Database Language SQL
  1121. Function
  1122. The object identifier for Database Language SQL identifies the
  1123. characteristics of an SQL-implementation to other entities in an
  1124. open systems environment.
  1125. Format
  1126. <SQL object identifier> ::=
  1127. <SQL provenance> <SQL variant>
  1128. <SQL provenance> ::= <arc1> <arc2> <arc3>
  1129. <arc1> ::= iso | 1 | iso <left paren> 1 <right paren>
  1130. <arc2> ::= standard | 0 | standard <left paren> 0 <right paren>
  1131. <arc3> ::= 9075
  1132. <SQL variant> ::= <SQL edition> <SQL conformance>
  1133. <SQL edition> ::= <1987> | <1989> | <1992>
  1134. <1987> ::= 0 | edition1987 <left paren> 0 <right paren>
  1135. <1989> ::= <1989 base> <1989 package>
  1136. <1989 base> ::= 1 | edition1989 <left paren> 1 <right paren>
  1137. <1989 package> ::= <integrity no> | <integrity yes>
  1138. <integrity no> ::= 0 | IntegrityNo <left paren> 0 <right paren>
  1139. <integrity yes> ::= 1 | IntegrityYes <left paren> 1 <right paren>
  1140. <1992> ::= 2 | edition1992 <left paren> 2 <right paren>
  1141. <SQL conformance> ::= <low> | <intermediate> | <high>
  1142. <low> ::= 0 | Low <left paren> 0 <right paren>
  1143. <intermediate> ::= 1 | Intermediate <left paren> 1 <right paren>
  1144. <high> ::= 2 | High <left paren> 2 <right paren>
  1145. 16 Database Language SQL
  1146. X3H2-92-154/DBL CBR-002
  1147. 3.4 Object identifier for Database Language SQL
  1148. Syntax Rules
  1149. 1) An <SQL conformance> of <high> shall not be specified unless the
  1150. <SQL edition> is specified as <1992>.
  1151. 2) The value of <SQL conformance> identifies the level at which
  1152. conformance is claimed as follows:
  1153. a) If <SQL edition> specifies <1992>, then
  1154. Case:
  1155. i) <low>, then Entry SQL level.
  1156. ii) <intermediate>, then Intermediate SQL level.
  1157. iii) <high>, then Full SQL level.
  1158. b) Otherwise:
  1159. i) <low>, then level 1.
  1160. ii) <intermediate>, then level 2.
  1161. 3) A specification of <1989 package> as <integrity no> implies
  1162. that the integrity enhancement feature is not implemented. A
  1163. specification of <1989 package> as <integrity yes> implies that
  1164. the integrity enhancement feature is implemented.
  1165. Definitions, notations, and conventions 17
  1166. X3H2-92-154/DBL CBR-002
  1167. 18 Database Language SQL
  1168. X3H2-92-154/DBL CBR-002
  1169. 4 Concepts
  1170. 4.1 Data types
  1171. A data type is a set of representable values. The logical represen-
  1172. tation of a value is a <literal>. The physical representation of a
  1173. value is implementation-dependent.
  1174. A value is primitive in that it has no logical subdivision within
  1175. this International Standard. A value is a null value or a non-null
  1176. value.
  1177. A null value is an implementation-dependent special value that
  1178. is distinct from all non-null values of the associated data type.
  1179. There is effectively only one null value and that value is a member
  1180. of every SQL data type. There is no <literal> for a null value,
  1181. although the keyword NULL is used in some places to indicate that a
  1182. null value is desired.
  1183. SQL defines distinct data types named by the following <key word>s:
  1184. CHARACTER, CHARACTER VARYING, BIT, BIT VARYING, NUMERIC, DECIMAL,
  1185. INTEGER, SMALLINT, FLOAT, REAL, DOUBLE PRECISION, DATE, TIME,
  1186. TIMESTAMP, and INTERVAL.
  1187. Subclause 6.1, "<data type>", describes the semantic properties of
  1188. each data type.
  1189. For reference purposes, the data types CHARACTER and CHARACTER
  1190. VARYING are collectively referred to as character string types.
  1191. The data types BIT and BIT VARYING are collectively referred to
  1192. as bit string types. Character string types and bit string types
  1193. are collectively referred to as string types and values of string
  1194. types are referred to as strings. The data types NUMERIC, DECIMAL,
  1195. INTEGER, and SMALLINT are collectively referred to as exact numeric
  1196. types. The data types FLOAT, REAL, and DOUBLE PRECISION are col-
  1197. lectively referred to as approximate numeric types. Exact numeric
  1198. types and approximate numeric types are collectively referred to as
  1199. numeric types. Values of numeric type are referred to as numbers.
  1200. The data types DATE, TIME, and TIMESTAMP are collectively referred
  1201. to as datetime types. Values of datetime types are referred to as
  1202. datetimes. The data type INTERVAL is referred to as an interval
  1203. type. Values of interval types are called intervals.
  1204. Each data type has an associated data type descriptor. The contents
  1205. of a data type descriptor are determined by the specific data type
  1206. that it describes. A data type descriptor includes an identifica-
  1207. tion of the data type and all information needed to characterize an
  1208. instance of that data type.
  1209. Concepts 19
  1210. X3H2-92-154/DBL CBR-002
  1211. 4.1 Data types
  1212. Each host language has its own data types, which are separate and
  1213. distinct from SQL data types, even though similar names may be
  1214. used to describe the data types. Mappings of SQL data types to data
  1215. types in host languages are described in Subclause 12.3, "<pro-
  1216. cedure>", and Subclause 19.1, "<embedded SQL host program>". Not
  1217. every SQL data type has a corresponding data type in every host
  1218. language.
  1219. 4.2 Character strings
  1220. A character string data type is described by a character string
  1221. data type descriptor. A character string data type descriptor con-
  1222. tains:
  1223. - the name of the specific character string data type (CHARACTER
  1224. or CHARACTER VARYING; NATIONAL CHARACTER and NATIONAL CHARACTER
  1225. VARYING are represented as CHARACTER and CHARACTER VARYING,
  1226. respectively);
  1227. - the length or maximum length in characters of the character
  1228. string data type;
  1229. - the catalog name, schema name, and character set name of the
  1230. character set of the character string data type; and
  1231. - the catalog name, schema name, and collation name of the colla-
  1232. tion of the character string data type.
  1233. Character sets fall into three categories: those defined by na-
  1234. tional or international standards, those provided by implemen-
  1235. tations, and those defined by applications. All character sets,
  1236. however defined, always contain the <space> character. Character
  1237. sets defined by applications can be defined to "reside" in any
  1238. schema chosen by the application. Character sets defined by stan-
  1239. dards or by implementations reside in the Information Schema (named
  1240. INFORMATION_SCHEMA) in each catalog, as do collations defined by
  1241. standards and collations and form-of-use conversions defined by
  1242. implementations.
  1243. The <implementation-defined character repertoire name> SQL_TEXT
  1244. specifies the name of a character repertoire and implied form-of-
  1245. use that can represent every character that is in <SQL language
  1246. character> and all other characters that are in character sets
  1247. supported by the implementation.
  1248. 4.2.1 Character strings and collating sequences
  1249. A character string is a sequence of characters chosen from the
  1250. same character repertoire. The character repertoire from which
  1251. the characters of a particular string are chosen may be specified
  1252. explicitly or implicitly. A character string has a length, which
  1253. is the number of characters in the sequence. The length is 0 or a
  1254. positive integer.
  1255. 20 Database Language SQL
  1256. X3H2-92-154/DBL CBR-002
  1257. 4.2 Character strings
  1258. All character strings of a given character repertoire are mutu-
  1259. ally comparable, subject to the restrictions specified in Table 3,
  1260. "Collating sequence usage for comparisons".
  1261. A collating sequence, also known as a collation, is a set of rules
  1262. determining comparison of character strings in a particular char-
  1263. acter repertoire. There is a default collating sequence for each
  1264. character repertoire, but additional collating sequences can be
  1265. defined for any character repertoire.
  1266. Note: A column may be defined as having a default collating se-
  1267. quence. This default collating sequence for the column may be
  1268. different from the default collating sequence for its character
  1269. repertoire, e.g., if the <collate clause> is specified in the
  1270. <column reference>. It will be clear from context when the term
  1271. "default collating sequence" is used whether it is meant for a
  1272. column or for a character repertoire.
  1273. Given a collating sequence, two character strings are identical if
  1274. and only if they are equal in accordance with the comparison rules
  1275. specified in Subclause 8.2, "<comparison predicate>". The collat-
  1276. ing sequence used for a particular comparison is determined as in
  1277. Subclause 4.2.3, "Rules determining collating sequence usage".
  1278. The <key word>s NATIONAL CHARACTER are used to specify a character
  1279. string data type with a particular implementation-defined character
  1280. repertoire. Special syntax (N'string') is provided for representing
  1281. literals in that character repertoire.
  1282. A character set is described by a character set descriptor. A char-
  1283. acter set descriptor includes:
  1284. - the name of the character set or character repertoire,
  1285. - if the character set is a character repertoire, then the name of
  1286. the form-of-use,
  1287. - an indication of what characters are in the character set, and
  1288. - the name of the default collation of the character set.
  1289. For every character set, there is at least one collation. A colla-
  1290. tion is described by a collation descriptor. A collation descriptor
  1291. includes:
  1292. - the name of the collation,
  1293. - the name of the character set on which the collation operates,
  1294. - whether the collation has the NO PAD or the PAD SPACE attribute,
  1295. and
  1296. - an indication of how the collation is performed.
  1297. Concepts 21
  1298. X3H2-92-154/DBL CBR-002
  1299. 4.2 Character strings
  1300. 4.2.2 Operations involving character strings
  1301. 4.2.2.1 Operators that operate on character strings and return
  1302. character strings
  1303. <concatenation operator> is an operator, |, that returns the char-
  1304. acter string made by joining its character string operands in the
  1305. order given.
  1306. <character substring function> is a triadic function, SUBSTRING,
  1307. that returns a string extracted from a given string according
  1308. to a given numeric starting position and a given numeric length.
  1309. Truncation occurs when the implied starting and ending positions
  1310. are not both within the given string.
  1311. <fold> is a pair of functions for converting all the lower case
  1312. characters in a given string to upper case (UPPER) or all the upper
  1313. case ones to lower case (LOWER), useful only in connection with
  1314. strings that may contain <simple Latin letter>s.
  1315. <form-of-use conversion> is a function that invokes an installation-
  1316. supplied form-of-use conversion to return a character string S2
  1317. derived from a given character string S1. It is intended, though
  1318. not enforced by this International Standard, that S2 be exactly the
  1319. same sequence of characters as S1, but encoded according some dif-
  1320. ferent form-of-use. A typical use might be to convert a character
  1321. string from two-octet UCS to one-octet Latin1 or vice versa.
  1322. <trim function> is a function that returns its first string ar-
  1323. gument with leading and/or trailing pad characters removed. The
  1324. second argument indicates whether leading, or trailing, or both
  1325. leading and trailing pad characters should be removed. The third
  1326. argument specifies the pad character that is to be removed.
  1327. <character translation> is a function for changing each charac-
  1328. ter of a given string according to some many-to-one or one-to-one
  1329. mapping between two not necessarily distinct character sets. The
  1330. mapping, rather than being specified as part of the function, is
  1331. some external function identified by a <translation name>.
  1332. For any pair of character sets, there are zero or more translations
  1333. that may be invoked by a <character translation>. A translation
  1334. is described by a translation descriptor. A translation descriptor
  1335. includes:
  1336. - the name of the translation,
  1337. - the name of the character set from which it translates,
  1338. - the name of the character set to which it translates, and
  1339. - an indication of how the translation is performed.
  1340. 22 Database Language SQL
  1341. X3H2-92-154/DBL CBR-002
  1342. 4.2 Character strings
  1343. 4.2.2.2 Other operators involving character strings
  1344. <length expression> returns the length of a given character string,
  1345. as an integer, in characters, octets, or bits according to the
  1346. choice of function.
  1347. <position expression> determines the first position, if any, at
  1348. which one string, S1, occurs within another, S2. If S1 is of length
  1349. zero, then it occurs at position 1 for any value of S2. If S1 does
  1350. not occur in S2, then zero is returned.
  1351. <like predicate> uses the triadic operator LIKE (or the inverse,
  1352. NOT LIKE), operating on three character strings and returning
  1353. a Boolean. LIKE determines whether or not a character string
  1354. "matches" a given "pattern" (also a character string). The char-
  1355. acters '%' (percent) and '_' (underscore) have special meaning when
  1356. they occur in the pattern. The optional third argument is a charac-
  1357. ter string containing exactly one character, known as the "escape
  1358. character", for use when a percent or underscore is required in the
  1359. pattern without its special meaning.
  1360. 4.2.3 Rules determining collating sequence usage
  1361. The rules determining collating sequence usage for character
  1362. strings are based on the following:
  1363. - Expressions where no columns are involved (e.g., literals, host
  1364. variables) are by default compared using the default collating
  1365. sequence for their character repertoire.
  1366. Note: The default collating sequence for a character repertoire
  1367. is defined in Subclause 10.4, "<character set specification>",
  1368. and Subclause 11.28, "<character set definition>".
  1369. - When columns are involved (e.g., comparing two columns, or com-
  1370. paring a column to a literal), by default the default collating
  1371. sequence of the columns involved is used so long as the columns
  1372. have the same default collating sequence.
  1373. - When columns are involved having different default collating
  1374. sequences, explicit specification of the collating sequence in
  1375. the expression is required via the <collate clause> when the
  1376. expression participates in a comparison.
  1377. - Any explicit specification of collating sequence in an expres-
  1378. sion overrides any default collating sequence.
  1379. To formalize this, <character value expression>s effectively have
  1380. a coercibility attribute. This attribute has the values Coercible,
  1381. Implicit, No collating sequence, and Explicit. <character value
  1382. expression>s with the Coercible, Implicit, or Explicit attributes
  1383. have a collating sequence.
  1384. Concepts 23
  1385. X3H2-92-154/DBL CBR-002
  1386. 4.2 Character strings
  1387. A <character value expression> consisting of a column reference has
  1388. the Implicit attribute, with collating sequence as defined when the
  1389. column was created. A <character value expression> consisting of a
  1390. value other than a column (e.g., a host variable or a literal) has
  1391. the Coercible attribute, with the default collation for its char-
  1392. acter repertoire. A <character value expression> simply containing
  1393. a <collate clause> has the Explicit attribute, with the collating
  1394. sequence specified in the <collate clause>.
  1395. Note: When the coercibility attribute is Coercible, the collating
  1396. sequence is uniquely determined as specified in Subclause 8.2,
  1397. "<comparison predicate>".
  1398. The tables below define how the collating sequence and the co-
  1399. ercibility attribute is determined for the result of any monadic
  1400. or dyadic operation. Table 1, "Collating coercibility rules for
  1401. monadic operators", shows the collating sequence and coercibility
  1402. rules for monadic operators, and Table 2, "Collating coercibil-
  1403. ity rules for dyadic operators", shows the collating sequence and
  1404. coercibility rules for dyadic operators. Table 3, "Collating se-
  1405. quence usage for comparisons", shows how the collating sequence is
  1406. determined for a particular comparison.
  1407. _____Table_1-Collating_coercibility_rules_for_monadic_operators____
  1408. Operand Coercibility Result Coercibility
  1409. _____and_Collating_Sequence_____ _____and_Collating_Sequence___
  1410. | Collating | Collating |
  1411. |_Coercibility______Sequence______|_Coercibility______Sequence_____|
  1412. | | |
  1413. | Coercible | default | Coercible | default |
  1414. | | | | |
  1415. | Implicit | X | Implicit | X |
  1416. | | | | |
  1417. | Explicit | X | Explicit | X |
  1418. | | | | |
  1419. |_______No_collati|g_sequence_____|______No_collatin|_sequence_____|
  1420. | | | | |
  1421. _____Table_2-Collating_coercibility_rules_for_dyadic_operators_____
  1422. Result
  1423. Coercibility
  1424. Operand 1 Coercibility Operand 2 Coercibility and Collating
  1425. _and_Collating_Sequence _and_Collating_Sequence ___Sequence___
  1426. | Collating | Collating | Col|ating
  1427. |_Coercibility_Sequence__|_Coercibility_Sequence__|__CoercibilitySe|uence
  1428. | | | |
  1429. | Coercible | default | Coercible | default | Coercible| def|ult
  1430. | | | | | | |
  1431. | Coercible | default | Implicit | Y | Implicit | Y |
  1432. | | | | | | |
  1433. | Coercible | default | No collati|g sequence | No colla|ing |
  1434. sequence
  1435. 24 Database Language SQL
  1436. X3H2-92-154/DBL CBR-002
  1437. 4.2 Character strings
  1438. _Table_2-Collating_coercibility_rules_for_dyadic_operators_(Cont.)_
  1439. Result
  1440. Coercibility
  1441. Operand 1 Coercibility Operand 2 Coercibility and Collating
  1442. _and_Collating_Sequence _and_Collating_Sequence ___Sequence___
  1443. | Collating | Collating | Col|ating
  1444. |_Coercibility_Sequence__|_Coercibility_Sequence__|__CoercibilitySe|uence
  1445. | | | |
  1446. | Coercible | default | Explicit | Y | Explicit | Y |
  1447. | | | | | | |
  1448. | Implicit | X | Coercible | default | Implicit | X |
  1449. | | | | | | |
  1450. | Implicit | X | Implicit | X | Implicit | X |
  1451. | | | | | | |
  1452. | Implicit | X | Implicit | Y /= X | No colla|ing |
  1453. sequence
  1454. | Implicit | X | No collati|g sequence | No collating |
  1455. | | | | | sequence |
  1456. | | | | | |
  1457. | Implicit | X | Explicit Y | Explicit Y |
  1458. | | | | |
  1459. | No collati|g sequence | Any, | Any | No colla|ing |
  1460. except sequence
  1461. Explicit
  1462. | No collating sequence | Explicit | X | Explicit X |
  1463. | | | | |
  1464. | Explicit X | Coercible | default | Explicit | X |
  1465. | | | | | |
  1466. | Explicit | X | Implicit | Y | Explicit | X |
  1467. | | | | | | |
  1468. | Explicit | X | No collati|g sequence | Explicit | X |
  1469. | | | | | | |
  1470. | Explicit | X | Explicit X | Explicit | X |
  1471. | | | | | |
  1472. | Explicit | X | Explicit | Y /= X | Not permi|ted:|
  1473. ____________________________________________________invalid_syntax_
  1474. |__________Ta|le_3-Collat|ng_sequence_|sage_for_co|parisons________|
  1475. Comparand 1 Comparand 2
  1476. Coercibility and Coercibility and
  1477. _Collating_Sequence _Collating_Sequence
  1478. | | | Collating Sequence |
  1479. | Collatin| Collatin| Used For The |
  1480. |_CoercibilitSequence|_CoercibilitSequence|__Comparison____________|
  1481. | | | |
  1482. | Coercible| default | Coercible| default | default |
  1483. | | | | | |
  1484. | Coercible| default | Implicit | Y | Y |
  1485. | | | | | |
  1486. | Coercible| default | No co|lating | Not permitted: invalid|
  1487. sequence syntax
  1488. | Coercible| default | Explicit Y | Y |
  1489. | | | | |
  1490. Concepts 25
  1491. X3H2-92-154/DBL CBR-002
  1492. 4.2 Character strings
  1493. ______Table_3-Collating_sequence_usage_for_comparisons_(Cont.)_____
  1494. Comparand 1 Comparand 2
  1495. Coercibility and Coercibility and
  1496. _Collating_Sequence _Collating_Sequence
  1497. | | | Collating Sequence |
  1498. | Collatin| Collatin| Used For The |
  1499. |_CoercibilitSequence|_CoercibilitSequence|__Comparison____________|
  1500. | | | |
  1501. | Implicit | X | Coercible| default | X |
  1502. | | | | | |
  1503. | Implicit | X | Implicit | X | X |
  1504. | | | | | |
  1505. | Implicit | X | Implicit | Y /= X | Not permitted: invalid|
  1506. syntax
  1507. | Implicit | X | No co|lating | Not permitted: invalid|
  1508. | | | seq|ence | syntax |
  1509. | | | | | |
  1510. | Implicit | X | Explicit Y | Y |
  1511. | | | | |
  1512. | No co|lating | Any | Any | Not permitted: invalid|
  1513. sequence except syntax
  1514. Explicit
  1515. | No collating | Explicit | X | X |
  1516. | sequence | | | |
  1517. | | | | |
  1518. | Explicit X | Coercible| default | X |
  1519. | | | | |
  1520. | Explicit | X | Implicit | Y | X |
  1521. | | | | | |
  1522. | Explicit | X | No co|lating | X |
  1523. sequence
  1524. | Explicit | X | Explicit X | X |
  1525. | | | | |
  1526. | Explicit | X | Explicit | Y /= X | Not permitted: invalid|
  1527. ____________________________________________syntax_________________
  1528. |For n-adic|operation| (e.g., <c|se expres|ion>) with operands X1, |
  1529. X2, . . . , n , the collating sequence is effectively determined by
  1530. considering X1 and X2, then combining this result with X3, and so
  1531. on.
  1532. 4.3 Bit strings
  1533. A bit string is a sequence of bits, each having the value of 0 or
  1534. 1. A bit string has a length, which is the number of bits in the
  1535. string. The length is 0 or a positive integer.
  1536. A bit string data type is described by a bit string data type de-
  1537. scriptor. A bit string data type descriptor contains:
  1538. - the name of the specific bit string data type (BIT or BIT
  1539. VARYING); and
  1540. 26 Database Language SQL
  1541. X3H2-92-154/DBL CBR-002
  1542. 4.3 Bit strings
  1543. - the length of the bit string data type (in bits).
  1544. 4.3.1 Bit string comparison and assignment
  1545. All bit strings are mutually comparable. A bit string is identical
  1546. to another bit string if and only if it is equal to that bit string
  1547. in accordance with the comparison rules specified in Subclause 8.2,
  1548. "<comparison predicate>".
  1549. Assignment of a bit string to a bit string variable is performed
  1550. from the most significant bit to the least significant bit in the
  1551. source string to the most significant bit in the target string, one
  1552. bit at a time.
  1553. 4.3.2 Operations involving bit strings
  1554. 4.3.2.1 Operators that operate on bit strings and return bit
  1555. strings
  1556. <bit concatenation> is an operator, |, that returns the bit string
  1557. made by concatenating the two bit string operands in the order
  1558. given.
  1559. <bit substring function> is a triadic function identical in syntax
  1560. and semantics to <character substring function> except that the
  1561. first argument and the returned value are both bit strings.
  1562. 4.3.2.2 Other operators involving bit strings
  1563. <length expression> returns the length (as an integer number of
  1564. octets or bits according to the choice of function) of a given bit
  1565. string.
  1566. <position expression> determines the first position, if any, at
  1567. which one string, S1, occurs within another, S2. If S1 is of length
  1568. zero, then it occurs at position 1 for any value of S2. If S1 does
  1569. not occur in S2, then zero is returned.
  1570. 4.4 Numbers
  1571. A number is either an exact numeric value or an approximate numeric
  1572. value. Any two numbers are mutually comparable to each other.
  1573. A numeric data type is described by a numeric data type descriptor.
  1574. A numeric data type descriptor contains:
  1575. - the name of the specific numeric data type (NUMERIC, DECIMAL,
  1576. INTEGER, SMALLINT, FLOAT, REAL, or DOUBLE PRECISION);
  1577. - the precision of the numeric data type;
  1578. Concepts 27
  1579. X3H2-92-154/DBL CBR-002
  1580. 4.4 Numbers
  1581. - the scale of the numeric data type, if it is an exact numeric
  1582. data type; and
  1583. - an indication of whether the precision (and scale) are expressed
  1584. in decimal or binary terms.
  1585. 4.4.1 Characteristics of numbers
  1586. An exact numeric value has a precision and a scale. The precision
  1587. is a positive integer that determines the number of significant
  1588. digits in a particular radix (binary or decimal). The scale is a
  1589. non-negative integer. A scale of 0 indicates that the number is an
  1590. integer. For a scale of S, the exact numeric value is the integer
  1591. value of the significant digits multiplied by 10-S.
  1592. An approximate numeric value consists of a mantissa and an expo-
  1593. nent. The mantissa is a signed numeric value, and the exponent is
  1594. a signed integer that specifies the magnitude of the mantissa. An
  1595. approximate numeric value has a precision. The precision is a posi-
  1596. tive integer that specifies the number of significant binary digits
  1597. in the mantissa. The value of an approximate numeric value is the
  1598. mantissa multiplied by 10exponent.
  1599. Whenever an exact or approximate numeric value is assigned to a
  1600. data item or parameter representing an exact numeric value, an
  1601. approximation of its value that preserves leading significant dig-
  1602. its after rounding or truncating is represented in the data type
  1603. of the target. The value is converted to have the precision and
  1604. scale of the target. The choice of whether to truncate or round is
  1605. implementation-defined.
  1606. An approximation obtained by truncation of a numerical value N
  1607. for an <exact numeric type> T is a value V representable in T such
  1608. that N is not closer to zero than the numerical value of V and such
  1609. that the absolute value of the difference between N and the numer-
  1610. ical value of V is less than the absolute value of the difference
  1611. between two successive numerical values representable in T.
  1612. An approximation obtained by rounding of a numerical value N for
  1613. an <exact numeric type> T is a value V representable in T such
  1614. that the absolute value of the difference between N and the nu-
  1615. merical value of V is not greater than half the absolute value
  1616. of the difference between two successive numerical values repre-
  1617. sentable in T. If there are more than one such values V, then it is
  1618. implementation-defined which one is taken.
  1619. All numerical values between the smallest and the largest value,
  1620. inclusive, representable in a given exact numeric type have an
  1621. approximation obtained by rounding or truncation for that type; it
  1622. is implementation-defined which other numerical values have such
  1623. approximations.
  1624. 28 Database Language SQL
  1625. X3H2-92-154/DBL CBR-002
  1626. 4.4 Numbers
  1627. An approximation obtained by truncation or rounding of a numerical
  1628. value N for an <approximate numeric type> T is a value V repre-
  1629. sentable in T such that there is no numerical value representable
  1630. in T and distinct from that of V that lies between the numerical
  1631. value of V and N, inclusive.
  1632. If there are more than one such values V then it is implementation-
  1633. defined which one is taken. It is implementation-defined which
  1634. numerical values have approximations obtained by rounding or trun-
  1635. cation for a given approximate numeric type.
  1636. Whenever an exact or approximate numeric value is assigned to a
  1637. data item or parameter representing an approximate numeric value,
  1638. an approximation of its value is represented in the data type of
  1639. the target. The value is converted to have the precision of the
  1640. target.
  1641. Operations on numbers are performed according to the normal rules
  1642. of arithmetic, within implementation-defined limits, except as
  1643. provided for in Subclause 6.12, "<numeric value expression>".
  1644. 4.4.2 Operations involving numbers
  1645. As well as the usual arithmetic operators, plus, minus, times,
  1646. divide, unary plus, and unary minus, there are the following func-
  1647. tions that return numbers:
  1648. - <position expression> (see Subclause 4.2.2, "Operations involv-
  1649. ing character strings", and Subclause 4.3.2, "Operations involv-
  1650. ing bit strings") takes two strings as arguments and returns an
  1651. integer;
  1652. - <length expression> (see Subclause 4.2.2, "Operations involving
  1653. character strings", and Subclause 4.3.2, "Operations involv-
  1654. ing bit strings") operates on a string argument and returns an
  1655. integer;
  1656. - <extract expression> (see Subclause 4.5.3, "Operations involving
  1657. datetimes and intervals") operates on a datetime or interval
  1658. argument and returns an integer.
  1659. 4.5 Datetimes and intervals
  1660. A datetime data type is described by a datetime data type descrip-
  1661. tor. An interval data type is described by an interval data type
  1662. descriptor.
  1663. A datetime data type descriptor contains:
  1664. - the name of the specific datetime data type (DATE, TIME,
  1665. TIMESTAMP, TIME WITH TIME ZONE, or TIMESTAMP WITH TIME ZONE);
  1666. and
  1667. Concepts 29
  1668. X3H2-92-154/DBL CBR-002
  1669. 4.5 Datetimes and intervals
  1670. - the value of the <time fractional seconds precision>, if it is
  1671. a TIME, TIMESTAMP, TIME WITH TIME ZONE, or TIMESTAMP WITH TIME
  1672. ZONE type.
  1673. An interval data type descriptor contains:
  1674. - the name of the interval data type (INTERVAL);
  1675. - an indication of whether the interval data type is a year-month
  1676. interval or a day-time interval; and
  1677. - the <interval qualifier> that describes the precision of the
  1678. interval data type.
  1679. Every datetime or interval data type has an implied length in po-
  1680. sitions. Let D denote a value in some datetime or interval data
  1681. type DT. The length in positions of DT is constant for all D. The
  1682. length in positions is the number of characters from the character
  1683. set SQL_TEXT that it would take to represent any value in a given
  1684. datetime or interval data type.
  1685. 4.5.1 Datetimes
  1686. Table 4, "Fields in datetime items", specifies the fields that can
  1687. make up a date time value; a datetime value is made up of a subset
  1688. of those fields. Not all of the fields shown are required to be in
  1689. the subset, but every field that appears in the table between the
  1690. first included primary field and the last included primary field
  1691. shall also be included. If either timezone field is in the subset,
  1692. then both of them shall be included.
  1693. __________________Table_4-Fields_in_datetime_items_________________
  1694. _Keyword____________Meaning________________________________________
  1695. |__________________|___Primary_datetime_fields_____________________|
  1696. | | |
  1697. | YEAR Year |
  1698. | |
  1699. | MONTH | Month within year |
  1700. | | |
  1701. | DAY | Day within month |
  1702. | | |
  1703. | HOUR | Hour within day |
  1704. | | |
  1705. | MINUTE | Minute within hour |
  1706. | | |
  1707. | SECOND | Second and possibly fraction of a second |
  1708. ____________________within_minute__________________________________
  1709. |__________________|___Timezone_datetime_fields____________________|
  1710. | | |
  1711. | TIMEZONE_HOUR | Hour value of time zone displacement |
  1712. | |
  1713. |_TIMEZONE_MINUTE__|_Minute_value_of_time_zone_displacement________|
  1714. | | |
  1715. 30 Database Language SQL
  1716. X3H2-92-154/DBL CBR-002
  1717. 4.5 Datetimes and intervals
  1718. There is an ordering of the significance of <datetime field>s. This
  1719. is, from most significant to least significant: YEAR, MONTH, DAY,
  1720. HOUR, MINUTE, and SECOND.
  1721. The <datetime field>s other than SECOND contain non-negative in-
  1722. teger values, constrained by the natural rules for dates using the
  1723. Gregorian calendar. SECOND, however, can be defined to have a <time
  1724. fractional seconds precision> that indicates the number of decimal
  1725. digits maintained following the decimal point in the seconds value,
  1726. a non-negative exact numeric value.
  1727. There are three classes of datetime data types defined within this
  1728. International Standard:
  1729. - DATE - contains the <datetime field>s YEAR, MONTH, and DAY;
  1730. - TIME - contains the <datetime field>s HOUR, MINUTE, and SECOND;
  1731. and
  1732. - TIMESTAMP - contains the <datetime field>s YEAR, MONTH, DAY,
  1733. HOUR, MINUTE, and SECOND.
  1734. Items of type datetime are mutually comparable only if they have
  1735. the same <datetime field>s.
  1736. Datetimes only have absolute meaning in the context of additional
  1737. information. Time zones are political divisions of the earth's
  1738. surface that allow the convention that time is measured the same
  1739. at all locations within the time zone, regardless of the precise
  1740. value of "sun time" at specific locations. Political entities often
  1741. change the "local time" within a time zone for certain periods of
  1742. the year, e.g., in the summer. However, different political enti-
  1743. ties within the same time zone are not necessarily synchronized in
  1744. their local time changes. When a datetime is specified (in SQL-data
  1745. or elsewhere) it has an implied or explicit time zone specifier as-
  1746. sociated with it. Unless that time zone specifier, and its meaning,
  1747. is known, the meaning of the datetime value is ambiguous.
  1748. Therefore, datetime data types that contain time fields (TIME and
  1749. TIMESTAMP) are maintained in Universal Coordinated Time (UTC), with
  1750. an explicit or implied time zone part.
  1751. The time zone part is an interval specifying the difference between
  1752. UTC and the actual date and time in the time zone represented by
  1753. the time or timestamp data item. The time zone displacement is
  1754. defined as
  1755. INTERVAL HOUR TO MINUTE
  1756. A TIME or TIMESTAMP that does not specify WITH TIME ZONE has an im-
  1757. plicit time zone equal to the local time zone for the SQL-session.
  1758. The value of time represented in the data changes along with the
  1759. local time zone for the SQL-session. However, the meaning of the
  1760. time does not change because it is effectively maintained in UTC.
  1761. Concepts 31
  1762. X3H2-92-154/DBL CBR-002
  1763. 4.5 Datetimes and intervals
  1764. Note: On occasion, UTC is adjusted by the omission of a second or
  1765. the insertion of a "leap second" in order to maintain synchro-
  1766. nization with sidereal time. This implies that sometimes, but very
  1767. rarely, a particular minute will contain exactly 59, 61, or 62
  1768. seconds.
  1769. 4.5.2 Intervals
  1770. There are two classes of intervals. One class, called year-month
  1771. intervals, has an express or implied datetime precision that in-
  1772. cludes no fields other than YEAR and MONTH, though not both are
  1773. required. The other class, called day-time intervals, has an ex-
  1774. press or implied interval precision that can include any fields
  1775. other than YEAR or MONTH.
  1776. Table 5, "Fields in year-month INTERVAL items", specifies the
  1777. fields that make up a year-month interval. A year-month interval
  1778. is made up of a contiguous subset of those fields.
  1779. ____________Table_5-Fields_in_year-month_INTERVAL_items____________
  1780. _Keyword______Meaning______________________________________________
  1781. | YEAR | Years |
  1782. | | |
  1783. |_MONTH______|_Months______________________________________________|
  1784. | | |
  1785. Table 6, "Fields in day-time INTERVAL items", specifies the fields
  1786. that make up a day-time interval. A day-time interval is made up of
  1787. a contiguous subset of those fields.
  1788. _____________Table_6-Fields_in_day-time_INTERVAL_items_____________
  1789. _Keyword______Meaning______________________________________________
  1790. | DAY | Days |
  1791. | | |
  1792. | HOUR | Hours |
  1793. | | |
  1794. | MINUTE | Minutes |
  1795. | | |
  1796. |_SECOND_____|_Seconds_and_possibly_fractions_of_a_second__________|
  1797. | | |
  1798. The actual subset of fields that comprise an item of either type of
  1799. interval is defined by an <interval qualifier> and this subset is
  1800. known as the precision of the item.
  1801. Within an item of type interval, the first field is constrained
  1802. only by the <interval leading field precision> of the associated
  1803. <interval qualifier>. Table 7, "Valid values for fields in INTERVAL
  1804. items", specifies the constraints on subsequence field values.
  1805. 32 Database Language SQL
  1806. X3H2-92-154/DBL CBR-002
  1807. 4.5 Datetimes and intervals
  1808. _________Table_7-Valid_values_for_fields_in_INTERVAL_items_________
  1809. _Keyword______Valid_values_of_INTERVAL_fields______________________
  1810. | YEAR | Unconstrained except by <interval leading field |
  1811. precision
  1812. | MONTH | Months (within years) (0-11) |
  1813. | | |
  1814. | DAY | Unconstrained except by <interval leading field |
  1815. precision
  1816. | HOUR | Hours (within days) (0-23) |
  1817. | | |
  1818. | MINUTE | Minutes (within hours) (0-59) |
  1819. | | |
  1820. |_SECOND_____|_Seconds_(within_minutes)_(0-59.999...)______________|
  1821. | | |
  1822. Values in interval fields other than SECOND are integers. SECOND,
  1823. however, can be defined to have an <interval fractional seconds
  1824. precision> that indicates the number of decimal digits maintained
  1825. following the decimal point in the seconds value.
  1826. Fields comprising an item of type interval are also constrained by
  1827. the definition of the Gregorian calendar.
  1828. Year-month intervals are mutually comparable only with other year-
  1829. month intervals. If two year-month intervals have different inter-
  1830. val precisions, they are, for the purpose of any operations between
  1831. them, effectively converted to the same precision by appending new
  1832. <datetime field>s to either the most significant end or the least
  1833. significant end of one or both year-month intervals. New least sig-
  1834. nificant <datetime field>s are assigned a value of 0. When it is
  1835. necessary to add new most significant date time fields, the as-
  1836. sociated value is effectively converted to the new precision in
  1837. a manner obeying the natural rules for dates and times associated
  1838. with the Gregorian calendar.
  1839. Day-time intervals are mutually comparable only with other day-
  1840. time intervals. If two day-time intervals have different interval
  1841. precisions, they are, for the purpose of any operations between
  1842. them, effectively converted to the same precision by appending new
  1843. <datetime field>s to either the most significant end or the least
  1844. significant end of one or both day-time intervals. New least sig-
  1845. nificant <datetime field>s are assigned a value of 0. When it is
  1846. necessary to add new most significant datetime fields, the asso-
  1847. ciated value is effectively converted to the new precision in a
  1848. manner obeying the natural rules for dates and times associated
  1849. with the Gregorian calendar.
  1850. Concepts 33
  1851. X3H2-92-154/DBL CBR-002
  1852. 4.5 Datetimes and intervals
  1853. 4.5.3 Operations involving datetimes and intervals
  1854. Table 8, "Valid operators involving datetimes and intervals", spec-
  1855. ifies the results of arithmetic expressions involving datetime and
  1856. interval operands.
  1857. _____Table_8-Valid_operators_involving_datetimes_and_intervals_____
  1858. Operand Operand
  1859. _1__________Operator_2_________Result_Type_________________________
  1860. | Datetime | - | Datetime | Interval |
  1861. | | | | |
  1862. | Datetime | + or -| Interval | Datetime |
  1863. | | | | |
  1864. | Interval | + | Datetime | Datetime |
  1865. | | | | |
  1866. | Interval | + or -| Interval | Interval |
  1867. | | | | |
  1868. | Interval | * or /| Numeric | Interval |
  1869. | | | | |
  1870. |_Numeric__|_*_____|_Interval_|_Interval___________________________|
  1871. | | | | |
  1872. Arithmetic operations involving items of type datetime or inter-
  1873. val obey the natural rules associated with dates and times and
  1874. yield valid datetime or interval results according to the Gregorian
  1875. calendar.
  1876. Operations involving items of type datetime require that the date-
  1877. time items be mutually comparable. Operations involving items of
  1878. type interval require that the interval items be mutually compara-
  1879. ble.
  1880. Operations involving a datetime and an interval preserve the time
  1881. zone of the datetime operand. If the datetime operand does not
  1882. include a time zone part, then the local time zone is effectively
  1883. used.
  1884. <overlaps predicate> uses the operator OVERLAPS to determine
  1885. whether or not two chronological periods overlap in time. A chrono-
  1886. logical period is specified either as a pair of datetimes (starting
  1887. and ending) or as a starting datetime and an interval.
  1888. <extract expression> operates on a datetime or interval and returns
  1889. an exact numeric value representing the value of one component of
  1890. the datetime or interval.
  1891. 4.6 Type conversions and mixing of data types
  1892. Values of the data types NUMERIC, DECIMAL, INTEGER, SMALLINT,
  1893. FLOAT, REAL, and DOUBLE PRECISION are numbers and are all mutually
  1894. comparable and mutually assignable. If an assignment would result
  1895. in a loss of the most significant digits, an exception condition
  1896. is raised. If least significant digits are lost, implementation-
  1897. defined rounding or truncating occurs with no exception condition
  1898. being raised. The rules for arithmetic are generally governed by
  1899. Subclause 6.12, "<numeric value expression>".
  1900. 34 Database Language SQL
  1901. X3H2-92-154/DBL CBR-002
  1902. 4.6 Type conversions and mixing of data types
  1903. Values corresponding to the data types CHARACTER and CHARACTER
  1904. VARYING are mutually assignable if and only if they are taken from
  1905. the same character repertoire. If they are from different character
  1906. repertoires, then the value of the source of the assignment shall
  1907. be translated to the character repertoire of the target before an
  1908. assignment is possible. If a store assignment would result in the
  1909. loss of non-<space> characters due to truncation, then an exception
  1910. condition is raised. The values are mutually comparable only if
  1911. they are mutually assignable and can be coerced to have the same
  1912. collation. The comparison of two character strings depends on the
  1913. collating sequence used for the comparison (see Table 3, "Collating
  1914. sequence usage for comparisons"). When values of unequal length
  1915. are compared, if the collating sequence for the comparison has
  1916. the NO PAD attribute and the shorter value is equal to a prefix of
  1917. the longer value, then the shorter value is considered less than
  1918. the longer value. If the collating sequence for the comparison has
  1919. the PAD SPACE attribute, for the purposes of the comparison, the
  1920. shorter value is effectively extended to the length of the longer
  1921. by concatenation of <space>s on the right.
  1922. Values corresponding to the data types BIT and BIT VARYING are al-
  1923. ways mutually comparable and are mutually assignable. If a store
  1924. assignment would result in the loss of bits due to truncation, then
  1925. an exception condition is raised. When values of unequal length are
  1926. to be compared, if the shorter is a prefix of the longer, then the
  1927. shorter is less than the longer; otherwise, the longer is effec-
  1928. tively truncated to the length of the shorter for the purposes of
  1929. comparison. When values of equal length are to be compared, then a
  1930. bit-by-bit comparison is made. A 0-bit less than a 1-bit.
  1931. Values of type datetime are mutually assignable only if the source
  1932. and target of the assignment have the same datetime fields.
  1933. Values of type interval are mutually assignable only if the source
  1934. and target of the assignment are both year-month intervals or if
  1935. they are both day-time intervals.
  1936. Implicit type conversion can occur in expressions, fetch opera-
  1937. tions, single row select operations, inserts, deletes, and updates.
  1938. Explicit type conversions can be specified by the use of the CAST
  1939. operator.
  1940. 4.7 Domains
  1941. A domain is a set of permissible values. A domain is defined in
  1942. a schema and is identified by a <domain name>. The purpose of a
  1943. domain is to constrain the set of valid values that can be stored
  1944. in SQL-data by various operations.
  1945. A domain definition specifies a data type. It may also specify a
  1946. <domain constraint> that further restricts the valid values of the
  1947. domain and a <default clause> that specifies the value to be used
  1948. in the absence of an explicitly specified value or column default.
  1949. Concepts 35
  1950. X3H2-92-154/DBL CBR-002
  1951. 4.7 Domains
  1952. A domain is described by a domain descriptor. A domain descriptor
  1953. includes:
  1954. - the name of the domain;
  1955. - the data type descriptor of the data type of the domain;
  1956. - the <collation name> from the <collate clause>, if any, of the
  1957. domain;
  1958. - the value of <default option>, if any, of the domain; and
  1959. - the domain constraint descriptors of the domain constraints, if
  1960. any, of the domain.
  1961. 4.8 Columns
  1962. A column is a multiset of values that may vary over time. All val-
  1963. ues of the same column are of the same data type or domain and are
  1964. values in the same table. A value of a column is the smallest unit
  1965. of data that can be selected from a table and the smallest unit of
  1966. data that can be updated.
  1967. Every column has a <column name>.
  1968. Every column has a nullability characteristic of known not nullable
  1969. or possibly nullable, defined as follows:
  1970. A column has a nullability characteristic that indicates whether
  1971. any attempt to store a null value into that column will inevitably
  1972. raise an exception, or whether any attempt to retrieve a value
  1973. from that column can ever result in a null value. A column C with
  1974. <column name> CN of a base table T has a nullability characteristic
  1975. that is known not nullable if and only if either:
  1976. - there exists at least one constraint that is not deferrable and
  1977. that simply contains a <search condition> that contains CN IS
  1978. NOT NULL or NOT CN IS NULL or RVE IS NOT NULL, where RVE is a
  1979. <row value constructor> that contains a <row value constructor
  1980. expression> that is simply CN without an intervening <search
  1981. condition> that specifies OR and without an intervening <boolean
  1982. factor> that specifies NOT.
  1983. - C is based on a domain that has a domain constraint that is
  1984. not deferrable and that simply contains a <search condition>
  1985. that contains VALUE IS NOT NULL or NOT VALUE IS NULL without an
  1986. intervening <search condition> that specifies OR and without an
  1987. intervening <boolean factor> that specifies NOT.
  1988. - CN is contained in a non-deferrable <unique constraint defi-
  1989. nition> whose <unique specification> specifies PRIMARY KEY.
  1990. Otherwise, a column C is possibly nullable.
  1991. 36 Database Language SQL
  1992. X3H2-92-154/DBL CBR-002
  1993. 4.8 Columns
  1994. A column is described by a column descriptor. A column descriptor
  1995. includes:
  1996. - the name of the column;
  1997. - whether the name of the column is an implementation-dependent
  1998. name;
  1999. - if the column is based on a domain, then the name of that do-
  2000. main; otherwise, the data type descriptor of the data type of
  2001. the column;
  2002. - the <collation name> from the <collate clause>, if any, of the
  2003. column;
  2004. - the value of <default option>, if any, of the column;
  2005. - the nullability characteristic of the column; and
  2006. - the ordinal position of the column within the table that con-
  2007. tains the column.
  2008. 4.9 Tables
  2009. A table is a multiset of rows. A row is a nonempty sequence of
  2010. values. Every row of the same table has the same cardinality and
  2011. contains a value of every column of that table. The i-th value in
  2012. every row of a table is a value of the i-th column of that table.
  2013. The row is the smallest unit of data that can be inserted into a
  2014. table and deleted from a table.
  2015. The degree of a table is the number of columns of that table. At
  2016. any time, the degree of a table is the same as the cardinality of
  2017. each of its rows and the cardinality of a table is the same as the
  2018. cardinality of each of its columns. A table whose cardinality is 0
  2019. is said to be empty.
  2020. A table is either a base table, a viewed table, or a derived table.
  2021. A base table is either a persistent base table, a global tempo-
  2022. rary table, a created local temporary table, or a declared local
  2023. temporary table.
  2024. A persistent base table is a named table defined by a <table defi-
  2025. nition> that does not specify TEMPORARY.
  2026. A derived table is a table derived directly or indirectly from one
  2027. or more other tables by the evaluation of a <query expression>.
  2028. The values of a derived table are derived from the values of the
  2029. underlying tables when the <query expression> is evaluated.
  2030. A viewed table is a named derived table defined by a <view defini-
  2031. tion>. A viewed table is sometimes called a view.
  2032. Concepts 37
  2033. X3H2-92-154/DBL CBR-002
  2034. 4.9 Tables
  2035. The terms simply underlying table, underlying table, leaf underly-
  2036. ing table, generally underlying table, and leaf generally underly-
  2037. ing table define a relationship between a derived table or cursor
  2038. and other tables.
  2039. The simply underlying tables of derived tables and cursors are
  2040. defined in Subclause 7.9, "<query specification>", Subclause 7.10,
  2041. "<query expression>", and Subclause 13.1, "<declare cursor>". A
  2042. viewed table has no simply underlying tables.
  2043. The underlying tables of a derived table or cursor are the simply
  2044. underlying tables of the derived table or cursor and the underlying
  2045. tables of the simply underlying tables of the derived table or
  2046. cursor.
  2047. The leaf underlying tables of a derived table or cursor are the
  2048. underlying tables of the derived table or cursor that do not them-
  2049. selves have any underlying tables.
  2050. The generally underlying tables of a derived table or cursor are
  2051. the underlying tables of the derived table or cursor and, for those
  2052. underlying tables of the derived table or cursor that are viewed
  2053. tables, the <query expression> of each viewed table and the gen-
  2054. erally underlying tables of the <query expression> of each viewed
  2055. table.
  2056. The leaf generally underlying tables of a derived table or cursor
  2057. are the generally underlying tables of the derived table or cursor
  2058. that do not themselves have any generally underlying tables.
  2059. All base tables are updatable. Derived tables are either updatable
  2060. or read-only. The operations of insert, update, and delete are
  2061. permitted for updatable tables, subject to constraining Access
  2062. Rules. The operations of insert, update, and delete are not allowed
  2063. for read-only tables.
  2064. A grouped table is a set of groups derived during the evaluation
  2065. of a <group by clause> or a <having clause>. A group is a multiset
  2066. of rows in which all values of the grouping column or columns are
  2067. equal if a <group by clause> is specified, or the group is the
  2068. entire table if no <group by clause> is specified. A grouped table
  2069. may be considered as a collection of tables. Set functions may
  2070. operate on the individual tables within the grouped table.
  2071. A global temporary table is a named table defined by a <table defi-
  2072. nition> that specifies GLOBAL TEMPORARY. A created local temporary
  2073. table is a named table defined by a <table definition> that speci-
  2074. fies LOCAL TEMPORARY. Global and created local temporary tables are
  2075. effectively materialized only when referenced in an SQL-session.
  2076. Every <module> in every SQL-session that references a created local
  2077. temporary table causes a distinct instance of that created local
  2078. temporary table to be materialized. That is, the contents of a
  2079. global temporary table or a created local temporary table cannot
  2080. be shared between SQL-sessions. In addition, the contents of a cre-
  2081. ated local temporary table cannot be shared between <module>s of a
  2082. single SQL-session. The definition of a global temporary table or a
  2083. created local temporary table appears in a schema. In SQL language,
  2084. 38 Database Language SQL
  2085. X3H2-92-154/DBL CBR-002
  2086. 4.9 Tables
  2087. the name and the scope of the name of a global temporary table or
  2088. a created local temporary table are indistinguishable from those
  2089. of a persistent base table. However, because global temporary ta-
  2090. ble contents are distinct within SQL-sessions, and created local
  2091. temporary tables are distinct within <module>s within SQL-sessions,
  2092. the effective <schema name> of the schema in which the global tem-
  2093. porary table or the created local temporary table is instantiated
  2094. is an implementation-dependent <schema name> that may be thought
  2095. of as having been effectively derived from the <schema name> of
  2096. the schema in which the global temporary table or created local
  2097. temporary table is defined and the implementation-dependent SQL-
  2098. session identifier associated with the SQL-session. In addition,
  2099. the effective <schema name> of the schema in which the created
  2100. local temporary table is instantiated may be thought of as being
  2101. further qualified by a unique implementation-dependent name associ-
  2102. ated with the <module> in which the created local temporary table
  2103. is referenced.
  2104. A declared local temporary table is a named table defined by a
  2105. <temporary table declaration> that is effectively materialized
  2106. the first time any <procedure> in the <module> that contains the
  2107. <temporary table declaration> is executed. A declared local tem-
  2108. porary table is accessible only by <procedure>s in the <module>
  2109. that contains the <temporary table declaration>. The effective
  2110. <schema name> of the <qualified name> of the declared local tem-
  2111. porary table may be thought of as the implementation-dependent
  2112. SQL-session identifier associated with the SQL-session and a unique
  2113. implementation-dependent name associated with the <module> that
  2114. contains the <temporary table declaration>. All references to a
  2115. declared local temporary table are prefixed by "MODULE.".
  2116. The materialization of a temporary table does not persist beyond
  2117. the end of the SQL-session in which the table was materialized.
  2118. Temporary tables are effectively empty at the start of an SQL-
  2119. session.
  2120. A table is described by a table descriptor. A table descriptor is
  2121. either a base table descriptor, a view descriptor, or a derived
  2122. table descriptor (for a derived table that is not a view).
  2123. Every table descriptor includes:
  2124. - the degree of the table (the number of column descriptors); and
  2125. - the column descriptor of each column in the table.
  2126. A base table descriptor describes a base table. In addition to
  2127. the components of every table descriptor, a base table descriptor
  2128. includes:
  2129. - the name of the base table;
  2130. - an indication of whether the table is a persistent base table,
  2131. a global temporary table, a created local temporary table, or a
  2132. declared local temporary table; and
  2133. Concepts 39
  2134. X3H2-92-154/DBL CBR-002
  2135. 4.9 Tables
  2136. - the descriptor of each table constraint specified for the table.
  2137. A derived table descriptor describes a derived table. In addi-
  2138. tion to the components of every table descriptor, a derived table
  2139. descriptor includes:
  2140. - if the table is named, then the name of the table;
  2141. - the <query expression> that defines how the table is to be de-
  2142. rived; and
  2143. - an indication of whether the derived table is updatable or read-
  2144. only (this is derived from the <query expression>);
  2145. A view descriptor describes a view. In addition to the components
  2146. of a derived table descriptor, a view descriptor includes:
  2147. - an indication of whether the view has the CHECK OPTION; if so,
  2148. whether it is to be applied as CASCADED or LOCAL.
  2149. 4.10 Integrity constraints
  2150. Integrity constraints, generally referred to simply as constraints,
  2151. define the valid states of SQL-data by constraining the values
  2152. in the base tables. A constraint is either a table constraint,
  2153. a domain constraint or an assertion. A constraint is described
  2154. by a constraint descriptor. A constraint descriptor is either a
  2155. table constraint descriptor, a domain constraint descriptor or an
  2156. assertion descriptor. Every constraint descriptor includes:
  2157. - the name of the constraint;
  2158. - an indication of whether or not the constraint is deferrable;
  2159. - an indication of whether the initial constraint mode is deferred
  2160. or immediate;
  2161. A <query expression> or <query specification> is possibly non-
  2162. deterministic if an implementation might, at two different times
  2163. where the state of the SQL-data is the same, produce results that
  2164. differ by more than the order of the rows due to General Rules that
  2165. specify implementation-dependent behavior.
  2166. No integrity constraint shall be defined using a <query specifica-
  2167. tion> or a <query expression> that is possibly non-deterministic.
  2168. 40 Database Language SQL
  2169. X3H2-92-154/DBL CBR-002
  2170. 4.10 Integrity constraints
  2171. 4.10.1 Checking of constraints
  2172. Every constraint is either deferrable or non-deferrable. Within
  2173. a transaction, every constraint has a constraint mode; if a con-
  2174. straint is non-deferrable, then its constraint mode is always im-
  2175. mediate, otherwise it is either or immediate or deferred. Every
  2176. constraint has an initial constraint mode that specifies the
  2177. constraint mode for that constraint at the start of each SQL-
  2178. transaction and immediately after definition of that constraint.
  2179. If a constraint is deferrable, then its constraint mode may be
  2180. changed (from immediate to deferred, or from deferred to immediate)
  2181. by execution of a <set constraints mode statement>.
  2182. The checking of a constraint depends on its constraint mode within
  2183. the current SQL-transaction. If the constraint mode is immedi-
  2184. ate, then the constraint is effectively checked at the end of
  2185. each SQL-statement. If the constraint mode is deferred, then the
  2186. constraint is effectively checked when the constraint mode is
  2187. changed to immediate either explicitly by execution of a <set con-
  2188. straints mode statement>, or implicitly at the end of the current
  2189. SQL-transaction.
  2190. When a constraint is checked other than at the end of an SQL-
  2191. transaction, if it is not satisfied, then an exception condition
  2192. is raised and the SQL-statement that caused the constraint to be
  2193. checked has no effect other than entering the exception information
  2194. into the diagnostics area. When a <commit statement> is executed,
  2195. all constraints are effectively checked and, if any constraint
  2196. is not satisfied, then an exception condition is raised and the
  2197. transaction is terminated by an implicit <rollback statement>.
  2198. 4.10.2 Table constraints
  2199. A table constraint is either a unique constraint, a referential
  2200. constraint or a table check constraint. A table constraint is de-
  2201. scribed by a table constraint descriptor which is either a unique
  2202. constraint descriptor, a referential constraint descriptor or a
  2203. table check constraint descriptor.
  2204. A unique constraint is described by a unique constraint descriptor.
  2205. In addition to the components of every table constraint descriptor,
  2206. a unique constraint descriptor includes:
  2207. - an indication of whether it was defined with PRIMARY KEY or
  2208. UNIQUE, and
  2209. - the names and positions of the unique columns specified in the
  2210. <unique column list>;
  2211. A referential constraint is described by a referential constraint
  2212. descriptor. In addition to the components of every table constraint
  2213. descriptor, a referential constraint descriptor includes:
  2214. Concepts 41
  2215. X3H2-92-154/DBL CBR-002
  2216. 4.10 Integrity constraints
  2217. - the names of the referencing columns specified in the <referenc-
  2218. ing columns>,
  2219. - the names of the referenced columns and referenced table speci-
  2220. fied in the <referenced table and columns>, and
  2221. - the value of the <match type>, if specified, and the <referen-
  2222. tial triggered actions>, if specified.
  2223. Note: If MATCH FULL or MATCH PARTIAL is specified for a referential
  2224. constraint and if the referencing table has only one column spec-
  2225. ified in <referential constraint definition> for that referential
  2226. constraint, or if the referencing table has more than one specified
  2227. column for that <referential constraint definition>, but none of
  2228. those columns is nullable, then the effect is the same as if no
  2229. <match option> were specified.
  2230. A table check constraint is described by a table check constraint
  2231. descriptor. In addition to the components of every table constraint
  2232. descriptor, a table check constraint descriptor includes:
  2233. - the <search condition>.
  2234. A unique constraint is satisfied if and only if no two rows in
  2235. a table have the same non-null values in the unique columns. In
  2236. addition, if the unique constraint was defined with PRIMARY KEY,
  2237. then it requires that none of the values in the specified column or
  2238. columns be the null value.
  2239. In the case that a table constraint is a referential constraint,
  2240. the table is referred to as the referencing table. The referenced
  2241. columns of a referential constraint shall be the unique columns of
  2242. some unique constraint of the referenced table.
  2243. A referential constraint is satisfied if one of the following con-
  2244. ditions is true, depending on the <match option> specified in the
  2245. <referential constraint definition>:
  2246. - If no <match type> was specified then, for each row R1 of the
  2247. referencing table, either at least one of the values of the
  2248. referencing columns in R1 shall be a null value, or the value of
  2249. each referencing column in R1 shall be equal to the value of the
  2250. corresponding referenced column in some row of the referenced
  2251. table.
  2252. - If MATCH FULL was specified then, for each row R1 of the refer-
  2253. encing table, either the value of every referencing column in R1
  2254. shall be a null value, or the value of every referencing column
  2255. in R1 shall not be null and there shall be some row R2 of the
  2256. referenced table such that the value of each referencing col-
  2257. umn in R1 is equal to the value of the corresponding referenced
  2258. column in R2.
  2259. 42 Database Language SQL
  2260. X3H2-92-154/DBL CBR-002
  2261. 4.10 Integrity constraints
  2262. - If MATCH PARTIAL was specified then, for each row R1 of the
  2263. referencing table, there shall be some row R2 of the refer-
  2264. enced table such that the value of each referencing column in
  2265. R1 is either null or is equal to the value of the corresponding
  2266. referenced column in R2.
  2267. The referencing table may be the same table as the referenced ta-
  2268. ble.
  2269. A table check constraint is satisfied if and only if the specified
  2270. <search condition> is not false for any row of a table.
  2271. 4.10.3 Domain constraints
  2272. A domain constraint is a constraint that is specified for a domain.
  2273. It is applied to all columns that are based on that domain, and to
  2274. all values cast to that domain.
  2275. A domain constraint is described by a domain constraint descriptor.
  2276. In addition to the components of every constraint descriptor a
  2277. domain constraint descriptor includes:
  2278. - the <search condition>.
  2279. A domain constraint is satisfied by SQL-data if and only if, for
  2280. any table T that has a column named C based on that domain, the
  2281. specified <search condition>, with each occurrence of VALUE re-
  2282. placed by C, is not false for any row of T.
  2283. A domain constraint is satisfied by the result of a <cast specifi-
  2284. cation> if and only if the specified <search condition>, with each
  2285. occurrence of VALUE replaced by that result, is not false.
  2286. 4.10.4 Assertions
  2287. An assertion is a named constraint that may relate to the content
  2288. of individual rows of a table, to the entire contents of a table,
  2289. or to a state required to exist among a number of tables.
  2290. An assertion is described by an assertion descriptor. In addi-
  2291. tion to the components of every constraint descriptor an assertion
  2292. descriptor includes:
  2293. - the <search condition>.
  2294. An assertion is satisfied if and only if the specified <search
  2295. condition> is not false.
  2296. Concepts 43
  2297. X3H2-92-154/DBL CBR-002
  2298. 4.11 SQL-schemas
  2299. 4.11 SQL-schemas
  2300. An SQL-schema is a persistent descriptor that includes:
  2301. - the <schema name> of the SQL-schema;
  2302. - the <authorization identifier> of the owner of the SQL-schema;
  2303. - The <character set name> of the default character set for the
  2304. SQL-schema; and
  2305. - the descriptor of every component of the SQL-schema.
  2306. In this International Standard, the term "schema" is used only
  2307. in the sense of SQL-schema. Each component descriptor is either
  2308. a domain descriptor, a base table descriptor, a view descriptor,
  2309. an assertion descriptor, a privilege descriptor, a character set
  2310. descriptor, a collation descriptor, or a translation descriptor.
  2311. The persistent objects described by the descriptors are said to be
  2312. owned by or to have been created by the <authorization identifier>
  2313. of the schema.
  2314. A schema is created initially using a <schema definition> and may
  2315. be subsequently modified incrementally over time by the execution
  2316. of <SQL schema statement>s. <schema name>s are unique within a
  2317. catalog.
  2318. A <schema name> is explicitly or implicitly qualified by a <catalog
  2319. name> that identifies a catalog.
  2320. Base tables and views are identified by <table name>s. A <table
  2321. name> consists of a <schema name> and an <identifier>. For a per-
  2322. sistent table, the <schema name> identifies the schema in which
  2323. the base table or view identified by the <table name> was de-
  2324. fined. Base tables and views defined in different schemas can
  2325. have <identifier>s that are equal according to the General Rules
  2326. of Subclause 8.2, "<comparison predicate>".
  2327. If a reference to a <table name> does not explicitly contain a
  2328. <schema name>, then a specific <schema name> is implied. The par-
  2329. ticular <schema name> associated with such a <table name> depends
  2330. on the context in which the <table name> appears and is governed
  2331. by the rules for <qualified name>. The default schema for <prepara-
  2332. ble statement>s that are dynamically prepared in the current SQL-
  2333. session through the execution of <prepare statement>s and <execute
  2334. immediate statement>s is initially implementation-defined but may
  2335. be changed by the use of <set schema statement>s.
  2336. 44 Database Language SQL
  2337. X3H2-92-154/DBL CBR-002
  2338. 4.12 Catalogs
  2339. 4.12 Catalogs
  2340. Catalogs are named collections of schemas in an SQL-environment. An
  2341. SQL-environment contains zero or more catalogs. A catalog con-
  2342. tains one or more schemas, but always contains a schema named
  2343. INFORMATION_SCHEMA that contains the views and domains of the
  2344. Information Schema. The method of creation and destruction of
  2345. catalogs is implementation-defined. The set of catalogs that
  2346. can be referenced in any SQL-statement, during any particular
  2347. SQL-transaction, or during the course of an SQL-session is also
  2348. implementation-defined. The default catalog for a <module> whose
  2349. <module authorization clause> does not specify an explicit <cata-
  2350. log name> to qualify the <schema name> is implementation-defined.
  2351. The default catalog for <preparable statement>s that are dynami-
  2352. cally prepared in the current SQL-session through the execution
  2353. of <prepare statement>s and <execute immediate statement>s is ini-
  2354. tially implementation-defined but may be changed by the use of <set
  2355. catalog statement>s.
  2356. 4.13 Clusters of catalogs
  2357. A cluster is an implementation-defined collection of catalogs.
  2358. Exactly one cluster is associated with an SQL-session and it
  2359. defines the totality of the SQL-data that is available to that
  2360. SQL-session.
  2361. An instance of a cluster is described by an instance of a defi-
  2362. nition schema. Given some SQL-data object, such as a view, a con-
  2363. straint, a domain, or a base table, the definition of that object,
  2364. and of all the objects that it directly or indirectly references,
  2365. are in the same cluster of catalogs. For example, no <referential
  2366. constraint definition> and no <joined table> can "cross" a cluster
  2367. boundary.
  2368. Whether or not any catalog can occur simultaneously in more than
  2369. one cluster is implementation-defined.
  2370. Within a cluster, no two catalogs have the same name.
  2371. 4.14 SQL-data
  2372. SQL-data is any data described by schemas that is under the control
  2373. of an SQL-implementation in an SQL-environment.
  2374. Concepts 45
  2375. X3H2-92-154/DBL CBR-002
  2376. 4.15 SQL-environment
  2377. 4.15 SQL-environment
  2378. An SQL-environment comprises the following:
  2379. - an SQL-implementation capable of processing some Level (Entry
  2380. SQL, Intermediate SQL, or Full SQL) of this International
  2381. Standard and at least one binding style; see Clause 23,
  2382. "Conformance" for further information about binding styles;
  2383. - zero or more catalogs;
  2384. - zero or more <authorization identifier>s;
  2385. - zero or more <module>s; and
  2386. - the SQL-data described by the schemas in the catalogs.
  2387. An SQL-environment may have other implementation-defined contents.
  2388. The rules determining which <module>s are considered to be within
  2389. an SQL-environment are implementation-defined.
  2390. 4.16 Modules
  2391. A <module> is an object specified in the module language. A <mod-
  2392. ule> is either a persistent <module> or an SQL-session <module>.
  2393. The mechanisms by which <module>s are created or destroyed are
  2394. implementation-defined. A <module> consists of an optional <module
  2395. name>, a <language clause>, a <module authorization clause> with
  2396. either or both of a <module authorization identifier> and a <schema
  2397. name>, an optional <module character set specification> that iden-
  2398. tifies the character repertoire used for expressing the names of
  2399. schema objects used in the <module>, zero or more <temporary table
  2400. declaration>s, zero or more cursors specified by <declare cur-
  2401. sor>s, and one or more <procedure>s. All <identifier>s contained
  2402. in the <module> are expressed in either <SQL language character>
  2403. or the character repertoire indicated by <module character set
  2404. specification> unless they are specified with "<introducer>".
  2405. A compilation unit is a segment of executable code, possibly con-
  2406. sisting of one or more subprograms. A <module> is associated with
  2407. a compilation unit during its execution. A single <module> may be
  2408. associated with multiple compilation units and multiple <module>s
  2409. may be associated with a single compilation unit. The manner in
  2410. which this association is specified, including the possible re-
  2411. quirement for execution of some implementation-defined statement,
  2412. is implementation-defined. Whether a compilation unit may invoke or
  2413. transfer control to other compilation units, written in the same or
  2414. a different programming language, is implementation-defined.
  2415. 46 Database Language SQL
  2416. X3H2-92-154/DBL CBR-002
  2417. 4.17 Procedures
  2418. 4.17 Procedures
  2419. A <procedure> consists of a <procedure name>, a sequence of <pa-
  2420. rameter declaration>s, and a single <SQL procedure statement>.
  2421. A <procedure> in a <module> is invoked by a compilation unit as-
  2422. sociated with the <module> by means of a host language "call"
  2423. statement that specifies the <procedure name> of the <procedure>
  2424. and supplies a sequence of parameter values corresponding in number
  2425. and in <data type> to the <parameter declaration>s of the <proce-
  2426. dure>. A call of a <procedure> causes the <SQL procedure statement>
  2427. that it contains to be executed.
  2428. 4.18 Parameters
  2429. A parameter is declared in a <procedure> by a <parameter decla-
  2430. ration>. The <parameter declaration> specifies the <data type>
  2431. of its value. A parameter either assumes or supplies the value of
  2432. the corresponding argument in the call of that <procedure>. These
  2433. <data type>s map to host language types and are not nullable except
  2434. through the use of additional indicator variables.
  2435. 4.18.1 Status parameters
  2436. The SQLSTATE and SQLCODE parameters are status parameters. They
  2437. are set to status codes that indicate either that a call of the
  2438. <procedure> completed successfully or that an exception condition
  2439. was raised during execution of the <procedure>.
  2440. Note: The SQLSTATE parameter is the preferred status parameter. The
  2441. SQLCODE parameter is a deprecated feature that is supported for
  2442. compatibility with earlier versions of this International Standard.
  2443. See Annex D, "Deprecated features".
  2444. A <procedure> shall specify either the SQLSTATE parameter or the
  2445. SQLCODE parameter or both. The SQLSTATE parameter is a charac-
  2446. ter string parameter for which exception values are defined in
  2447. Clause 22, "Status codes". The SQLCODE parameter is an integer pa-
  2448. rameter for which the negative exception values are implementation-
  2449. defined.
  2450. If a condition is raised that causes a statement to have no effect
  2451. other than that associated with raising the condition (that is,
  2452. not a completion condition), then the condition is said to be an
  2453. exception condition or exception. If a condition is raised that
  2454. permits a statement to have an effect other than that associated
  2455. with raising the condition (corresponding to an SQLSTATE class
  2456. value of successful completion, warning, or no data), then the
  2457. condition is said to be a completion condition.
  2458. Concepts 47
  2459. X3H2-92-154/DBL CBR-002
  2460. 4.18 Parameters
  2461. 4.18.2 Data parameters
  2462. A data parameter is a parameter that is used to either assume or
  2463. supply the value of data exchanged between a host program and an
  2464. SQL-implementation.
  2465. 4.18.3 Indicator parameters
  2466. An indicator parameter is an integer parameter that is specified
  2467. immediately following another parameter. Its primary use is to
  2468. indicate whether the value that the other parameter assumes or
  2469. supplies is a null value. An indicator parameter cannot immediately
  2470. follow another indicator parameter.
  2471. The other use for indicator parameters is to indicate whether
  2472. string data truncation occurred during a transfer between a host
  2473. program and an SQL-implementation in parameters or host variables.
  2474. If a non-null string value is transferred and the length of the
  2475. target data item is sufficient to accept the entire source data
  2476. item, then the indicator parameter or variable is set to 0 to in-
  2477. dicate that truncation did not occur. However, if the length of
  2478. the target data item is insufficient, then the indicator parame-
  2479. ter or variable is set to the length of the source data item (in
  2480. characters or bits, as appropriate) to indicate that truncation
  2481. occurred and to indicate the original length in characters or bits,
  2482. as appropriate, of the source.
  2483. 4.19 Diagnostics area
  2484. The diagnostics area is a place where completion and exception con-
  2485. dition information is stored when an SQL-statement is executed.
  2486. There is one diagnostics area associated with an SQL-agent, regard-
  2487. less of the number of <module>s that the SQL-agent includes or the
  2488. number of connections in use.
  2489. At the beginning of the execution of any statement that is not an
  2490. <SQL diagnostics statement>, the diagnostics area is emptied. An
  2491. implementation shall place information about a completion condition
  2492. or an exception condition reported by SQLCODE or SQLSTATE into this
  2493. area. If other conditions are raised, an implementation may place
  2494. information about them into this area.
  2495. <procedure>s containing <SQL diagnostics statement>s return a code
  2496. indicating completion or exception conditions for that statement
  2497. via SQLCODE or SQLSTATE, but do not modify the diagnostics area.
  2498. An SQL-agent may choose the size of the diagnostics area with the
  2499. <set transaction statement>; if an SQL-agent does not specify the
  2500. size of the diagnostics area, then the size of the diagnostics
  2501. area is implementation-dependent, but shall always be able to hold
  2502. information about at least one condition. An implementation may
  2503. place information into this area about fewer conditions than are
  2504. specified. The ordering of the information about conditions placed
  2505. 48 Database Language SQL
  2506. X3H2-92-154/DBL CBR-002
  2507. 4.19 Diagnostics area
  2508. into the diagnostics area is implementation-dependent, except that
  2509. the first condition in the diagnostics area always corresponds to
  2510. the condition specified by the SQLSTATE or SQLCODE value.
  2511. 4.20 Standard programming languages
  2512. This International Standard specifies the actions of <procedure>s
  2513. in <module>s when those <procedure>s are called by programs that
  2514. conform to certain specified programming language standards. The
  2515. term "standard PLN program", where PLN is the name of a program-
  2516. ming language, refers to a program that conforms to the standard
  2517. for that programming language as specified in Clause 2, "Normative
  2518. references". This International Standard also specifies a mechanism
  2519. whereby SQL language may be embedded in programs that otherwise
  2520. conform to any of the same specified programming language stan-
  2521. dards.
  2522. Note: In this International Standard, for the purposes of inter-
  2523. facing with programming languages, the data types DATE, TIME,
  2524. TIMESTAMP, and INTERVAL shall be converted to or from character
  2525. strings in those programming languages by means of a <cast speci-
  2526. fication>. It is anticipated that future evolution of programming
  2527. language standards will support data types corresponding to these
  2528. four SQL data types; this standard will then be amended to reflect
  2529. the availability of those corresponding data types. The data type
  2530. CHARACTER is also mapped to character strings in the programming
  2531. languages. However, because the facilities available in the pro-
  2532. gramming languages do not provide the same capabilities as those
  2533. available in SQL, there shall be agreement between the host pro-
  2534. gram and SQL regarding the specific format of the character data
  2535. being exchanged. Specific syntax for this agreement is provided
  2536. in this International standard. For standard programming lan-
  2537. guages, C, COBOL, Fortran, and Pascal, bit strings are mapped to
  2538. character variables in the host language in a manner described in
  2539. Subclause 19.1, "<embedded SQL host program>". For standard pro-
  2540. gramming languages Ada and PL/I, bit string variables are directly
  2541. supported.
  2542. 4.21 Cursors
  2543. A cursor is specified by a <declare cursor>, <dynamic declare cur-
  2544. sor>, or <allocate cursor statement>.
  2545. For every <declare cursor> or <dynamic declare cursor> in a <mod-
  2546. ule>, a cursor is effectively created when an SQL-transaction (see
  2547. Subclause 4.28, "SQL-transactions") referencing the <module> is
  2548. initiated, and destroyed when that SQL-transaction is terminated. A
  2549. cursor is also effectively created when an <allocate cursor state-
  2550. ment> is executed within a SQL-transaction and destroyed when that
  2551. SQL-transaction is terminated. In addition, an extended dynamic
  2552. Concepts 49
  2553. X3H2-92-154/DBL CBR-002
  2554. 4.21 Cursors
  2555. cursor is destroyed when a <deallocate prepared statement> is exe-
  2556. cuted that deallocates the prepared statement on which the extended
  2557. dynamic cursor is based.
  2558. A cursor is in either the open state or the closed state. The ini-
  2559. tial state of a cursor is the closed state. A cursor is placed in
  2560. the open state by an <open statement> or <dynamic open statement>
  2561. and returned to the closed state by a <close statement> or <dynamic
  2562. close statement>, a <commit statement>, or a <rollback statement>.
  2563. A cursor in the open state identifies a table, an ordering of the
  2564. rows of that table, and a position relative to that ordering. If
  2565. the <declare cursor> does not include an <order by clause>, or
  2566. includes an <order by clause> that does not specify the order of
  2567. the rows completely, then the rows of the table have an order that
  2568. is defined only to the extent that the <order by clause> specifies
  2569. an order and is otherwise implementation-dependent.
  2570. When the ordering of a cursor is not defined by an <order by
  2571. clause>, the relative positions of two rows is implementation-
  2572. dependent. When the ordering of a cursor is partially determined
  2573. by an <order by clause>, then the relative positions of two rows
  2574. are determined only by the <order by clause>; if the two rows have
  2575. equal values for the purpose of evaluating the <order by clause>,
  2576. then their relative positions are implementation-dependent.
  2577. A cursor is either read-only or updatable. If the table identified
  2578. by a cursor is not updatable or if INSENSITIVE is specified for
  2579. the cursor, then the cursor is read-only; otherwise, the cursor is
  2580. updatable. The operations of update and delete are not allowed for
  2581. read-only cursors.
  2582. The position of a cursor in the open state is either before a cer-
  2583. tain row, on a certain row, or after the last row. If a cursor is
  2584. on a row, then that row is the current row of the cursor. A cursor
  2585. may be before the first row or after the last row of a table even
  2586. though the table is empty. When a cursor is initially opened, the
  2587. position of the cursor is before the first row.
  2588. A <fetch statement> or <dynamic fetch statement> positions an open
  2589. cursor on a specified row of the cursor's ordering and retrieves
  2590. the values of the columns of that row. An <update statement: po-
  2591. sitioned> or <dynamic update statement: positioned> updates the
  2592. current row of the cursor. A <delete statement: positioned> or <dy-
  2593. namic delete statement: positioned> deletes the current row of the
  2594. cursor.
  2595. If an error occurs during the execution of an SQL-statement that
  2596. identifies an open cursor, then, except where otherwise explic-
  2597. itly defined, the effect, if any, on the position or state of that
  2598. cursor is implementation-dependent.
  2599. If a cursor is open, and the current SQL-transaction makes a change
  2600. to SQL-data other than through that cursor, and the <declare cur-
  2601. sor> for that cursor specified INSENSITIVE, then the effect of
  2602. that change will not be visible through that cursor before it is
  2603. closed. Otherwise, whether the effect of such a change will be
  2604. 50 Database Language SQL
  2605. X3H2-92-154/DBL CBR-002
  2606. 4.21 Cursors
  2607. visible through that cursor before it is closed is implementation-
  2608. dependent.
  2609. 4.22 SQL-statements
  2610. 4.22.1 Classes of SQL-statements
  2611. An SQL-statement is a string of characters that conforms to the
  2612. format and syntax rules specified in this international standard.
  2613. Most SQL-statements can be prepared for execution and executed in
  2614. one of a number of ways. These are:
  2615. - in a <module>, in which case it is prepared when the <module>
  2616. is created (see Subclause 4.16, "Modules") and executed when the
  2617. containing procedure is called.
  2618. - in an embedded SQL host program, in which case it is pre-
  2619. pared when the embedded SQL host program is preprocessed (see
  2620. Subclause 4.23, "Embedded syntax").
  2621. - being prepared and executed by the use of SQL-dynamic statements
  2622. (which are themselves executed in one of the foregoing two ways-
  2623. see Subclause 4.24, "SQL dynamic statements").
  2624. - direct invocation, in which case it is effectively prepared
  2625. immediately prior to execution (see Subclause 4.25, "Direct
  2626. invocation of SQL").
  2627. There are at least five ways of classifying SQL-statements:
  2628. - According to their effect on SQL objects, whether persistent
  2629. objects, i.e., SQL-data and schemas, or transient objects, such
  2630. as SQL-sessions and other SQL-statements.
  2631. - According to whether or not they start a transaction, or can, or
  2632. must, be executed when no transaction is active.
  2633. - According to whether or not they may be embedded.
  2634. - According to whether they may be dynamically prepared and exe-
  2635. cuted.
  2636. - According to whether or not they may be directly executed.
  2637. This International Standard permits implementations to provide ad-
  2638. ditional, implementation-defined, statements that may fall into any
  2639. of these categories. This Subclause will not mention those state-
  2640. ments again, as their classification is entirely implementation-
  2641. defined.
  2642. Concepts 51
  2643. X3H2-92-154/DBL CBR-002
  2644. 4.22 SQL-statements
  2645. 4.22.2 SQL-statements classified by function
  2646. The following are the main classes of SQL-statements:
  2647. - SQL-schema statements; these may have a persistent effect on
  2648. schemas
  2649. - SQL-data statements; some of these, the SQL-data change state-
  2650. ments, may have a persistent effect on SQL-data
  2651. - SQL-transaction statements; except for the <commit statement>,
  2652. these, and the following classes, have no effects that persist
  2653. when a session is terminated
  2654. - SQL-connection statements
  2655. - SQL-session statements
  2656. - SQL-dynamic statements
  2657. - SQL-diagnostics statements
  2658. - SQL embedded exception declaration
  2659. The following are the SQL-schema statements:
  2660. - <schema definition>
  2661. - <drop schema statement>
  2662. - <domain definition>
  2663. - <drop domain statement>
  2664. - <table definition>
  2665. - <drop table statement>
  2666. - <view definition>
  2667. - <drop view statement>
  2668. - <assertion definition>
  2669. - <drop assertion statement>
  2670. - <alter table statement>
  2671. - <alter domain statement>
  2672. - <grant statement>
  2673. - <revoke statement>
  2674. - <character set definition>
  2675. - <drop character set statement>
  2676. 52 Database Language SQL
  2677. X3H2-92-154/DBL CBR-002
  2678. 4.22 SQL-statements
  2679. - <collation definition>
  2680. - <drop collation statement>
  2681. - <translation definition>
  2682. - <drop translation statement>
  2683. The following are the SQL-data statements:
  2684. - <temporary table declaration>
  2685. - <declare cursor>
  2686. - <dynamic declare cursor>
  2687. - <allocate cursor statement>
  2688. - <dynamic select statement>
  2689. - <open statement>
  2690. - <dynamic open statement>
  2691. - <close statement>
  2692. - <dynamic close statement>
  2693. - <fetch statement>
  2694. - <dynamic fetch statement>
  2695. - <select statement: single row>
  2696. - <direct select statement: multiple rows>
  2697. - <dynamic single row select statement>
  2698. - All SQL-data change statements
  2699. The following are the SQL-data change statements:
  2700. - <insert statement>
  2701. - <delete statement: searched>
  2702. - <delete statement: positioned>
  2703. - <dynamic delete statement: positioned>
  2704. - <preparable dynamic delete statement: positioned>
  2705. - <update statement: searched>
  2706. - <update statement: positioned>
  2707. - <dynamic update statement: positioned>
  2708. Concepts 53
  2709. X3H2-92-154/DBL CBR-002
  2710. 4.22 SQL-statements
  2711. - <preparable dynamic update statement: positioned>
  2712. The following are the SQL-transaction statements:
  2713. - <set transaction statement>
  2714. - <set constraints mode statement>
  2715. - <commit statement>
  2716. - <rollback statement>
  2717. The following are the SQL-connection statements:
  2718. - <connect statement>
  2719. - <set connection statement>
  2720. - <disconnect statement>
  2721. The following are the SQL-session statements:
  2722. - <set catalog statement>
  2723. - <set schema statement>
  2724. - <set names statement>
  2725. - <set session authorization identifier statement>
  2726. - <set local time zone statement>
  2727. The following are the SQL-dynamic statements:
  2728. - <execute immediate statement>
  2729. - <allocate descriptor statement>
  2730. - <deallocate descriptor statement>
  2731. - <get descriptor statement>
  2732. - <set descriptor statement>
  2733. - <prepare statement>
  2734. - <deallocate prepared statement>
  2735. - <describe input statement>
  2736. - <describe output statement>
  2737. - <execute statement>
  2738. The following is the SQL-diagnostics statement:
  2739. - <get diagnostics statement>
  2740. 54 Database Language SQL
  2741. X3H2-92-154/DBL CBR-002
  2742. 4.22 SQL-statements
  2743. The following is the SQL embedded exception declaration:
  2744. - <embedded exception declaration>
  2745. 4.22.3 Embeddable SQL-statements
  2746. The following SQL-statements are embeddable in an embedded SQL host
  2747. program, and may be the <SQL procedure statement> in a <procedure>
  2748. in a <module>:
  2749. - All SQL-schema statements
  2750. - All SQL-transaction statements
  2751. - All SQL-connection statements
  2752. - All SQL-session statements
  2753. - All SQL-dynamic statements
  2754. - All SQL-diagnostics statements
  2755. - The following SQL-data statements:
  2756. o <allocate cursor statement>
  2757. o <open statement>
  2758. o <dynamic open statement>
  2759. o <close statement>
  2760. o <dynamic close statement>
  2761. o <fetch statement>
  2762. o <dynamic fetch statement>
  2763. o <select statement: single row>
  2764. o <insert statement>
  2765. o <delete statement: searched>
  2766. o <delete statement: positioned>
  2767. o <dynamic delete statement: positioned>
  2768. o <update statement: searched>
  2769. o <update statement: positioned>
  2770. o <dynamic update statement: positioned>
  2771. Concepts 55
  2772. X3H2-92-154/DBL CBR-002
  2773. 4.22 SQL-statements
  2774. The following SQL-statements are embeddable in an embedded SQL host
  2775. program, and may occur in a <module>, though not in a <procedure>:
  2776. - <temporary table declaration>
  2777. - <declare cursor>
  2778. - <dynamic declare cursor>
  2779. The following SQL-statements are embeddable in an embedded SQL host
  2780. program, but may not occur in a <module>:
  2781. - SQL embedded exception declarations
  2782. Consequently, the following SQL-data statements are not embeddable
  2783. in an embedded SQL host program, nor may they occur in a <mod-
  2784. ule>, nor be the <SQL procedure statement> in a <procedure> in a
  2785. <module>:
  2786. - <dynamic select statement>
  2787. - <dynamic single row select statement>
  2788. - <direct select statement: multiple rows>
  2789. - <preparable dynamic delete statement: positioned>
  2790. - <preparable dynamic update statement: positioned>
  2791. 4.22.4 Preparable and immediately executable SQL-statements
  2792. The following SQL-statements are preparable:
  2793. - All SQL-schema statements
  2794. - All SQL-transaction statements
  2795. - All SQL-session statements
  2796. - The following SQL-data statements:
  2797. o <delete statement: searched>
  2798. o <dynamic select statement>
  2799. o <dynamic single row select statement>
  2800. o <insert statement>
  2801. o <update statement: searched>
  2802. o <preparable dynamic delete statement: positioned>
  2803. o <preparable dynamic update statement: positioned>
  2804. o <preparable implementation-defined statement>
  2805. 56 Database Language SQL
  2806. X3H2-92-154/DBL CBR-002
  2807. 4.22 SQL-statements
  2808. Consequently, the following SQL-statements are not preparable:
  2809. - All SQL-connection statements
  2810. - All SQL-dynamic statements
  2811. - All SQL-diagnostics statements
  2812. - SQL embedded exception declarations
  2813. - The following SQL-data statements:
  2814. o <allocate cursor statement>
  2815. o <open statement>
  2816. o <dynamic open statement>
  2817. o <close statement>
  2818. o <dynamic close statement>
  2819. o <fetch statement>
  2820. o <dynamic fetch statement>
  2821. o <select statement: single row>
  2822. o <delete statement: positioned>
  2823. o <dynamic delete statement: positioned>
  2824. o <update statement: positioned>
  2825. o <dynamic update statement: positioned>
  2826. o <direct select statement: multiple rows>
  2827. o <temporary table declaration>
  2828. o <declare cursor>
  2829. o <dynamic declare cursor>
  2830. Any preparable SQL-statement can be executed immediately, with the
  2831. exception of:
  2832. - <dynamic select statement>
  2833. - <dynamic single row select statement>
  2834. Concepts 57
  2835. X3H2-92-154/DBL CBR-002
  2836. 4.22 SQL-statements
  2837. 4.22.5 Directly executable SQL-statements
  2838. The following SQL-statements may be executed directly:
  2839. - All SQL-schema statements
  2840. - All SQL-transaction statements
  2841. - All SQL-connection statements
  2842. - All SQL-session statements
  2843. - The following SQL-data statements:
  2844. o <temporary table declaration>
  2845. o <direct select statement: multiple rows>
  2846. o <insert statement>
  2847. o <delete statement: searched>
  2848. o <update statement: searched>
  2849. Consequently, the following SQL-statements may not be executed
  2850. directly:
  2851. - All SQL-dynamic statements
  2852. - All SQL-diagnostics statements
  2853. - SQL embedded exception declarations
  2854. - The following SQL-data statements:
  2855. o <declare cursor>
  2856. o <dynamic declare cursor>
  2857. o <allocate cursor statement>
  2858. o <open statement>
  2859. o <dynamic open statement>
  2860. o <close statement>
  2861. o <dynamic close statement>
  2862. o <fetch statement>
  2863. o <dynamic fetch statement>
  2864. o <select statement: single row>
  2865. o <dynamic select statement>
  2866. o <dynamic single row select statement>
  2867. 58 Database Language SQL
  2868. X3H2-92-154/DBL CBR-002
  2869. 4.22 SQL-statements
  2870. o <delete statement: positioned>
  2871. o <dynamic delete statement: positioned>
  2872. o <preparable dynamic delete statement: positioned>
  2873. o <update statement: positioned>
  2874. o <dynamic update statement: positioned>
  2875. o <preparable dynamic update statement: positioned>
  2876. 4.22.6 SQL-statements and transaction states
  2877. Whether an <execute immediate statement> starts a transaction de-
  2878. pends on what SQL-statement is the value of <SQL statement vari-
  2879. able>. Whether an <execute statement> starts a transaction depends
  2880. on what SQL-statement was the value of <SQL statement variable>
  2881. when the prepared statement identified by <SQL statement name> was
  2882. prepared.
  2883. The following SQL-statements are transaction initiating SQL-
  2884. statements, i.e., if there is no current transaction, and a state-
  2885. ment of this class is executed, a transaction is initiated:
  2886. - All SQL-schema statements
  2887. - The following SQL-data statements:
  2888. o <allocate cursor statement>
  2889. o <dynamic select statement>
  2890. o <open statement>
  2891. o <dynamic open statement>
  2892. o <close statement>
  2893. o <dynamic close statement>
  2894. o <fetch statement>
  2895. o <dynamic fetch statement>
  2896. o <select statement: single row>
  2897. o <direct select statement: multiple rows>
  2898. o <dynamic single row select statement>
  2899. o <insert statement>
  2900. o <delete statement: searched>
  2901. o <delete statement: positioned>
  2902. Concepts 59
  2903. X3H2-92-154/DBL CBR-002
  2904. 4.22 SQL-statements
  2905. o <dynamic delete statement: positioned>
  2906. o <preparable dynamic delete statement: positioned>
  2907. o <update statement: searched>
  2908. o <update statement: positioned>
  2909. o <dynamic update statement: positioned>
  2910. o <preparable dynamic update statement: positioned>
  2911. - The following SQL-dynamic statements:
  2912. o <describe input statement>
  2913. o <describe output statement>
  2914. o <allocate descriptor statement>
  2915. o <deallocate descriptor statement>
  2916. o <get descriptor statement>
  2917. o <set descriptor statement>
  2918. o <prepare statement>
  2919. o <deallocate prepared statement>
  2920. The following SQL-statements are not transaction initiating SQL-
  2921. statements, i.e., if there is no current transaction, and a state-
  2922. ment of this class is executed, no transaction is initiated.
  2923. - All SQL-transaction statements
  2924. - All SQL-connection statements
  2925. - All SQL-session statements
  2926. - All SQL-diagnostics statements
  2927. - SQL embedded exception declarations
  2928. - The following SQL-data statements:
  2929. o <temporary table declaration>
  2930. o <declare cursor>
  2931. o <dynamic declare cursor>
  2932. o <dynamic select statement>
  2933. 60 Database Language SQL
  2934. X3H2-92-154/DBL CBR-002
  2935. 4.23 Embedded syntax
  2936. 4.23 Embedded syntax
  2937. An <embedded SQL host program> (<embedded SQL Ada program>, <em-
  2938. bedded SQL C program>, <embedded SQL COBOL program>, <embedded
  2939. SQL Fortran program>, <embedded SQL MUMPS program>, <embedded SQL
  2940. Pascal program>, or <embedded SQL PL/I program>) is a compilation
  2941. unit that consists of programming language text and SQL text. The
  2942. programming language text shall conform to the requirements of a
  2943. specific standard programming language. The SQL text shall con-
  2944. sist of one or more <embedded SQL statement>s and, optionally,
  2945. one or more <embedded SQL declare section>s, as defined in this
  2946. International Standard. This allows database applications to be
  2947. expressed in a hybrid form in which SQL-statements are embedded
  2948. directly in a compilation unit. Such a hybrid compilation unit is
  2949. defined to be equivalent to a standard compilation unit in which
  2950. the SQL-statements have been replaced by standard procedure or
  2951. subroutine calls of SQL <procedure>s in a separate SQL <module>,
  2952. and in which each <embedded SQL begin declare> and each <embedded
  2953. SQL end declare> has been removed and the declarations contained
  2954. therein have been suitably transformed into standard host-language
  2955. syntax.
  2956. An implementation may reserve a portion of the name space in the
  2957. <embedded SQL host program> for the names of procedures or subrou-
  2958. tines that are generated to replace SQL-statements and for program
  2959. variables and branch labels that may be generated as required to
  2960. support the calling of these procedures or subroutines; whether
  2961. this reservation is made is implementation-defined. They may sim-
  2962. ilarly reserve name space for the <module name> and <procedure
  2963. name>s of the generated <module> that may be associated with the
  2964. resulting standard compilation unit. The portion of the name space
  2965. to be so reserved, if any, is implementation-defined.
  2966. 4.24 SQL dynamic statements
  2967. In many cases, the SQL-statement to be executed can be coded into
  2968. a <module> or into a compilation unit using the embedded syntax.
  2969. In other cases, the SQL-statement is not known when the program
  2970. is written and will be generated during program execution. An
  2971. <execute immediate statement> can be used for a one-time prepa-
  2972. ration and execution of an SQL-statement. A <prepare statement>
  2973. is used to prepare the generated SQL-statement for subsequent ex-
  2974. ecution. A <deallocate prepared statement> is used to deallocate
  2975. SQL-statements that have been prepared with a <prepare statement>.
  2976. A description of the input parameters for a prepared statement
  2977. can be obtained by execution of a <describe input statement>. A
  2978. description of the resultant columns of a <dynamic select state-
  2979. ment> or <dynamic single row select statement> can be obtained by
  2980. execution of a <describe output statement>. For a statement other
  2981. than a <dynamic select statement>, an <execute statement> is used
  2982. to associate parameters with the prepared statement and execute
  2983. Concepts 61
  2984. X3H2-92-154/DBL CBR-002
  2985. 4.24 SQL dynamic statements
  2986. it as though it had been coded when the program was written. For a
  2987. <dynamic select statement>, the prepared <cursor specification> is
  2988. associated with a cursor via a <dynamic declare cursor> or <allo-
  2989. cate cursor statement>. The cursor can be opened and parameters can
  2990. be associated with the cursor with a <dynamic open statement>. A
  2991. <dynamic fetch statement> positions an open cursor on a specified
  2992. row and retrieves the values of the columns of that row. A <dynamic
  2993. close statement> closes a cursor that was opened with a <dynamic
  2994. open statement>. A <dynamic delete statement: positioned> is used
  2995. to delete rows through a dynamic cursor. A <dynamic update state-
  2996. ment: positioned> is used to update rows through a dynamic cursor.
  2997. A <preparable dynamic delete statement: positioned> is used to
  2998. delete rows through a dynamic cursor when the precise format of the
  2999. statement isn't known until runtime. A <preparable dynamic update
  3000. statement: positioned> is used to update rows through a dynamic
  3001. cursor when the precise format of the statement isn't known until
  3002. runtime.
  3003. The interface for input parameters for a prepared statement and
  3004. for the resulting values from a <dynamic fetch statement> or the
  3005. execution of a prepared <dynamic single row select statement> can
  3006. be either a list of parameters or embedded variables or an SQL
  3007. descriptor area. An SQL descriptor area consists of zero or more
  3008. item descriptor areas, together with a COUNT of the number of those
  3009. item descriptor areas. Each item descriptor area consists of the
  3010. fields specified in Table 17, "Data types of <key word>s used in
  3011. SQL item descriptor areas", in Subclause 17.1, "Description of SQL
  3012. item descriptor areas". The SQL descriptor area is allocated and
  3013. maintained by the system with the following statements: <allocate
  3014. descriptor statement>, <deallocate descriptor statement>, <set
  3015. descriptor statement>, and <get descriptor statement>.
  3016. An SQL descriptor area is identified by a <descriptor name>, which
  3017. is a <simple value specification> whose value is an <identifier>.
  3018. Two <descriptor name>s identify the same SQL descriptor area if
  3019. their values, with leading and trailing <space>s removed, are
  3020. equivalent according to the rules for <identifier> comparisons
  3021. in Subclause 5.2, "<token> and <separator>".
  3022. Dynamic statements can be identified by <statement name>s or by
  3023. <extended statement name>s. Similarly, dynamic cursors can be
  3024. identified by <cursor name>s and by <extended cursor name>s. The
  3025. non-extended names are <identifier>s. The extended names are <tar-
  3026. get specification>s whose values are <identifier>s used to iden-
  3027. tify the statement or cursor. Two extended names are equivalent
  3028. if their values, with leading and trailing <space>s removed, are
  3029. equivalent according to the rules for <identifier> comparison in
  3030. Subclause 5.2, "<token> and <separator>".
  3031. An SQL descriptor area name may be defined as global or local.
  3032. Similarly, an extended statement name or extended cursor name may
  3033. be global or local. The scope of a global name is the SQL-session.
  3034. The scope of a local name is the <module> in which it appears. A
  3035. reference to an entity in which one specifies a global scope is
  3036. valid only if the entity was defined as global and if the reference
  3037. 62 Database Language SQL
  3038. X3H2-92-154/DBL CBR-002
  3039. 4.24 SQL dynamic statements
  3040. is from the same SQL-session in which it was defined. A reference
  3041. to an entity in which one specifies a local scope is valid only if
  3042. the entity was defined as local and if the reference is from the
  3043. same <module> in which it was defined. (The scope of non-extended
  3044. statement names and non-extended cursor names is always local.)
  3045. Within an SQL-session, all global prepared statements (prepared
  3046. statements with global statement names) belong to the SQL-session
  3047. <module>. Within an SQL-session, each local prepared statement
  3048. (prepared statements with local statement names) belongs to the
  3049. <module> that contains the <prepare statement> or <execute immedi-
  3050. ate statement> with which it is prepared.
  3051. Note: The SQL-session <module> is defined in Subclause 4.30, "SQL-
  3052. sessions".
  3053. Dynamic execution of SQL-statements can generally be accomplished
  3054. in two different ways. Statements can be prepared for execution
  3055. and then later executed one or more times; when the statement is
  3056. no longer needed for execution, it can be released by the use of
  3057. a <deallocate prepared statement>. Alternatively, a statement that
  3058. is needed only once can be executed without the preparation step-it
  3059. can be executed immediately (not all SQL-statements can be executed
  3060. immediately).
  3061. Many SQL-statements can be written to use "parameters" (which are
  3062. manifested in static execution of SQL-statements as <parameters>
  3063. in <SQL statement>s contained in <procedure>s in <module>s or as
  3064. <embedded variable name>s in <SQL statement>s contained in <em-
  3065. bedded SQL host program>s). In SQL-statements that are executed
  3066. dynamically, the parameters are called dynamic parameters (<dynamic
  3067. parameter specification>s) and are represented in SQL language by a
  3068. <question mark> (?).
  3069. In many situations, an application that generates an SQL-statement
  3070. for dynamic execution knows in detail the required characteristics
  3071. (e.g., <data type>, <length>, <precision>, <scale>, etc.) of each
  3072. of the dynamic parameters used in the statement; similarly, the ap-
  3073. plication may also know in detail the characteristics of the values
  3074. that will be returned by execution of the statement. However, in
  3075. other cases, the application may not know this information to the
  3076. required level of detail; it is possible in some cases for the ap-
  3077. plication to ascertain the information from the Information Schema,
  3078. but in other cases (e.g., when a returned value is derived from
  3079. a computation instead of simply from a column in a table, or when
  3080. dynamic parameters are supplied) this information is not gener-
  3081. ally available except in the context of preparing the statement for
  3082. execution.
  3083. To provide the necessary information to applications, SQL per-
  3084. mits an application to request the database system to describe a
  3085. prepared statement. The description of a statement identifies the
  3086. number of dynamic parameters (describe input) and their data type
  3087. information or it identifies the number of values to be returned
  3088. Concepts 63
  3089. X3H2-92-154/DBL CBR-002
  3090. 4.24 SQL dynamic statements
  3091. (describe output) and their data type information. The descrip-
  3092. tion of a statement is placed into the SQL descriptor areas already
  3093. mentioned.
  3094. Many, but not all, SQL-statements can be prepared and executed
  3095. dynamically.
  3096. Note: The complete list of statements that may be dynamically pre-
  3097. pared and executed is defined in Subclause 4.22.4, "Preparable and
  3098. immediately executable SQL-statements".
  3099. Certain "set statements" (<set catalog statement>, <set schema
  3100. statement>, and <set names statement>) have no effect other than
  3101. to set up default information (<catalog name>, <schema name>,
  3102. and <character set>, respectively) to be applied to other SQL-
  3103. statements that are prepared or executed immediately or that are
  3104. invoked directly.
  3105. Syntax errors and Access Rule violations caused by the preparation
  3106. or immediate execution of <preparable statement>s are identi-
  3107. fied when the statement is prepared (by <prepare statement>) or
  3108. when it is executed (by <execute statement> or <execute immediate
  3109. statement>); such violations are indicated by the raising of an
  3110. exception condition.
  3111. 4.25 Direct invocation of SQL
  3112. Direct invocation of SQL is a mechanism for executing direct SQL-
  3113. statements, known as <direct SQL statement>s. In direct invocation
  3114. of SQL, the method of invoking <direct SQL statement>s, the method
  3115. of raising conditions that result from the execution of <direct SQL
  3116. statement>s, the method of accessing the diagnostics information
  3117. that results from the execution of <direct SQL statement>s, and the
  3118. method of returning the results are implementation-defined.
  3119. 4.26 Privileges
  3120. A privilege authorizes a given category of <action> to be per-
  3121. formed on a specified base table, view, column, domain, character
  3122. set, collation, or translation by a specified <authorization iden-
  3123. tifier>. The mapping of <authorization identifier>s to operating
  3124. system users is implementation-dependent. The <action>s that can be
  3125. specified are:
  3126. - INSERT
  3127. - INSERT (<column name list>)
  3128. - UPDATE
  3129. - UPDATE (<column name list>)
  3130. - DELETE
  3131. 64 Database Language SQL
  3132. X3H2-92-154/DBL CBR-002
  3133. 4.26 Privileges
  3134. - SELECT
  3135. - REFERENCES
  3136. - REFERENCES (<column name list>)
  3137. - USAGE
  3138. An <authorization identifier> is specified for each <schema defini-
  3139. tion> and <module> as well as for each SQL-session.
  3140. A schema that is owned by a given <authorization identifier> may
  3141. contain privilege descriptors that describe privileges granted to
  3142. other <authorization identifier>s (grantees). The granted priv-
  3143. ileges apply to objects defined in the current schema. The WITH
  3144. GRANT OPTION clause of a <grant statement> specifies whether the
  3145. recipient of a privilege (acting as a grantor) may grant it to
  3146. others.
  3147. When an SQL-session is initiated, the <authorization identifier>
  3148. for the SQL-session, called the SQL-session <authorization identi-
  3149. fier>, is determined in an implementation-dependent manner, unless
  3150. the session is initiated using a <connect statement>. Subsequently,
  3151. the SQL-session <authorization identifier> can be redefined by the
  3152. successful execution of a <set session authorization identifier
  3153. statement>.
  3154. A <module> may specify an <authorization identifier>, called a
  3155. <module authorization identifier>. If the <module authorization
  3156. identifier> is specified, then that <module authorization iden-
  3157. tifier> is used as the current <authorization identifier> for the
  3158. execution of all <procedure>s in the <module>. If the <module au-
  3159. thorization identifier> is not specified, then the SQL-session
  3160. <authorization identifier> is used as the current <authorization
  3161. identifier> for the execution of each <procedure> in the <module>.
  3162. A <schema definition> may specify an <authorization identifier>,
  3163. called a <schema authorization identifier>. If the <schema autho-
  3164. rization identifier> is specified, then that is used as the current
  3165. <authorization identifier> for the creation of the schema. If the
  3166. <module authorization identifier> is not specified, then the <mod-
  3167. ule authorization identifier> or the SQL-session <authorization
  3168. identifier> is used as the current <authorization identifier> for
  3169. the creation of the schema.
  3170. The current <authorization identifier> determines the privileges
  3171. for the execution of each SQL-statement. For direct SQL, the SQL-
  3172. session <authorization identifier> is always the current <autho-
  3173. rization identifier>.
  3174. Each privilege is represented by a privilege descriptor. A privi-
  3175. lege descriptor contains:
  3176. - the identification of the table, column, domain, character set,
  3177. collation, or translation that the descriptor describes;
  3178. - the <authorization identifier> of the grantor of the privilege;
  3179. Concepts 65
  3180. X3H2-92-154/DBL CBR-002
  3181. 4.26 Privileges
  3182. - the <authorization identifier> of the grantee of the privilege;
  3183. - identification of the action that the privilege allows; and
  3184. - an indication of whether or not the privilege is grantable.
  3185. A privilege descriptor with an action of INSERT, UPDATE, DELETE,
  3186. SELECT, or REFERENCES is called a table privilege descriptor and
  3187. identifies the existence of a privilege on the table identified by
  3188. the privilege descriptor.
  3189. A privilege descriptor with an action of SELECT (<column name
  3190. list>), INSERT (<column name list>), UPDATE (<column name list>),
  3191. or REFERENCES (<column name list>) is called a column privilege de-
  3192. scriptor and identifies the existence of a privilege on the column
  3193. in the table identified by the privilege descriptor.
  3194. Note: In this International Standard, a SELECT column privilege
  3195. cannot be explicitly granted or revoked. However, for the sake
  3196. of compatibility with planned future language extensions, SELECT
  3197. column privilege descriptors will appear in the Information Schema.
  3198. A table privilege descriptor specifies that the privilege iden-
  3199. tified by the action (unless the action is DELETE) is to be au-
  3200. tomatically granted by the grantor to the grantee on all columns
  3201. subsequently added to the table.
  3202. A privilege descriptor with an action of USAGE is called a usage
  3203. privilege descriptor and identifies the existence of a privilege on
  3204. the domain, character set, collation, or translation identified by
  3205. the privilege descriptor.
  3206. A grantable privilege is a privilege associated with a schema that
  3207. may be granted by a <grant statement>.
  3208. The phrase applicable privileges refers to the privileges defined
  3209. by the privilege descriptors that define privileges granted to the
  3210. current <authorization identifier>.
  3211. The set of applicable privileges for the current <authorization
  3212. identifier> consists of the privileges defined by the privilege
  3213. descriptors associated with that <authorization identifier> and
  3214. the privileges defined by the privilege descriptors associated with
  3215. PUBLIC.
  3216. Privilege descriptors that represent privileges for the owner of
  3217. an object have a special grantor value, "_SYSTEM". This value is
  3218. reflected in the Information Schema for all privileges that apply
  3219. to the owner of the object.
  3220. 4.27 SQL-agents
  3221. An SQL-agent is an implementation-dependent entity that causes the
  3222. execution of SQL-statements.
  3223. 66 Database Language SQL
  3224. X3H2-92-154/DBL CBR-002
  3225. 4.28 SQL-transactions
  3226. 4.28 SQL-transactions
  3227. An SQL-transaction (sometimes simply called a "transaction") is
  3228. a sequence of executions of SQL-statements that is atomic with
  3229. respect to recovery. These operations are performed by one or more
  3230. compilation units and <module>s or by the direct invocation of SQL.
  3231. It is implementation-defined whether or not the non-dynamic or
  3232. dynamic execution of an SQL-data statement or the execution of
  3233. an <SQL dynamic data statement> is permitted to occur within the
  3234. same SQL-transaction as the non-dynamic or dynamic execution of
  3235. an SQL-schema statement. If it does occur, then the effect on any
  3236. open cursor, prepared dynamic statement, or deferred constraint
  3237. is implementation-defined. There may be additional implementation-
  3238. defined restrictions, requirements, and conditions. If any such
  3239. restrictions, requirements, or conditions are violated, then an
  3240. implementation-defined exception condition or a completion con-
  3241. dition warning with an implementation-defined subclass code is
  3242. raised.
  3243. Each <module> or direct invocation of SQL that executes an
  3244. SQL-statement of an SQL-transaction is associated with that
  3245. SQL-transaction. An SQL-transaction is initiated when no SQL-
  3246. transaction is currently active and a <procedure> is called that
  3247. results in the execution of a transaction-initiating SQL-statement
  3248. or by direct invocation of SQL that results in the execution of a
  3249. transaction-initiating <direct SQL statement>. An SQL-transaction
  3250. is terminated by a <commit statement> or a <rollback statement>.
  3251. If an SQL-transaction is terminated by successful execution of a
  3252. <commit statement>, then all changes made to SQL-data or schemas by
  3253. that SQL-transaction are made persistent and accessible to all con-
  3254. current and subsequent SQL-transactions. If an SQL-transaction is
  3255. terminated by a <rollback statement> or unsuccessful execution of
  3256. a <commit statement>, then all changes made to SQL-data or schemas
  3257. by that SQL-transaction are canceled. Committed changes cannot be
  3258. canceled. If execution of a <commit statement> is attempted, but
  3259. certain exception conditions are raised, it is unknown whether or
  3260. not the changes made to SQL-data or schemas by that SQL-transaction
  3261. are canceled or made persistent.
  3262. An SQL-transaction has a constraint mode for each integrity con-
  3263. straint. The constraint mode for an integrity constraint in an
  3264. SQL-transaction is described in Subclause 4.10, "Integrity con-
  3265. straints".
  3266. An SQL-transaction has an access mode that is either read-only or
  3267. read-write. The access mode may be explicitly set by a <set trans-
  3268. action statement>; otherwise, it is implicitly set to read-write.
  3269. The term read-only applies only to viewed tables and persistent
  3270. base tables.
  3271. An SQL-transaction has a diagnostics area limit, which is a pos-
  3272. itive integer that specifies the maximum number of conditions
  3273. that can be placed in the diagnostics area during execution of
  3274. an SQL-statement in this SQL-transaction.
  3275. Concepts 67
  3276. X3H2-92-154/DBL CBR-002
  3277. 4.28 SQL-transactions
  3278. SQL-transactions initiated by different SQL-agents that access
  3279. the same SQL-data or schemas and overlap in time are concurrent
  3280. SQL-transactions.
  3281. An SQL-transaction has an isolation level that is READ UNCOMMITTED,
  3282. READ COMMITTED, REPEATABLE READ, or SERIALIZABLE. The isolation
  3283. level of an SQL-transaction defines the degree to which the opera-
  3284. tions on SQL-data or schemas in that SQL-transaction are affected
  3285. by the effects of and can affect operations on SQL-data or schemas
  3286. in concurrent SQL-transactions. The isolation level of a SQL-
  3287. transaction is SERIALIZABLE by default. The level can be explicitly
  3288. set by the <set transaction statement>.
  3289. The execution of concurrent SQL-transactions at isolation level
  3290. SERIALIZABLE is guaranteed to be serializable. A serializable exe-
  3291. cution is defined to be an execution of the operations of concur-
  3292. rently executing SQL-transactions that produces the same effect as
  3293. some serial execution of those same SQL-transactions. A serial exe-
  3294. cution is one in which each SQL-transaction executes to completion
  3295. before the next SQL-transaction begins.
  3296. The isolation level specifies the kind of phenomena that can occur
  3297. during the execution of concurrent SQL-transactions. The following
  3298. phenomena are possible:
  3299. 1) P1 ("Dirty read"): SQL-transaction T1 modifies a row. SQL-
  3300. transaction T2 then reads that row before T1 performs a COMMIT.
  3301. If T1 then performs a ROLLBACK, T2 will have read a row that was
  3302. never committed and that may thus be considered to have never
  3303. existed.
  3304. 2) P2 ("Non-repeatable read"): SQL-transaction T1 reads a row. SQL-
  3305. transaction T2 then modifies or deletes that row and performs
  3306. a COMMIT. If T1 then attempts to reread the row, it may receive
  3307. the modified value or discover that the row has been deleted.
  3308. 3) P3 ("Phantom"): SQL-transaction T1 reads the set of rows N
  3309. that satisfy some <search condition>. SQL-transaction T2 then
  3310. executes SQL-statements that generate one or more rows that
  3311. satisfy the <search condition> used by SQL-transaction T1. If
  3312. SQL-transaction T1 then repeats the initial read with the same
  3313. <search condition>, it obtains a different collection of rows.
  3314. The four isolation levels guarantee that each SQL-transaction will
  3315. be executed completely or not at all, and that no updates will be
  3316. lost. The isolation levels are different with respect to phenomena
  3317. P1, P2, and P3. Table 9, "SQL-transaction isolation levels and the
  3318. three phenomena" specifies the phenomena that are possible and not
  3319. possible for a given isolation level.
  3320. 68 Database Language SQL
  3321. X3H2-92-154/DBL CBR-002
  3322. 4.28 SQL-transactions
  3323. __Table_9-SQL-transaction_isolation_levels_and_the_three_phenomena_
  3324. _Level__________________P1______P2_______P3________________________
  3325. | READ UNCOMMITTED | Possib|e Possib|e Possible |
  3326. | | | | |
  3327. | READ COMMITTED | Not | Possibl| Possible |
  3328. Possible
  3329. | REPEATABLE READ | Not | Not | Possible |
  3330. | | Possib|e Possib|e |
  3331. | | | | |
  3332. | SERIALIZABLE | Not | Not | Not Possible |
  3333. |______________________|_Possib|e_Possib|e_________________________|
  3334. | | | | |
  3335. |Note: The exclusion of|these p|enomena |or SQL-transactions ex- |
  3336. ecuting at isolation level SERIALIZABLE is a consequence of the
  3337. requirement that such transactions be serializable.
  3338. Changes made to SQL-data or schemas by an SQL-transaction in an
  3339. SQL-session may be perceived by that SQL-transaction in that
  3340. same SQL-session, and by other SQL-transactions, or by that same
  3341. SQL-transaction in other SQL-sessions, at isolation level READ
  3342. UNCOMMITTED, but cannot be perceived by other SQL-transactions at
  3343. isolation level READ COMMITTED, REPEATABLE READ, or SERIALIZABLE
  3344. until the former SQL-transaction terminates with a <commit state-
  3345. ment>.
  3346. Regardless of the isolation level of the SQL-transaction, phenomena
  3347. P1, P2, and P3 shall not occur during the implied reading of schema
  3348. definitions performed on behalf of executing an SQL-statement, the
  3349. checking of integrity constraints, and the execution of referen-
  3350. tial actions associated with referential constraints. The schema
  3351. definitions that are implicitly read are implementation-dependent.
  3352. This does not affect the explicit reading of rows from tables in
  3353. the Information Schema, which is done at the isolation level of the
  3354. SQL-transaction.
  3355. The execution of a <rollback statement> may be initiated implicitly
  3356. by an implementation when it detects the inability to guarantee the
  3357. serializability of two or more concurrent SQL-transactions. When
  3358. this error occurs, an exception condition is raised: transaction
  3359. rollback-serialization failure.
  3360. The execution of a <rollback statement> may be initiated implicitly
  3361. by an implementation when it detects unrecoverable errors. When
  3362. such an error occurs, an exception condition is raised: transaction
  3363. rollback with an implementation-defined subclass code.
  3364. The execution of an SQL-statement within an SQL-transaction has
  3365. no effect on SQL-data or schemas other than the effect stated in
  3366. the General Rules for that SQL-statement, in the General Rules
  3367. for Subclause 11.8, "<referential constraint definition>", and
  3368. in the General Rules for Subclause 12.3, "<procedure>". Together
  3369. with serializable execution, this implies that all read opera-
  3370. tions are repeatable within an SQL-transaction at isolation level
  3371. SERIALIZABLE, except for:
  3372. Concepts 69
  3373. X3H2-92-154/DBL CBR-002
  3374. 4.28 SQL-transactions
  3375. 1) the effects of changes to SQL-data or schemas and its contents
  3376. made explicitly by the SQL-transaction itself,
  3377. 2) the effects of differences in parameter values supplied to pro-
  3378. cedures, and
  3379. 3) the effects of references to time-varying system variables such
  3380. as CURRENT_DATE and CURRENT_USER.
  3381. In some environments (e.g., remote database access), an SQL-
  3382. transaction can be part of an encompassing transaction that is
  3383. controlled by an agent other than the SQL-agent. The encompass-
  3384. ing transaction may involve different resource managers, the
  3385. SQL-environment being just one instance of such a manager. In
  3386. such environments, an encompassing transaction shall be ter-
  3387. minated via that other agent, which in turn interacts with the
  3388. SQL-environment via an interface that may be different from SQL
  3389. (COMMIT or ROLLBACK), in order to coordinate the orderly termi-
  3390. nation of the encompassing transaction. When an SQL-transaction
  3391. is part of an encompassing transaction that is controlled by an
  3392. agent other than an SQL-agent and a <rollback statement> is ini-
  3393. tiated implicitly by an implementation, then the implementation
  3394. will interact with that other agent to terminate that encompassing
  3395. transaction. The specification of the interface between such agents
  3396. and the SQL-environment is beyond the scope of this International
  3397. Standard. However, it is important to note that the semantics of an
  3398. SQL-transaction remain as defined in the following sense:
  3399. - When an agent that is different from the SQL-agent requests
  3400. the SQL-environment to rollback an SQL-transaction, the General
  3401. Rules of Subclause 14.4, "<rollback statement>", are performed.
  3402. - When such an agent requests the SQL-environment to commit an
  3403. SQL-transaction, the General Rules of Subclause 14.3, "<commit
  3404. statement>", are performed. To guarantee orderly termination
  3405. of the encompassing transaction, this commit operation may be
  3406. processed in several phases not visible to the application; not
  3407. all the General Rules of Subclause 14.3, "<commit statement>",
  3408. need to be executed in a single phase.
  3409. However, even in such environments, the SQL-agent interacts di-
  3410. rectly with the SQL-server to set attributes (such as read-only
  3411. or read-write, isolation level, and constraints mode) that are
  3412. specific to the SQL-transaction model.
  3413. 4.29 SQL-connections
  3414. An SQL-connection is an association between an SQL-client and an
  3415. SQL-server. An SQL-connection may be established and named by a
  3416. <connect statement>, which identifies the desired SQL-server by
  3417. means of an <SQL-server name>. A <connection name> is specified
  3418. 70 Database Language SQL
  3419. X3H2-92-154/DBL CBR-002
  3420. 4.29 SQL-connections
  3421. as a <simple value specification> whose value is an <identi-
  3422. fier>. Two <connection name>s identify the same SQL-connection
  3423. if their values, with leading and trailing <space>s removed, are
  3424. equivalent according to the rules for <identifier> comparison in
  3425. Subclause 5.2, "<token> and <separator>". It is implementation-
  3426. defined how an implementation uses <SQL-server name> to determine
  3427. the location, identity, and communication protocol required to
  3428. access the SQL-server and create an SQL-session.
  3429. An SQL-connection is an active SQL-connection if any SQL-statement
  3430. that initiates or requires an SQL-transaction has been executed at
  3431. its SQL-server during the current SQL-transaction.
  3432. An SQL-connection is either current or dormant. If the SQL-
  3433. connection established by the most recently executed implicit
  3434. or explicit <connect statement> or <set connection statement>
  3435. has not been terminated, then that SQL-connection is the current
  3436. SQL-connection; otherwise, there is no current SQL-connection. An
  3437. existing SQL-connection that is not the current SQL-connection is a
  3438. dormant SQL-connection.
  3439. An SQL-implementation may detect the loss of the current SQL-
  3440. connection during execution of any SQL-statement. When such a
  3441. connection failure is detected, an exception condition is raised:
  3442. transaction rollback-statement completion unknown. This excep-
  3443. tion condition indicates that the results of the actions performed
  3444. in the SQL-server on behalf of the statement are unknown to the
  3445. SQL-agent.
  3446. Similarly, an SQL-implementation may detect the loss of the current
  3447. SQL-connection during the execution of a <commit statement>. When
  3448. such a connection failure is detected, an exception condition is
  3449. raised: connection exception-transaction resolution unknown. This
  3450. exception condition indicates that the SQL-implementation cannot
  3451. verify whether the SQL-transaction was committed successfully,
  3452. rolled back, or left active.
  3453. A user may initiate an SQL-connection between the SQL-client as-
  3454. sociated with the SQL-agent and a specific SQL-server by executing
  3455. a <connect statement>. Otherwise, an SQL-connection between the
  3456. SQL-client and an implementation-defined default SQL-server is
  3457. initiated when a <procedure> is called and no SQL-connection is
  3458. current. The SQL-connection associated with an implementation-
  3459. defined default SQL-server is called the default SQL-connection.
  3460. An SQL-connection is terminated either by executing a <disconnect
  3461. statement>, or following the last call to a <procedure> within the
  3462. last active <module>, or by the last execution of a <direct SQL
  3463. statement> through the direct invocation of SQL. The mechanism and
  3464. rules by which an SQL-environment determines whether a call to a
  3465. <procedure> is the last call within the last active <module> or
  3466. the last execution of a <direct SQL statement> through the direct
  3467. invocation of SQL are implementation-defined.
  3468. Concepts 71
  3469. X3H2-92-154/DBL CBR-002
  3470. 4.29 SQL-connections
  3471. An implementation shall support at least one SQL-connection and
  3472. may require that the SQL-server be identified at the binding time
  3473. chosen by the implementation. If an implementation permits more
  3474. than one concurrent SQL-connection, then the SQL-agent may connect
  3475. to more than one SQL-server and select the SQL-server by executing
  3476. a <set connection statement>.
  3477. 4.30 SQL-sessions
  3478. An SQL-session spans the execution of a sequence of consecutive
  3479. SQL-statements invoked by a single user from a single SQL-agent or
  3480. by the direct invocation of SQL.
  3481. An SQL-session is associated with an SQL-connection. The SQL-
  3482. session associated with the default SQL-connection is called the
  3483. default SQL-session. An SQL-session is either current or dormant.
  3484. The current SQL-session is the SQL-session associated with the cur-
  3485. rent SQL-connection. A dormant SQL-session is an SQL-session that
  3486. is associated with a dormant SQL-connection.
  3487. An SQL-session has an SQL-session <module> that is different
  3488. from any other <module> that exists simultaneously in the SQL-
  3489. environment. The SQL-session <module> contains the global prepared
  3490. SQL-statements that belong to the SQL-session. The SQL-session
  3491. <module> contains a <module authorization clause> that speci-
  3492. fies SCHEMA <schema name>, where the value of <schema name> is
  3493. implementation-dependent.
  3494. Within an SQL-session, declared local temporary tables are effec-
  3495. tively created by <temporary table declaration>s. Declared local
  3496. temporary tables are accessible only to invocations of <proce-
  3497. dure>s in the <module> in which they are created. The definitions
  3498. of declared local temporary tables persist until the end of the
  3499. SQL-session.
  3500. An SQL-session has a unique implementation-dependent SQL-session
  3501. identifier. This SQL-session identifier is different from the SQL-
  3502. session identifier of any other concurrent SQL-session. The SQL-
  3503. session identifier is used to effectively define implementation-
  3504. defined schemas that contain the instances of any global temporary
  3505. tables, created local temporary tables, or declared local temporary
  3506. tables within the SQL-session.
  3507. An SQL-session has an <authorization identifier> that is initially
  3508. set to an implementation-defined value when the SQL-session is
  3509. started, unless the SQL-session is started as a result of suc-
  3510. cessful execution of a <connect statement>, in which case the
  3511. <authorization identifier> of the SQL-session is set to the value
  3512. of the implicit or explicit <user name> contained in the <connect
  3513. statement>.
  3514. 72 Database Language SQL
  3515. X3H2-92-154/DBL CBR-002
  3516. 4.30 SQL-sessions
  3517. An SQL-session has a default catalog name that is used to effec-
  3518. tively qualify unqualified <schema name>s that are contained in
  3519. <preparable statement>s when those statements are prepared in the
  3520. current SQL-session by either an <execute immediate statement>
  3521. or a <prepare statement> or are contained in <direct SQL state-
  3522. ment>s when those statements are invoked directly. The default
  3523. catalog name is initially set to an implementation-defined value
  3524. but can subsequently be changed by the successful execution of a
  3525. <set catalog statement> or <set schema statement>.
  3526. An SQL-session has a default unqualified schema name that is used
  3527. to effectively qualify unqualified <qualified name>s that are con-
  3528. tained in <preparable statement>s when those statements are pre-
  3529. pared in the current SQL-session by either an <execute immediate
  3530. statement> or a <prepare statement> or are contained in <direct SQL
  3531. statement>s when those statements are invoked directly. The default
  3532. unqualified schema name is initially set to an implementation-
  3533. defined value but can subsequently be changed by the successful
  3534. execution of a <set schema statement>.
  3535. An SQL-session has a default character set name that is used to
  3536. identify the character set implicit for <identifier>s and <charac-
  3537. ter string literal>s that are contained in <preparable statement>s
  3538. when those statements are prepared in the current SQL-session by
  3539. either an <execute immediate statement> or a <prepare statement> or
  3540. are contained in <direct SQL statement>s when those statements are
  3541. invoked directly. The default character set name is initially set
  3542. to an implementation-defined value but can subsequently be changed
  3543. by the successful execution of a <set names statement>.
  3544. An SQL-session has a default local time zone displacement, which is
  3545. a value of data type INTERVAL HOUR TO MINUTE. The default local
  3546. time zone displacement is initially set to an implementation-
  3547. defined value but can subsequently be changed by successful exe-
  3548. cution of a <set local time zone statement>.
  3549. An SQL-session has context that is preserved when an SQL-session
  3550. is made dormant and restored when the SQL-session is made current.
  3551. This context comprises:
  3552. - the current SQL-session identifier,
  3553. - the current <authorization identifier>,
  3554. - the identities of all instances of temporary tables,
  3555. - the SQL-session <module>,
  3556. - the current default catalog name,
  3557. - the current default unqualified schema name,
  3558. - the current character set name substitution value,
  3559. - the current default time zone,
  3560. Concepts 73
  3561. X3H2-92-154/DBL CBR-002
  3562. 4.30 SQL-sessions
  3563. - the current constraint mode for each integrity constraint,
  3564. - the current transaction access mode,
  3565. - the cursor position of all open cursors,
  3566. - the contents of all SQL dynamic descriptor areas,
  3567. - the current transaction isolation level, and
  3568. - the current transaction diagnostics area limit.
  3569. 4.31 Client-server operation
  3570. Within an SQL-environment, an SQL-implementation may be considered
  3571. to effectively contain an SQL-client component and one or more
  3572. SQL-server components.
  3573. When an SQL-agent is active, it is bound in some implementation-
  3574. defined manner to a single SQL-client. That SQL-client processes
  3575. the explicit or implicit <SQL connection statement> for the first
  3576. call to a <procedure> by an SQL-agent. The SQL-client communicates
  3577. with, either directly or possibly through other agents such as RDA,
  3578. one or more SQL-servers. An SQL-session involves an SQL-agent, an
  3579. SQL-client, and a single SQL-server.
  3580. <module>s associated with the SQL-agent exist in the SQL-
  3581. environment containing the SQL-client associated with the SQL-
  3582. agent.
  3583. Called <procedure>s (and, analogously, <direct SQL statement>s)
  3584. containing an <SQL connection statement> or an <SQL diagnostics
  3585. statement> are processed by the SQL-client. Following the suc-
  3586. cessful execution of a <connect statement> or a <set connection
  3587. statement>, the <module>s associated with the SQL-agent are ef-
  3588. fectively materialized with an implementation-dependent <module
  3589. name> in the SQL-server. Other called <procedure>s and <direct SQL
  3590. statement>s are processed by the SQL-server.
  3591. A call by the SQL-agent to a <procedure> containing an <SQL di-
  3592. agnostics statement> fetches information from the diagnostics
  3593. area associated with the SQL-client. Following the execution of
  3594. an <SQL procedure statement> by an SQL-server, diagnostic in-
  3595. formation is passed in an implementation-dependent manner into
  3596. the SQL-agent's diagnostics area in the SQL-client. The effect
  3597. on diagnostic information of incompatibilities between the char-
  3598. acter repertoires supported by the SQL-client and SQL-server is
  3599. implementation-dependent.
  3600. 74 Database Language SQL
  3601. X3H2-92-154/DBL CBR-002
  3602. 4.32 Information Schema
  3603. 4.32 Information Schema
  3604. In each catalog in an SQL-environment, there is a schema, the
  3605. Information Schema, with the name INFORMATION_SCHEMA, contain-
  3606. ing a number of view descriptors, one base table descriptor ,
  3607. and several domain descriptors. The data accessible through these
  3608. views is a representation of all of the descriptors in all of the
  3609. schemas in that catalog. The <query expression> of each view en-
  3610. sures that a given user can access only those rows of the view
  3611. that represent descriptors on which he has privileges. The rows
  3612. of each view are required to represent correctly the descriptors
  3613. in the catalog as they existed at the start of the current SQL-
  3614. transaction, as modified subsequently by any changes made by the
  3615. current SQL-transaction. The SELECT privilege is granted on each
  3616. of the Information Schema views to PUBLIC WITH GRANT OPTION so they
  3617. can be queried by any user and so that the SELECT privilege can
  3618. be further granted on views that reference the Information Schema
  3619. views. No further privilege is granted on them, so they cannot be
  3620. updated.
  3621. The viewed tables in INFORMATION_SCHEMA are defined in terms of
  3622. a collection of base tables in a schema named DEFINITION_SCHEMA,
  3623. the Definition Schema. The only purpose of the definition of these
  3624. base tables is to provide a data model to support the Information
  3625. Schema. An implementation need do no more than simulate the exis-
  3626. tence of the base tables as viewed through the Information Schema
  3627. views.
  3628. The Information Schema describes itself. It does not describe the
  3629. base tables or views of the Definition Schema. If an implemen-
  3630. tation has defined additional objects that are associated with
  3631. INFORMATION_SCHEMA, then those objects shall also be described in
  3632. the Information Schema views.
  3633. 4.33 Leveling
  3634. Three levels of conformance are specified in this International
  3635. Standard.
  3636. Entry SQL includes the statements for defining schemas, data ma-
  3637. nipulation language, referential integrity, check constraints, and
  3638. default clause from ISO/IEC 9075:1989, and options for module lan-
  3639. guage and embedded SQL interfaces to seven different programming
  3640. languages, as well as direct execution of the data manipulation
  3641. statements. It also includes features related to deprecated fea-
  3642. tures from ISO/IEC 9075:1989 (commas and parentheses in parameter
  3643. lists, the SQLSTATE parameter, and renaming columns in the <se-
  3644. lect list>), features related to incompatibilities with ISO/IEC
  3645. 9075:1989 (colons preceding <parameter name>s, WITH CHECK OPTION
  3646. constraint clarifications), and aids for transitioning from ISO/IEC
  3647. 9075:1989 to this International Standard (<delimited identifier>s).
  3648. Concepts 75
  3649. X3H2-92-154/DBL CBR-002
  3650. 4.33 Leveling
  3651. Finally, it contains changes to correct defects found in ISO/IEC
  3652. 9075:1989 (see Annex F, "Maintenance and interpretation of SQL").
  3653. Intermediate SQL includes major new facilities such as statements
  3654. for changing schemas, dynamic SQL, and isolation levels for SQL-
  3655. transactions. It also includes multiple-module support and cascade
  3656. delete on referential actions, as well as numerous functional en-
  3657. hancements such as row and table expressions, union join, character
  3658. string operations, table intersection and difference operations,
  3659. simple domains, the CASE expression, casting between data types,
  3660. a diagnostics management capability for data administration and
  3661. more comprehensive error analysis, multiple character repertoires,
  3662. interval and simplified datetime data types, and variable-length
  3663. character strings. It also includes a requirement for a flagger
  3664. facility to aid in writing portable applications.
  3665. Full SQL increases orthogonality and includes deferred constraint
  3666. checking and named constraints. Other technical enhancements in-
  3667. clude additional user options to define datetime data types,
  3668. self-referencing updates and deletes, cascade update on referen-
  3669. tial actions, subqueries in check constraints, scrolled cursors,
  3670. character translations, a bit string data type, temporary tables,
  3671. additional referential constraint options, and simple assertions.
  3672. 4.34 SQL Flagger
  3673. An SQL Flagger is an implementation-provided facility that is able
  3674. to identify SQL language extensions, or other SQL processing al-
  3675. ternatives, that may be provided by a conforming SQL-implementation
  3676. (see Subclause 23.3, "Extensions and options"). An SQL Flagger
  3677. is intended to assist SQL programmers in producing SQL language
  3678. that is both portable and interoperable among different conform-
  3679. ing SQL-implementations operating under different levels of this
  3680. International Standard.
  3681. An SQL Flagger is intended to effect a static check of SQL lan-
  3682. guage. There is no requirement to detect extensions that cannot be
  3683. determined until the General Rules are evaluated.
  3684. An SQL-implementation need only flag SQL language that is not oth-
  3685. erwise in error as far as that implementation is concerned.
  3686. Note: If a system is processing SQL language that contains er-
  3687. rors, then it may be very difficult within a single statement to
  3688. determine what is an error and what is an extension. As one pos-
  3689. sibility, an implementation may choose to check SQL language in
  3690. two steps; first through its normal syntax analyzer and secondly
  3691. through the SQL Flagger. The first step produces error messages
  3692. for nonstandard SQL language that the implementation cannot process
  3693. or recognize. The second step processes SQL language that contains
  3694. no errors as far as that implementation is concerned; it detects
  3695. and flags at one time all nonstandard SQL language that could be
  3696. processed by that implementation. Any such two-step process should
  3697. be transparent to the end user.
  3698. 76 Database Language SQL
  3699. X3H2-92-154/DBL CBR-002
  3700. 4.34 SQL Flagger
  3701. In order to provide upward compatibility for its own customer base,
  3702. or to provide performance advantages under special circumstances, a
  3703. conforming SQL-implementation may provide user options to process
  3704. conforming SQL language in a nonconforming manner. If this is the
  3705. case, then it is required that the implementation also provide a
  3706. flagger option, or some other implementation-defined means, to
  3707. detect SQL conforming language that may be processed differently
  3708. under the various user options. This flagger feature allows an
  3709. application programmer to identify conforming SQL language that may
  3710. perform differently in alternative processing environments provided
  3711. by a conforming SQL-implementation. It also provides a valuable
  3712. tool in identifying SQL elements that may have to be modified if
  3713. SQL language is to be moved from a nonconforming to a conforming
  3714. SQL processing environment.
  3715. An SQL Flagger provides one or more of the following "level of
  3716. flagging" options:
  3717. - Entry SQL Flagging
  3718. - Intermediate SQL Flagging
  3719. - Full SQL Flagging
  3720. An SQL Flagger that provides one of these options shall be able to
  3721. identify SQL language constructs that violate the indicated level
  3722. of SQL language as defined in Subclause 4.33, "Leveling".
  3723. An SQL Flagger provides one or more of the following "extent of
  3724. checking" options:
  3725. - Syntax Only
  3726. - Catalog Lookup
  3727. Under the Syntax Only option, the SQL Flagger analyzes only the SQL
  3728. language that is presented; it checks for violations of any Syntax
  3729. Rules that can be determined without access to the Information
  3730. Schema.
  3731. Under the Catalog Lookup option, the SQL Flagger assumes the avail-
  3732. ability of Definition Schema information and checks for violations
  3733. of all Syntax Rules and Access Rules, except Access Rules that deal
  3734. with privileges. For example, some Syntax Rules place restrictions
  3735. on data types; this flagger option would identify extensions that
  3736. relax such restrictions. In order to avoid security breaches, this
  3737. option may view the Definition Schema only through the eyes of a
  3738. specific Information Schema.
  3739. Concepts 77
  3740. X3H2-92-154/DBL CBR-002
  3741. 78 Database Language SQL
  3742. X3H2-92-154/DBL CBR-002
  3743. 5 Lexical elements
  3744. 5.1 <SQL terminal character>
  3745. Function
  3746. Define the terminal symbols of the SQL language and the elements of
  3747. strings.
  3748. Format
  3749. <SQL terminal character> ::=
  3750. <SQL language character>
  3751. | <SQL embedded language character>
  3752. <SQL embedded language character> ::=
  3753. <left bracket>
  3754. | <right bracket>
  3755. <SQL language character> ::=
  3756. <simple Latin letter>
  3757. | <digit>
  3758. | <SQL special character>
  3759. <simple Latin letter> ::=
  3760. <simple Latin upper case letter>
  3761. | <simple Latin lower case letter>
  3762. <simple Latin upper case letter> ::=
  3763. A | B | C | D | E | F | G | H | I | J | K | L | M | N | O
  3764. | P | Q | R | S | T | U | V | W | X | Y | Z
  3765. <simple Latin lower case letter> ::=
  3766. a | b | c | d | e | f | g | h | i | j | k | l | m | n | o
  3767. | p | q | r | s | t | u | v | w | x | y | z
  3768. <digit> ::=
  3769. 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
  3770. <SQL special character> ::=
  3771. <space>
  3772. | <double quote>
  3773. | <percent>
  3774. | <ampersand>
  3775. | <quote>
  3776. | <left paren>
  3777. | <right paren>
  3778. | <asterisk>
  3779. Lexical elements 79
  3780. X3H2-92-154/DBL CBR-002
  3781. 5.1 <SQL terminal character>
  3782. | <plus sign>
  3783. | <comma>
  3784. | <minus sign>
  3785. | <period>
  3786. | <solidus>
  3787. | <colon>
  3788. | <semicolon>
  3789. | <less than operator>
  3790. | <equals operator>
  3791. | <greater than operator>
  3792. | <question mark>
  3793. | <underscore>
  3794. | <vertical bar>
  3795. <space> ::= !! space character in character set in use
  3796. <double quote> ::= "
  3797. <percent> ::= %
  3798. <ampersand> ::= &
  3799. <quote> ::= '
  3800. <left paren> ::= (
  3801. <right paren> ::= )
  3802. <asterisk> ::= *
  3803. <plus sign> ::= +
  3804. <comma> ::= ,
  3805. <minus sign> ::= -
  3806. <period> ::= .
  3807. <solidus> ::= /
  3808. <colon> ::= :
  3809. <semicolon> ::= ;
  3810. <less than operator> ::= <
  3811. <equals operator> ::= =
  3812. <greater than operator> ::= >
  3813. <question mark> ::= ?
  3814. <left bracket> ::= [
  3815. 80 Database Language SQL
  3816. X3H2-92-154/DBL CBR-002
  3817. 5.1 <SQL terminal character>
  3818. <right bracket> ::= ]
  3819. <underscore> ::= _
  3820. <vertical bar> ::= |
  3821. Syntax Rules
  3822. None.
  3823. Access Rules
  3824. None.
  3825. General Rules
  3826. 1) There is a one-to-one correspondence between the symbols con-
  3827. tained in <simple Latin upper case letter> and the symbols
  3828. contained in <simple Latin lower case letter> such that, for
  3829. all i, the symbol defined as the i-th alternative for <simple
  3830. Latin upper case letter> corresponds to the symbol defined as
  3831. the i-th alternative for <simple Latin lower case letter>.
  3832. Leveling Rules
  3833. 1) The following restrictions apply for Intermediate SQL:
  3834. None.
  3835. 2) The following restrictions apply for Entry SQL in addition to
  3836. any Intermediate SQL restrictions:
  3837. None.
  3838. Lexical elements 81
  3839. X3H2-92-154/DBL CBR-002
  3840. 5.2 <token> and <separator>
  3841. 5.2 <token> and <separator>
  3842. Function
  3843. Specify lexical units (tokens and separators) that participate in
  3844. SQL language.
  3845. Format
  3846. <token> ::=
  3847. <nondelimiter token>
  3848. | <delimiter token>
  3849. <nondelimiter token> ::=
  3850. <regular identifier>
  3851. | <key word>
  3852. | <unsigned numeric literal>
  3853. | <national character string literal>
  3854. | <bit string literal>
  3855. | <hex string literal>
  3856. <regular identifier> ::= <identifier body>
  3857. <identifier body> ::=
  3858. <identifier start> [ { <underscore> | <identifier part> }... ]
  3859. <identifier start> ::= !! See the Syntax Rules
  3860. <identifier part> ::=
  3861. <identifier start>
  3862. | <digit>
  3863. <delimited identifier> ::=
  3864. <double quote> <delimited identifier body> <double quote>
  3865. <delimited identifier body> ::= <delimited identifier part>...
  3866. <delimited identifier part> ::=
  3867. <nondoublequote character>
  3868. | <doublequote symbol>
  3869. <nondoublequote character> ::= !! See the Syntax Rules
  3870. <doublequote symbol> ::= <double quote><double quote>
  3871. <delimiter token> ::=
  3872. <character string literal>
  3873. | <date string>
  3874. | <time string>
  3875. | <timestamp string>
  3876. | <interval string>
  3877. | <delimited identifier>
  3878. 82 Database Language SQL
  3879. X3H2-92-154/DBL CBR-002
  3880. 5.2 <token> and <separator>
  3881. | <SQL special character>
  3882. | <not equals operator>
  3883. | <greater than or equals operator>
  3884. | <less than or equals operator>
  3885. | <concatenation operator>
  3886. | <double period>
  3887. | <left bracket>
  3888. | <right bracket>
  3889. <not equals operator> ::= <>
  3890. <greater than or equals operator> ::= >=
  3891. <less than or equals operator> ::= <=
  3892. <concatenation operator> ::= ||
  3893. <double period> ::= ..
  3894. <separator> ::= { <comment> | <space> | <newline> }...
  3895. <comment> ::=
  3896. <comment introducer> [ <comment character>... ] <newline>
  3897. <comment character> ::=
  3898. <nonquote character>
  3899. | <quote>
  3900. <comment introducer> ::= <minus sign><minus sign>[<minus sign>...]
  3901. <newline> ::= !! implementation-defined end-of-line indicator
  3902. <key word> ::=
  3903. <reserved word>
  3904. | <non-reserved word>
  3905. <non-reserved word> ::=
  3906. ADA
  3907. | C | CATALOG_NAME | CHARACTER_SET_CATALOG | CHARACTER_SET_
  3908. NAME
  3909. | CHARACTER_SET_SCHEMA | CLASS_ORIGIN | COBOL | COLLATION_
  3910. CATALOG
  3911. | COLLATION_NAME | COLLATION_SCHEMA | COLUMN_NAME | COMMAND_
  3912. FUNCTION | COMMITTED
  3913. | CONDITION_NUMBER | CONNECTION_NAME | CONSTRAINT_CATALOG | CONSTRAINT_
  3914. NAME
  3915. | CONSTRAINT_SCHEMA | CURSOR_NAME
  3916. | DATA | DATETIME_INTERVAL_CODE | DATETIME_INTERVAL_
  3917. PRECISION | DYNAMIC_FUNCTION
  3918. | FORTRAN
  3919. | LENGTH
  3920. | MESSAGE_LENGTH | MESSAGE_OCTET_LENGTH | MESSAGE_TEXT | MORE | MUMPS
  3921. Lexical elements 83
  3922. X3H2-92-154/DBL CBR-002
  3923. 5.2 <token> and <separator>
  3924. | NAME | NULLABLE | NUMBER
  3925. | PASCAL | PLI
  3926. | REPEATABLE | RETURNED_LENGTH | RETURNED_OCTET_LENGTH | RETURNED_
  3927. SQLSTATE
  3928. | ROW_COUNT
  3929. | SCALE | SCHEMA_NAME | SERIALIZABLE | SERVER_NAME | SUBCLASS_
  3930. ORIGIN
  3931. | TABLE_NAME | TYPE
  3932. | UNCOMMITTED | UNNAMED
  3933. <reserved word> ::=
  3934. ABSOLUTE | ACTION | ADD | ALL | ALLOCATE | ALTER | AND
  3935. | ANY | ARE | AS | ASC
  3936. | ASSERTION | AT | AUTHORIZATION | AVG
  3937. | BEGIN | BETWEEN | BIT | BIT_LENGTH | BOTH | BY
  3938. | CASCADE | CASCADED | CASE | CAST | CATALOG | CHAR | CHARACTER | CHAR_
  3939. LENGTH
  3940. | CHARACTER_LENGTH | CHECK | CLOSE | COALESCE | COLLATE | COLLATION
  3941. | COLUMN | COMMIT | CONNECT | CONNECTION | CONSTRAINT
  3942. | CONSTRAINTS | CONTINUE
  3943. | CONVERT | CORRESPONDING | COUNT | CREATE | CROSS | CURRENT
  3944. | CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP | CURRENT_
  3945. USER | CURSOR
  3946. | DATE | DAY | DEALLOCATE | DEC | DECIMAL | DECLARE | DEFAULT | DEFERRABLE
  3947. | DEFERRED | DELETE | DESC | DESCRIBE | DESCRIPTOR | DIAGNOSTICS
  3948. | DISCONNECT | DISTINCT | DOMAIN | DOUBLE | DROP
  3949. | ELSE | END | END-EXEC | ESCAPE | EXCEPT | EXCEPTION
  3950. | EXEC | EXECUTE | EXISTS
  3951. | EXTERNAL | EXTRACT
  3952. | FALSE | FETCH | FIRST | FLOAT | FOR | FOREIGN | FOUND | FROM | FULL
  3953. | GET | GLOBAL | GO | GOTO | GRANT | GROUP
  3954. | HAVING | HOUR
  3955. | IDENTITY | IMMEDIATE | IN | INDICATOR | INITIALLY | INNER | INPUT
  3956. | INSENSITIVE | INSERT | INT | INTEGER | INTERSECT | INTERVAL | INTO | IS
  3957. | ISOLATION
  3958. | JOIN
  3959. | KEY
  3960. | LANGUAGE | LAST | LEADING | LEFT | LEVEL | LIKE | LOCAL | LOWER
  3961. | MATCH | MAX | MIN | MINUTE | MODULE | MONTH
  3962. | NAMES | NATIONAL | NATURAL | NCHAR | NEXT | NO | NOT | NULL
  3963. | NULLIF | NUMERIC
  3964. | OCTET_LENGTH | OF | ON | ONLY | OPEN | OPTION | OR
  3965. | ORDER | OUTER
  3966. | OUTPUT | OVERLAPS
  3967. 84 Database Language SQL
  3968. X3H2-92-154/DBL CBR-002
  3969. 5.2 <token> and <separator>
  3970. | PAD | PARTIAL | POSITION | PRECISION | PREPARE | PRESERVE | PRIMARY
  3971. | PRIOR | PRIVILEGES | PROCEDURE | PUBLIC
  3972. | READ | REAL | REFERENCES | RELATIVE | RESTRICT | REVOKE | RIGHT
  3973. | ROLLBACK | ROWS
  3974. | SCHEMA | SCROLL | SECOND | SECTION | SELECT | SESSION | SESSION_
  3975. USER | SET
  3976. | SIZE | SMALLINT | SOME | SPACE | SQL | SQLCODE | SQLERROR | SQLSTATE
  3977. | SUBSTRING | SUM | SYSTEM_USER
  3978. | TABLE | TEMPORARY | THEN | TIME | TIMESTAMP | TIMEZONE_
  3979. HOUR | TIMEZONE_MINUTE
  3980. | TO | TRAILING | TRANSACTION | TRANSLATE | TRANSLATION | TRIM | TRUE
  3981. | UNION | UNIQUE | UNKNOWN | UPDATE | UPPER | USAGE | USER | USING
  3982. | VALUE | VALUES | VARCHAR | VARYING | VIEW
  3983. | WHEN | WHENEVER | WHERE | WITH | WORK | WRITE
  3984. | YEAR
  3985. | ZONE
  3986. Note: The list of <reserved word>s is considerably longer than
  3987. the analogous list of <key word>s in ISO/IEC 9075:1989. To assist
  3988. users of this International Standard avoid such words in a possible
  3989. future revision, the following list of potential <reserved word>s
  3990. is provided. Readers must understand that there is no guarantee
  3991. that all of these words will, in fact, become <reserved word>s
  3992. in any future revision; furthermore, it is almost certain that
  3993. additional words will be added to this list as any possible future
  3994. revision emerges.
  3995. The words are: AFTER, ALIAS, ASYNC, BEFORE, BOOLEAN, BREADTH,
  3996. COMPLETION, CALL, CYCLE, DATA, DEPTH, DICTIONARY, EACH, ELSEIF,
  3997. EQUALS, GENERAL, IF, IGNORE, LEAVE, LESS, LIMIT, LOOP, MODIFY,
  3998. NEW, NONE, OBJECT, OFF, OID, OLD, OPERATION, OPERATORS, OTHERS,
  3999. PARAMETERS, PENDANT, PREORDER, PRIVATE, PROTECTED, RECURSIVE, REF,
  4000. REFERENCING, REPLACE, RESIGNAL, RETURN, RETURNS, ROLE, ROUTINE,
  4001. ROW, SAVEPOINT, SEARCH, SENSITIVE, SEQUENCE, SIGNAL, SIMILAR,
  4002. SQLEXCEPTION, SQLWARNING, STRUCTURE, TEST, THERE, TRIGGER, TYPE,
  4003. UNDER, VARIABLE, VIRTUAL, VISIBLE, WAIT, WHILE, and WITHOUT.
  4004. Syntax Rules
  4005. 1) An <identifier start> is one of:
  4006. a) A <simple Latin letter>; or
  4007. b) A character that is identified as a letter in the character
  4008. repertoire identified by the <module character set specifica-
  4009. tion> or by the <character set specification>; or
  4010. Lexical elements 85
  4011. X3H2-92-154/DBL CBR-002
  4012. 5.2 <token> and <separator>
  4013. c) A character that is identified as a syllable in the char-
  4014. acter repertoire identified by the <module character set
  4015. specification> or by the <character set specification>; or
  4016. d) A character that is identified as an ideograph in the char-
  4017. acter repertoire identified by the <module character set
  4018. specification> or by the <character set specification>.
  4019. 2) With the exception of the <space> character explicitly contained
  4020. in <timestamp string> and <interval string> and the permitted
  4021. <separator>s in <bit string literal>s and <hex string literal>s,
  4022. a <token>, other than a <character string literal>, a <national
  4023. character string literal>, or a <delimited identifier>, shall
  4024. not include a <space> character or other <separator>.
  4025. 3) A <nondoublequote character> is one of:
  4026. a) Any <SQL language character> other than a <double quote>;
  4027. b) Any character other than a <double quote> in the character
  4028. repertoire identified by the <module character set specifica-
  4029. tion>; or
  4030. c) Any character other than a <double quote> in the character
  4031. repertoire identified by the <character set specification>.
  4032. 4) The two <doublequote>s contained in a <doublequote symbol> shall
  4033. not be separated by any <separator>.
  4034. 5) Any <token> may be followed by a <separator>. A <nondelimiter
  4035. token> shall be followed by a <delimiter token> or a <separa-
  4036. tor>. If the Format does not allow a <nondelimiter token> to be
  4037. followed by a <delimiter token>, then that <nondelimiter token>
  4038. shall be followed by a <separator>.
  4039. 6) There shall be no <space> nor <newline> separating the <minus
  4040. sign>s of a <comment introducer>.
  4041. 7) SQL text containing one or more instances of <comment> is equiv-
  4042. alent to the same SQL text with the <comment> replaced with
  4043. <newline>.
  4044. 8) The sum of the number of <identifier start>s and the number
  4045. of <identifier part>s in a <regular identifier> shall not be
  4046. greater than 128.
  4047. 9) The <delimited identifier body> of a <delimited identifier>
  4048. shall not comprise more than 128 <delimited identifier part>s.
  4049. 10)The <identifier body> of a <regular identifier> is equivalent
  4050. to an <identifier body> in which every letter that is a lower-
  4051. case letter is replaced by the equivalent upper-case letter
  4052. or letters. This treatment includes determination of equiva-
  4053. lence, representation in the Information and Definition Schemas,
  4054. representation in the diagnostics area, and similar uses.
  4055. 86 Database Language SQL
  4056. X3H2-92-154/DBL CBR-002
  4057. 5.2 <token> and <separator>
  4058. 11)The <identifier body> of a <regular identifier> (with every
  4059. letter that is a lower-case letter replaced by the equivalent
  4060. upper-case letter or letters), treated as the repetition of
  4061. a <character string literal> that specifies a <character set
  4062. specification> of SQL_TEXT, shall not be equal, according to
  4063. the comparison rules in Subclause 8.2, "<comparison predicate>",
  4064. to any <reserved word> (with every letter that is a lower-case
  4065. letter replaced by the equivalent upper-case letter or letters),
  4066. treated as the repetition of a <character string literal> that
  4067. specifies a <character set specification> of SQL_TEXT.
  4068. Note: It is the intention that no <key word> specified in this
  4069. International Standard or revisions thereto shall end with an
  4070. <underscore>.
  4071. 12)Two <regular identifier>s are equivalent if their <identifier
  4072. body>s, considered as the repetition of a <character string
  4073. literal> that specifies a <character set specification> of
  4074. SQL_TEXT, compare equally according to the comparison rules
  4075. in Subclause 8.2, "<comparison predicate>".
  4076. 13)A <regular identifier> and a <delimited identifier> are equiva-
  4077. lent if the <identifier body> of the <regular identifier> (with
  4078. every letter that is a lower-case letter replaced by the equiva-
  4079. lent upper-case letter or letters) and the <delimited identifier
  4080. body> of the <delimited identifier> (with all occurrences of
  4081. <quote> replaced by <quote symbol> and all occurrences of <dou-
  4082. blequote symbol> replaced by <double quote>), considered as
  4083. the repetition of a <character string literal> that specifies a
  4084. <character set specification> of SQL_TEXT and an implementation-
  4085. defined collation that is sensitive to case, compare equally
  4086. according to the comparison rules in Subclause 8.2, "<comparison
  4087. predicate>".
  4088. 14)Two <delimited identifier>s are equivalent if their <delimited
  4089. identifier body>s (with all occurrences of <quote> replaced
  4090. by <quote symbol> and all occurrences of <doublequote symbol>
  4091. replaced by <doublequote>), considered as the repetition of a
  4092. <character string literal> that specifies a <character set spec-
  4093. ification> of SQL_TEXT and an implementation-defined collation
  4094. that is sensitive to case, compare equally according to the
  4095. comparison rules in Subclause 8.2, "<comparison predicate>".
  4096. 15)For the purposes of identifying <key word>s, any <simple Latin
  4097. lower case letter> contained in a candidate <key word> shall
  4098. be effectively treated as the corresponding <simple Latin upper
  4099. case letter>.
  4100. Access Rules
  4101. None.
  4102. Lexical elements 87
  4103. X3H2-92-154/DBL CBR-002
  4104. 5.2 <token> and <separator>
  4105. General Rules
  4106. None.
  4107. Leveling Rules
  4108. 1) The following restrictions apply for Intermediate SQL:
  4109. a) No <identifier body> shall end in an <underscore>.
  4110. 2) The following restrictions apply for Entry SQL in addition to
  4111. any Intermediate SQL restrictions:
  4112. a) No <regular identifier> or <delimited identifier body> shall
  4113. contain more than 18 <character representation>s.
  4114. b) An <identifier body> shall contain no <simple Latin lower
  4115. case letter>.
  4116. 88 Database Language SQL
  4117. X3H2-92-154/DBL CBR-002
  4118. 5.3 <literal>
  4119. 5.3 <literal>
  4120. Function
  4121. Specify a non-null value.
  4122. Format
  4123. <literal> ::=
  4124. <signed numeric literal>
  4125. | <general literal>
  4126. <unsigned literal> ::=
  4127. <unsigned numeric literal>
  4128. | <general literal>
  4129. <general literal> ::=
  4130. <character string literal>
  4131. | <national character string literal>
  4132. | <bit string literal>
  4133. | <hex string literal>
  4134. | <datetime literal>
  4135. | <interval literal>
  4136. <character string literal> ::=
  4137. [ <introducer><character set specification> ]
  4138. <quote> [ <character representation>... ] <quote>
  4139. [ { <separator>... <quote> [ <character representation>... ] <quote> }... ]
  4140. <introducer> ::= <underscore>
  4141. <character representation> ::=
  4142. <nonquote character>
  4143. | <quote symbol>
  4144. <nonquote character> ::= !! See the Syntax Rules.
  4145. <quote symbol> ::= <quote><quote>
  4146. <national character string literal> ::=
  4147. N <quote> [ <character representation>... ] <quote>
  4148. [ { <separator>... <quote> [ <character representation>... ] <quote> }... ]
  4149. <bit string literal> ::=
  4150. B <quote> [ <bit>... ] <quote>
  4151. [ { <separator>... <quote> [ <bit>... ] <quote> }... ]
  4152. <hex string literal> ::=
  4153. X <quote> [ <hexit>... ] <quote>
  4154. [ { <separator>... <quote> [ <hexit>... ] <quote> }... ]
  4155. Lexical elements 89
  4156. X3H2-92-154/DBL CBR-002
  4157. 5.3 <literal>
  4158. <bit> ::= 0 | 1
  4159. <hexit> ::= <digit> | A | B | C | D | E | F | a | b | c | d | e | f
  4160. <signed numeric literal> ::=
  4161. [ <sign> ] <unsigned numeric literal>
  4162. <unsigned numeric literal> ::=
  4163. <exact numeric literal>
  4164. | <approximate numeric literal>
  4165. <exact numeric literal> ::=
  4166. <unsigned integer> [ <period> [ <unsigned integer> ] ]
  4167. | <period> <unsigned integer>
  4168. <sign> ::= <plus sign> | <minus sign>
  4169. <approximate numeric literal> ::= <mantissa> E <exponent>
  4170. <mantissa> ::= <exact numeric literal>
  4171. <exponent> ::= <signed integer>
  4172. <signed integer> ::= [ <sign> ] <unsigned integer>
  4173. <unsigned integer> ::= <digit>...
  4174. <datetime literal> ::=
  4175. <date literal>
  4176. | <time literal>
  4177. | <timestamp literal>
  4178. <date literal> ::=
  4179. DATE <date string>
  4180. <time literal> ::=
  4181. TIME <time string>
  4182. <timestamp literal> ::=
  4183. TIMESTAMP <timestamp string>
  4184. <date string> ::=
  4185. <quote> <date value> <quote>
  4186. <time string> ::=
  4187. <quote> <time value> [ <time zone interval> ] <quote>
  4188. <timestamp string> ::=
  4189. <quote> <date value> <space> <time value> [ <time zone interval> ] <quote>
  4190. <time zone interval> ::=
  4191. 90 Database Language SQL
  4192. X3H2-92-154/DBL CBR-002
  4193. 5.3 <literal>
  4194. <sign> <hours value> <colon> <minutes value>
  4195. <date value> ::=
  4196. <years value> <minus sign> <months value> <minus sign> <days value>
  4197. <time value> ::=
  4198. <hours value> <colon> <minutes value> <colon> <seconds value>
  4199. <interval literal> ::=
  4200. INTERVAL [ <sign> ] <interval string> <interval qualifier>
  4201. <interval string> ::=
  4202. <quote> { <year-month literal> | <day-time literal> } <quote>
  4203. <year-month literal> ::=
  4204. <years value>
  4205. | [ <years value> <minus sign> ] <months value>
  4206. <day-time literal> ::=
  4207. <day-time interval>
  4208. | <time interval>
  4209. <day-time interval> ::=
  4210. <days value>
  4211. [ <space> <hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ] ]
  4212. <time interval> ::=
  4213. <hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ]
  4214. | <minutes value> [ <colon> <seconds value> ]
  4215. | <seconds value>
  4216. <years value> ::= <datetime value>
  4217. <months value> ::= <datetime value>
  4218. <days value> ::= <datetime value>
  4219. <hours value> ::= <datetime value>
  4220. <minutes value> ::= <datetime value>
  4221. <seconds value> ::=
  4222. <seconds integer value> [ <period> [ <seconds fraction> ] ]
  4223. <seconds integer value> ::= <unsigned integer>
  4224. <seconds fraction> ::= <unsigned integer>
  4225. Lexical elements 91
  4226. X3H2-92-154/DBL CBR-002
  4227. 5.3 <literal>
  4228. <datetime value> ::= <unsigned integer>
  4229. Syntax Rules
  4230. 1) In a <character string literal> or <national character string
  4231. literal>, the sequence:
  4232. <quote> <character representation>... <quote>
  4233. <separator>... <quote> <character representation>... <quote>
  4234. is equivalent to the sequence
  4235. <quote> <character representation>... <character representa-
  4236. tion>... <quote>
  4237. Note: The <character representation>s in the equivalent se-
  4238. quence are in the same sequence and relative sequence as in the
  4239. original <character string literal>.
  4240. 2) In a <bit string literal>, the sequence
  4241. <quote> <bit>... <quote> <separator>... <quote> <bit>...
  4242. <quote>
  4243. is equivalent to the sequence
  4244. <quote> <bit>... <bit>... <quote>
  4245. Note: The <bit>s in the equivalent sequence are in the same
  4246. sequence and relative sequence as in the original <bit string
  4247. literal>.
  4248. 3) In a <hex string literal>, the sequence
  4249. <quote> <hexit>... <quote> <separator>... <quote> <hexit>...
  4250. <quote>
  4251. is equivalent to the sequence
  4252. <quote> <hexit>... <hexit>... <quote>
  4253. Note: The <hexit>s in the equivalent sequence are in the same
  4254. sequence and relative sequence as in the original <hex string
  4255. literal>.
  4256. 4) In a <character string literal>, <national character string
  4257. literal>, <bit string literal>, or <hex string literal>, a <sep-
  4258. arator> shall contain a <newline>.
  4259. 5) A <nonquote character> is one of:
  4260. a) Any <SQL language character> other than a <quote>;
  4261. b) Any character other than a <quote> in the character reper-
  4262. toire identified by the <module character set specification>;
  4263. or
  4264. c) Any character other than a <quote> in the character reper-
  4265. toire identified by the <character set specification> or
  4266. implied by "N".
  4267. 92 Database Language SQL
  4268. X3H2-92-154/DBL CBR-002
  4269. 5.3 <literal>
  4270. 6) If a <character set specification> is not specified in a <char-
  4271. acter string literal>, then the set of characters contained
  4272. in the <character string literal> shall be wholly contained
  4273. in either <SQL language character> or the character repertoire
  4274. indicated by:
  4275. Case:
  4276. a) If the <character string literal> is contained in a <module>,
  4277. then the <module character set specification>,
  4278. b) If the <character string literal> is contained in a <schema
  4279. definition> that is not contained in a <module>, then the
  4280. <schema character set specification>,
  4281. c) If the <character string literal> is contained in a <prepara-
  4282. ble statement> that is prepared in the current SQL-session
  4283. by an <execute immediate statement> or a <prepare statement>
  4284. or in a <direct SQL statement> that is invoked directly, then
  4285. the default character set name for the SQL-session.
  4286. 7) If a <character set specification> is specified in a <character
  4287. string literal>, then
  4288. a) There shall be no <separator> between the <introducer> and
  4289. the <character set specification>.
  4290. b) The set of characters contained in the <character string lit-
  4291. eral> shall be wholly contained in the character repertoire
  4292. indicated by the <character set specification>.
  4293. 8) A <national character string literal> is equivalent to a
  4294. <character string literal> with the "N" replaced by "<intro-
  4295. ducer><character set specification>", where "<character set
  4296. specification>" is an implementation-defined <character set
  4297. name>.
  4298. 9) The data type of a <character string literal> is fixed-length
  4299. character string. The length of a <character string literal>
  4300. is the number of <character representation>s that it contains.
  4301. Each <quote symbol> contained in <character string literal>
  4302. represents a single <quote> in both the value and the length of
  4303. the <character string literal>. The two <quote>s contained in a
  4304. <quote symbol> shall not be separated by any <separator>.
  4305. Note: <character string literal>s are allowed to be zero-length
  4306. strings (i.e., to contain no characters) even though it is
  4307. not permitted to declare a <data type> that is CHARACTER with
  4308. <length> zero.
  4309. 10)The data type of a <bit string literal> is fixed-length bit
  4310. string. The length of a <bit string literal> is the number of
  4311. bits that it contains.
  4312. Lexical elements 93
  4313. X3H2-92-154/DBL CBR-002
  4314. 5.3 <literal>
  4315. 11)The data type of a <hex string literal> is fixed-length bit
  4316. string. Each <hexit> appearing in the literal is equivalent
  4317. to a quartet of bits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
  4318. D, E, and F are interpreted as 0000, 0001, 0010, 0011, 0100,
  4319. 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110,
  4320. and 1111, respectively. The <hexit>s a, b, c, d, e, and f have
  4321. respectively the same values as the <hexit>s A, B, C, D, E, and
  4322. F.
  4323. 12)An <exact numeric literal> without a <period> has an implied
  4324. <period> following the last <digit>.
  4325. 13)The data type of an <exact numeric literal> is exact numeric.
  4326. The precision of an <exact numeric literal> is the number of
  4327. <digit>s that it contains. The scale of an <exact numeric lit-
  4328. eral> is the number of <digit>s to the right of the <period>.
  4329. 14)The data type of an <approximate numeric literal> is approximate
  4330. numeric. The precision of an <approximate numeric literal> is
  4331. the precision of its <mantissa>.
  4332. 15)The data type of a <date literal> is DATE.
  4333. 16)The data type of a <time literal> that does not specify <time
  4334. zone interval> is TIME(P), where P is the number of digits in
  4335. <seconds fraction>, if specified, and 0 otherwise. The data
  4336. type of a <time literal> that specifies <time zone interval>
  4337. is TIME(P) WITH TIME ZONE, where P is the number of digits in
  4338. <seconds fraction>, if specified, and 0 otherwise.
  4339. 17)The data type of a <timestamp literal> that does not specify
  4340. <time zone interval> is TIMESTAMP(P), where P is the number of
  4341. digits in <seconds fraction>, if specified, and 0 otherwise.
  4342. The data type of a <timestamp literal> that specifies <time zone
  4343. interval> is TIMESTAMP(P) WITH TIME ZONE, where P is the number
  4344. of digits in <seconds fraction>, if specified, and 0 otherwise.
  4345. 18)If <time zone interval> is not specified, then the effective
  4346. <time zone interval> of the datetime data type is the current
  4347. default time zone displacement for the SQL-session.
  4348. 19)Let datetime component be either <years value>, <months value>,
  4349. <days value>, <hours value>, <minutes value>, or <seconds
  4350. value>.
  4351. 20)Let N be the number of <datetime field>s in the precision of the
  4352. <interval literal>, as specified by <interval qualifier>.
  4353. The <interval literal> being defined shall contain N datetime
  4354. components.
  4355. The data type of <interval literal> specified with an <interval
  4356. qualifier> is INTERVAL with the <interval qualifier>.
  4357. 94 Database Language SQL
  4358. X3H2-92-154/DBL CBR-002
  4359. 5.3 <literal>
  4360. 21)Within a <datetime literal>, the <years value> shall contain
  4361. four digits. The <seconds integer value> and other datetime
  4362. components, with the exception of <seconds fraction>, shall each
  4363. contain two digits.
  4364. 22)Within the definition of a <datetime literal>, the <datetime
  4365. value>s are constrained by the natural rules for dates and times
  4366. according to the Gregorian calendar.
  4367. 23)Within the definition of an <interval literal>, the <datetime
  4368. value>s are constrained by the natural rules for intervals ac-
  4369. cording to the Gregorian calendar.
  4370. 24)Within the definition of a <year-month literal>, the <inter-
  4371. val qualifier> shall not specify DAY, HOUR, MINUTE, or SECOND.
  4372. Within the definition of a <day-time literal>, the <interval
  4373. qualifier> shall not specify YEAR or MONTH.
  4374. 25)Within the definition of a <datetime literal>, the value of the
  4375. <time zone interval> shall be in the range -12:59 to +13:00.
  4376. Access Rules
  4377. None.
  4378. General Rules
  4379. 1) The value of a <character string literal> is the sequence of
  4380. <character representation>s that it contains.
  4381. 2) The value of a <bit string literal> or a <hex string literal> is
  4382. the sequence of bits that it contains.
  4383. 3) The numeric value of an <exact numeric literal> is determined
  4384. by the normal mathematical interpretation of positional decimal
  4385. notation.
  4386. 4) The numeric value of an <approximate numeric literal> is approx-
  4387. imately the product of the exact numeric value represented by
  4388. the <mantissa> with the number obtained by raising the number
  4389. 10 to the power of the exact numeric value represented by the
  4390. <exponent>.
  4391. 5) The <sign> in a <signed numeric literal> or an <interval lit-
  4392. eral> is a monadic arithmetic operator. The monadic arithmetic
  4393. operators + and - specify monadic plus and monadic minus, re-
  4394. spectively. If neither monadic plus nor monadic minus are spec-
  4395. ified in a <signed numeric literal> or an <interval literal>,
  4396. or if monadic plus is specified, then the literal is positive.
  4397. If monadic minus is specified in a <signed numeric literal> or
  4398. <interval literal>, then the literal is negative.
  4399. Lexical elements 95
  4400. X3H2-92-154/DBL CBR-002
  4401. 5.3 <literal>
  4402. 6) Let V be the integer value of the <unsigned integer> contained
  4403. in <seconds fraction> and let N be the number of digits in the
  4404. <seconds fraction> respectively. The resultant value of the
  4405. <seconds fraction> is effectively determined as follows:
  4406. Case:
  4407. a) If <seconds fraction> is specified within the definition of a
  4408. <datetime literal>, then the effective value of the <seconds
  4409. fraction> is V*10 -N seconds.
  4410. b) If <seconds fraction> is specified within the definition of
  4411. an <interval literal>, then let M be the <interval fractional
  4412. seconds precision> specified in the <interval qualifier>.
  4413. Case:
  4414. i) If N < M, then let V1 be V *10M-N; the effective value of
  4415. the <seconds fraction> is V1*10 -M seconds.
  4416. ii) If N > M, then let V2 be the integer part of the quotient
  4417. of V /10N-M; the effective value of the <seconds fraction>
  4418. is V2*10 -M seconds.
  4419. iii) Otherwise, the effective value of the <seconds fraction> is
  4420. V*10 -M seconds.
  4421. 7) The i-th datetime component in a <datetime literal> or <interval
  4422. literal> assigns the value of the datetime component to the
  4423. i-th <datetime field> in the <datetime literal> or <interval
  4424. literal>.
  4425. 8) If <time zone interval> is specified, then the time and times-
  4426. tamp values in <time literal> and <timestamp literal> represent
  4427. a datetime in the specified time zone. Otherwise, the time and
  4428. timestamp values represent a datetime in the current default
  4429. time zone of the SQL-session. The value of the <time literal>
  4430. or the <timestamp literal> is effectively the <time value> or
  4431. the <date value> and <time value> together minus the <time zone
  4432. interval> value, followed by the <time zone interval>.
  4433. Note: <time literal>s and <timestamp literal>s are specified in
  4434. a time zone chosen by the SQL-agent (the default is the cur-
  4435. rent default time zone of the SQL-session). However, they are
  4436. effectively converted to UTC while maintaining the <time zone
  4437. interval> information that permits knowing the original time
  4438. zone value for the time or timestamp value.
  4439. Leveling Rules
  4440. 1) The following restrictions apply for Intermediate SQL:
  4441. a) An <unsigned integer> that is a <seconds fraction> shall not
  4442. contain more than 6 <digit>s.
  4443. 96 Database Language SQL
  4444. X3H2-92-154/DBL CBR-002
  4445. 5.3 <literal>
  4446. b) A <general literal> shall not be a <bit string literal> or a
  4447. <hex string literal>.
  4448. 2) The following restrictions apply for Entry SQL in addition to
  4449. any Intermediate SQL restrictions:
  4450. a) A <general literal> shall not be a <national character string
  4451. literal>.
  4452. b) A <general literal> shall not be a <datetime literal> or
  4453. <interval literal>.
  4454. c) A <character string literal> shall contain at least one
  4455. <character representation>.
  4456. d) Conforming Entry SQL language shall contain exactly one rep-
  4457. etition of <character representation> (that is, it shall
  4458. contain exactly one sequence of "<quote> <character represen-
  4459. tation>... <quote>").
  4460. e) A <character string literal> shall not specify a <character
  4461. set specification>.
  4462. Lexical elements 97
  4463. X3H2-92-154/DBL CBR-002
  4464. 5.4 Names and identifiers
  4465. 5.4 Names and identifiers
  4466. Function
  4467. Specify names.
  4468. Format
  4469. <identifier> ::=
  4470. [ <introducer><character set specification> ] <actual identifier>
  4471. <actual identifier> ::=
  4472. <regular identifier>
  4473. | <delimited identifier>
  4474. <SQL language identifier> ::=
  4475. <SQL language identifier start>
  4476. [ { <underscore> | <SQL language identifier part> }... ]
  4477. <SQL language identifier start> ::= <simple Latin letter>
  4478. <SQL language identifier part> ::=
  4479. <simple Latin letter>
  4480. | <digit>
  4481. <authorization identifier> ::= <identifier>
  4482. <table name> ::=
  4483. <qualified name>
  4484. | <qualified local table name>
  4485. <qualified local table name> ::=
  4486. MODULE <period> <local table name>
  4487. <local table name> ::= <qualified identifier>
  4488. <domain name> ::= <qualified name>
  4489. <schema name> ::=
  4490. [ <catalog name> <period> ] <unqualified schema name>
  4491. <unqualified schema name> ::= <identifier>
  4492. <catalog name> ::= <identifier>
  4493. <qualified name> ::=
  4494. [ <schema name> <period> ] <qualified identifier>
  4495. <qualified identifier> ::= <identifier>
  4496. <column name> ::= <identifier>
  4497. 98 Database Language SQL
  4498. X3H2-92-154/DBL CBR-002
  4499. 5.4 Names and identifiers
  4500. <correlation name> ::= <identifier>
  4501. <module name> ::= <identifier>
  4502. <cursor name> ::= <identifier>
  4503. <procedure name> ::= <identifier>
  4504. <SQL statement name> ::=
  4505. <statement name>
  4506. | <extended statement name>
  4507. <statement name> ::= <identifier>
  4508. <extended statement name> ::=
  4509. [ <scope option> ] <simple value specification>
  4510. <dynamic cursor name> ::=
  4511. <cursor name>
  4512. | <extended cursor name>
  4513. <extended cursor name> ::=
  4514. [ <scope option> ] <simple value specification>
  4515. <descriptor name> ::=
  4516. [ <scope option> ] <simple value specification>
  4517. <scope option> ::=
  4518. GLOBAL
  4519. | LOCAL
  4520. <parameter name> ::= <colon> <identifier>
  4521. <constraint name> ::= <qualified name>
  4522. <collation name> ::= <qualified name>
  4523. <character set name> ::= [ <schema name> <period> ] <SQL language identifier>
  4524. <translation name> ::= <qualified name>
  4525. <form-of-use conversion name> ::= <qualified name>
  4526. <connection name> ::= <simple value specification>
  4527. <SQL-server name> ::= <simple value specification>
  4528. <user name> ::= <simple value specification>
  4529. Lexical elements 99
  4530. X3H2-92-154/DBL CBR-002
  4531. 5.4 Names and identifiers
  4532. Syntax Rules
  4533. 1) If a <character set specification> is not specified in an <iden-
  4534. tifier>, then the set of characters contained in the <identi-
  4535. fier> shall be wholly contained in either <SQL language charac-
  4536. ter> or the character repertoire identified by:
  4537. Case:
  4538. a) If the <identifier> is contained in a <module>, then the
  4539. <module character set specification>,
  4540. b) If the <identifier> is contained in a <schema definition>
  4541. that is not contained in a <module>, then the <schema charac-
  4542. ter set specification>,
  4543. c) If the <identifier> is contained in a <preparable statement>
  4544. that is prepared in the current SQL-session by an <execute
  4545. immediate statement> or a <prepare statement> or in a <direct
  4546. SQL statement> that is invoked directly, then the default
  4547. character set name for the SQL-session.
  4548. 2) If a <character set specification> is specified in an <identi-
  4549. fier>, then:
  4550. a) There shall be no <separator> between the <introducer> and
  4551. the <character set specification>.
  4552. b) The set of characters contained in the <identifier body>
  4553. or <delimited identifier body> shall be wholly contained
  4554. in the character repertoire indicated by the <character set
  4555. specification>.
  4556. 3) The sum of the number of <SQL language identifier start>s and
  4557. the number of <SQL language identifier part>s in an <SQL lan-
  4558. guage identifier> shall not be greater than 128.
  4559. 4) An <SQL language identifier> is equivalent to an <SQL language
  4560. identifier> in which every letter that is a lower-case letter
  4561. is replaced by the equivalent upper-case letter or letters. This
  4562. treatment includes determination of equivalence, representation
  4563. in the Information and Definition Schemas, representation in the
  4564. diagnostics area, and similar uses.
  4565. 5) An <SQL language identifier> (with every letter that is a lower-
  4566. case letter replaced by the equivalent upper-case letter),
  4567. treated as the repetition of a <character string literal> that
  4568. specifies a <character set specification> of SQL_TEXT, shall not
  4569. be equal, according to the comparison rules in Subclause 8.2,
  4570. "<comparison predicate>", to any <reserved word> (with every
  4571. letter that is a lower-case letter replaced by the equivalent
  4572. upper-case letter), treated as the repetition of a <character
  4573. string literal> that specifies a <character set specification>
  4574. of SQL_TEXT.
  4575. 100 Database Language SQL
  4576. X3H2-92-154/DBL CBR-002
  4577. 5.4 Names and identifiers
  4578. Note: It is the intention that no <key word> specified in this
  4579. International standard or revisions thereto shall end with an
  4580. <underscore>.
  4581. 6) If <table name> is not a <qualified local table name>, then the
  4582. table identified by <table name> shall not be a declared local
  4583. temporary table.
  4584. 7) No <unqualified schema name> shall specify DEFINITION_SCHEMA.
  4585. 8) If a <qualified name> does not contain a <schema name>, then
  4586. Case:
  4587. a) If the <qualified name> is contained in a <schema defini-
  4588. tion>, then the <schema name> that is specified or implicit
  4589. in the <schema definition> is implicit.
  4590. b) If the <qualified name> is contained in a <preparable state-
  4591. ment> that is prepared in the current SQL-session by an <ex-
  4592. ecute immediate statement> or a <prepare statement> or in
  4593. a <direct SQL statement> that is invoked directly, then the
  4594. default <unqualified schema name> for the SQL-session is
  4595. implicit.
  4596. c) Otherwise, the <schema name> that is specified or implicit
  4597. for the <module> is implicit.
  4598. 9) If a <schema name> does not contain a <catalog name>, then
  4599. Case:
  4600. a) If the <unqualified schema name> is contained in a <mod-
  4601. ule authorization clause>, then an implementation-defined
  4602. <catalog name> is implicit.
  4603. b) If the <unqualified schema name> is contained in a <schema
  4604. definition> other than in a <schema name clause>, then the
  4605. <catalog name> that is specified or implicit in the <schema
  4606. name clause> is implicit.
  4607. c) If the <unqualified schema name> is contained in a <prepara-
  4608. ble statement> that is prepared in the current SQL-session
  4609. by an <execute immediate statement> or a <prepare statement>
  4610. or in a <direct SQL statement> that is invoked directly, then
  4611. the default catalog name for the SQL-session is implicit.
  4612. d) If the <unqualified schema name> is contained in a <schema
  4613. name clause>, then
  4614. Case:
  4615. i) If the <schema name clause> is contained in a <module>,
  4616. then the explicit or implicit <catalog name> contained in
  4617. the <module authorization clause> is implicit.
  4618. Lexical elements 101
  4619. X3H2-92-154/DBL CBR-002
  4620. 5.4 Names and identifiers
  4621. ii) Otherwise, an implementation-defined <catalog name> is
  4622. implicit.
  4623. e) Otherwise, the explicit or implicit <catalog name> contained
  4624. in the <module authorization clause> is implicit.
  4625. 10)Two <qualified name>s are equal if and only if they have the
  4626. same <qualified identifier> and the same <schema name>, regard-
  4627. less of whether the <schema name>s are implicit or explicit.
  4628. 11)Two <schema name>s are equal if and only if they have the same
  4629. <unqualified schema name> and the same <catalog name>, regard-
  4630. less of whether the <catalog name>s are implicit or explicit.
  4631. 12)An <identifier> that is a <correlation name> is associated with
  4632. a table within a particular scope. The scope of a <correlation
  4633. name> is either a <select statement: single row>, <subquery>, or
  4634. <query specification> (see Subclause 6.3, "<table reference>").
  4635. Scopes may be nested. In different scopes, the same <correlation
  4636. name> may be associated with different tables or with the same
  4637. table.
  4638. 13)The <simple value specification> of <extended statement name> or
  4639. <extended cursor name> shall not be a <literal>.
  4640. 14)The data type of the <simple value specification> of <ex-
  4641. tended statement name> shall be character string with an
  4642. implementation-defined character set and shall have an octet
  4643. length of 128 octets or less.
  4644. 15)The data type of the <simple value specification> of <extended
  4645. cursor name> shall be character string with an implementation-
  4646. defined character set and shall have an octet length of 128
  4647. octets or less.
  4648. 16)The data type of the <simple value specification> of <descriptor
  4649. name> shall be character string with an implementation-defined
  4650. character set and shall have an octet length of 128 octets or
  4651. less.
  4652. 17)In a <descriptor name>, <extended statement name>, or <extended
  4653. cursor name>, if a <scope option> is not specified, then a
  4654. <scope option> of LOCAL is implicit.
  4655. 18)No <authorization identifier> shall specify "PUBLIC".
  4656. 19)Those <identifier>s that are valid <authorization identifier>s
  4657. are implementation-defined.
  4658. 20)Those <identifier>s that are valid <catalog name>s are implementation-
  4659. defined.
  4660. 102 Database Language SQL
  4661. X3H2-92-154/DBL CBR-002
  4662. 5.4 Names and identifiers
  4663. 21)If a <character set name> does not specify a <schema name>, then
  4664. INFORMATION_SCHEMA is implicit.
  4665. 22)If a <collation name> does not specify a <schema name>, then
  4666. INFORMATION_SCHEMA is implicit.
  4667. 23)If a <translation name> does not specify a <schema name>, then
  4668. INFORMATION_SCHEMA is implicit.
  4669. 24)The <data type> of <SQL-server name>, <connection name>, and
  4670. <user name> shall be character string with an implementation-
  4671. defined character set and shall have an octet length of 128
  4672. octets or less.
  4673. 25)If a <form-of-use conversion name> does not specify a <schema
  4674. name>, then INFORMATION_SCHEMA is implicit; otherwise, INFORMATION_
  4675. SCHEMA shall be specified.
  4676. Access Rules
  4677. None.
  4678. General Rules
  4679. 1) A <table name> identifies a table.
  4680. 2) Within its scope, a <correlation name> identifies a table.
  4681. 3) A <local table name> identifies a declared local temporary ta-
  4682. ble.
  4683. 4) A <column name> identifies a column.
  4684. 5) A <domain name> identifies a domain.
  4685. 6) An <authorization identifier> represents an authorization iden-
  4686. tifier and identifies a set of privileges.
  4687. 7) A <module name> identifies a <module>.
  4688. 8) A <cursor name> identifies a cursor.
  4689. 9) A <procedure name> identifies a <procedure>.
  4690. 10)A <parameter name> identifies a parameter.
  4691. 11)A <constraint name> identifies a table constraint, a domain
  4692. constraint, or an assertion.
  4693. 12)A <statement name> identifies a statement prepared by the execu-
  4694. tion of a <prepare statement>. The scope of a <statement name>
  4695. is the <module> in which it appears and the current SQL-session.
  4696. Lexical elements 103
  4697. X3H2-92-154/DBL CBR-002
  4698. 5.4 Names and identifiers
  4699. 13)The value of an <extended statement name> identifies a statement
  4700. prepared by the execution of a <prepare statement>. If a <scope
  4701. option> of GLOBAL is specified, then the scope of the <extended
  4702. statement name> is the current SQL-session. If a <scope option>
  4703. of LOCAL is specified or implicit, then the scope of the state-
  4704. ment name is further restricted to the <module> in which the
  4705. <extended statement name> appears.
  4706. 14)A <dynamic cursor name> identifies a cursor in an <SQL dynamic
  4707. statement>.
  4708. 15)The value of an <extended cursor name> identifies a cursor cre-
  4709. ated by the execution of an <allocate cursor statement>. If a
  4710. <scope option> of GLOBAL is specified, then the scope of the
  4711. <extended cursor name> is the current SQL-session. If a <scope
  4712. option> of LOCAL is specified of implicit, then the scope of the
  4713. cursor name is further restricted to the <module> in which the
  4714. <extended cursor name> appears.
  4715. 16)A <descriptor name> identifies an SQL descriptor area created
  4716. by the execution of an <allocate descriptor statement>. If a
  4717. <scope option> of GLOBAL is specified, then the scope of the
  4718. <descriptor name> is the current SQL-session. If a <scope op-
  4719. tion> of LOCAL is specified or implicit, then the scope of the
  4720. <descriptor name> is further restricted to the <module> in which
  4721. the <descriptor name> appears.
  4722. 17)A <catalog name> identifies a catalog.
  4723. 18)A <schema name> identifies a schema.
  4724. 19)A <collation name> identifies a collating sequence.
  4725. 20)A <character set name> identifies a character set.
  4726. 21)A <translation name> identifies a character translation.
  4727. 22)A <form-of-use conversion name> identifies a form-of-use con-
  4728. version. All <form-of-use conversion name>s are implementation-
  4729. defined.
  4730. 23)A <connection name> identifies an SQL-connection.
  4731. Leveling Rules
  4732. 1) The following restrictions apply for Intermediate SQL:
  4733. a) Conforming Intermediate SQL language shall not contain any
  4734. <extended statement name> or <extended cursor name>.
  4735. b) Conforming Intermediate SQL language shall not contain any
  4736. explicit <catalog name>, <connection name>, <collation name>,
  4737. <translation name>, <form-of-use conversion name>, or <quali-
  4738. fied local table name>.
  4739. 104 Database Language SQL
  4740. X3H2-92-154/DBL CBR-002
  4741. 5.4 Names and identifiers
  4742. 2) The following restrictions apply for Entry SQL in addition to
  4743. any Intermediate SQL restrictions:
  4744. a) Conforming Entry SQL language shall not contain any <domain
  4745. name>, <SQL statement name>, <dynamic cursor name>, <con-
  4746. straint name>, <descriptor name>, or <character set name>.
  4747. b) An <identifier> shall not specify a <character set specifica-
  4748. tion>.
  4749. Lexical elements 105
  4750. X3H2-92-154/DBL CBR-002
  4751. 106 Database Language SQL
  4752. X3H2-92-154/DBL CBR-002
  4753. 6 Scalar expressions
  4754. 6.1 <data type>
  4755. Function
  4756. Specify a data type.
  4757. Format
  4758. <data type> ::=
  4759. <character string type> [ CHARACTER SET <character set specification> ]
  4760. | <national character string type>
  4761. | <bit string type>
  4762. | <numeric type>
  4763. | <datetime type>
  4764. | <interval type>
  4765. <character string type> ::=
  4766. CHARACTER [ <left paren> <length> <right paren> ]
  4767. | CHAR [ <left paren> <length> <right paren> ]
  4768. | CHARACTER VARYING <left paren> <length> <right paren>
  4769. | CHAR VARYING <left paren> <length> <right paren>
  4770. | VARCHAR <left paren> <length> <right paren>
  4771. <national character string type> ::=
  4772. NATIONAL CHARACTER [ <left paren> <length> <right paren> ]
  4773. | NATIONAL CHAR [ <left paren> <length> <right paren> ]
  4774. | NCHAR [ <left paren> <length> <right paren> ]
  4775. | NATIONAL CHARACTER VARYING <left paren> <length> <right paren>
  4776. | NATIONAL CHAR VARYING <left paren> <length> <right paren>
  4777. | NCHAR VARYING <left paren> <length> <right paren>
  4778. <bit string type> ::=
  4779. BIT [ <left paren> <length> <right paren> ]
  4780. | BIT VARYING <left paren> <length> <right paren>
  4781. <numeric type> ::=
  4782. <exact numeric type>
  4783. | <approximate numeric type>
  4784. <exact numeric type> ::=
  4785. NUMERIC [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
  4786. | DECIMAL [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
  4787. Scalar expressions 107
  4788. X3H2-92-154/DBL CBR-002
  4789. 6.1 <data type>
  4790. | DEC [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
  4791. | INTEGER
  4792. | INT
  4793. | SMALLINT
  4794. <approximate numeric type> ::=
  4795. FLOAT [ <left paren> <precision> <right paren> ]
  4796. | REAL
  4797. | DOUBLE PRECISION
  4798. <length> ::= <unsigned integer>
  4799. <precision> ::= <unsigned integer>
  4800. <scale> ::= <unsigned integer>
  4801. <datetime type> ::=
  4802. DATE
  4803. | TIME [ <left paren> <time precision> <right paren> ]
  4804. [ WITH TIME ZONE ]
  4805. | TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
  4806. [ WITH TIME ZONE ]
  4807. <time precision> ::= <time fractional seconds precision>
  4808. <timestamp precision> ::= <time fractional seconds precision>
  4809. <time fractional seconds precision> ::= <unsigned integer>
  4810. <interval type> ::= INTERVAL <interval qualifier>
  4811. Syntax Rules
  4812. 1) CHAR is equivalent to CHARACTER. DEC is equivalent to DECIMAL.
  4813. INT is equivalent to INTEGER. VARCHAR is equivalent to CHARACTER
  4814. VARYING. NCHAR is equivalent to NATIONAL CHARACTER.
  4815. 2) "NATIONAL CHARACTER" is equivalent to the corresponding <char-
  4816. acter string type> with a specification of "CHARACTER SET CSN",
  4817. where "CSN" is an implementation-defined <character set name>.
  4818. 3) The value of a <length> or a <precision> shall be greater than
  4819. 0.
  4820. 4) If <length> is omitted, then a <length> of 1 is implicit.
  4821. 5) If a <scale> is omitted, then a <scale> of 0 is implicit.
  4822. 6) If a <precision> is omitted, then an implementation-defined
  4823. <precision> is implicit.
  4824. 7) CHARACTER specifies the data type character string.
  4825. 108 Database Language SQL
  4826. X3H2-92-154/DBL CBR-002
  4827. 6.1 <data type>
  4828. 8) Characters in a character string are numbered beginning with 1.
  4829. 9) Case:
  4830. a) If VARYING is not specified in <character string type>, then
  4831. the length in characters of the character string is fixed and
  4832. is the value of <length>.
  4833. b) If VARYING is specified in <character string type>, then the
  4834. length in characters of the character string is variable,
  4835. with a minimum length of 0 and a maximum length of the value
  4836. of <length>.
  4837. The maximum value of <length> is implementation-defined.
  4838. <length> shall not be greater than this maximum value.
  4839. 10)If <character string type> is not contained in a <domain def-
  4840. inition> or a <column definition> and CHARACTER SET is not
  4841. specified, then an implementation-defined <character set speci-
  4842. fication> is implicit.
  4843. Note: Subclause 11.21, "<domain definition>", and Subclause 11.4,
  4844. "<column definition>", specify the result when <character string
  4845. type> is contained in a <domain definition> or <column defini-
  4846. tion>, respectively.
  4847. 11)The character set named SQL_TEXT is an implementation-defined
  4848. character set whose character repertoire is SQL_TEXT.
  4849. Note: The character repertoire SQL_TEXT is defined in Subclause 4.2,
  4850. "Character strings".
  4851. 12)BIT specifies the data type bit string.
  4852. 13)Bits in a bit string are numbered beginning with 1.
  4853. 14)Case:
  4854. a) If VARYING is not specified in <bit string type>, then the
  4855. length in bits of the bit string is fixed and is the value of
  4856. <length>.
  4857. b) If VARYING is specified in <bit string type>, then the length
  4858. in bits of the string is variable, with a minimum length of 0
  4859. and a maximum length of the value of <length>.
  4860. The maximum value of <length> is implementation-defined.
  4861. <length> shall not be greater than this maximum value.
  4862. 15)The <scale> of an <exact numeric type> shall not be greater than
  4863. the <precision> of the <exact numeric type>.
  4864. 16)For the <exact numeric type>s DECIMAL and NUMERIC:
  4865. a) The maximum value of <precision> is implementation-defined.
  4866. <precision> shall not be greater than this value.
  4867. Scalar expressions 109
  4868. X3H2-92-154/DBL CBR-002
  4869. 6.1 <data type>
  4870. b) The maximum value of <scale> is implementation-defined.
  4871. <scale> shall not be greater than this maximum value.
  4872. 17)NUMERIC specifies the data type exact numeric, with the decimal
  4873. precision and scale specified by the <precision> and <scale>.
  4874. 18)DECIMAL specifies the data type exact numeric, with the decimal
  4875. scale specified by the <scale> and the implementation-defined
  4876. decimal precision equal to or greater than the value of the
  4877. specified <precision>.
  4878. 19)INTEGER specifies the data type exact numeric, with binary or
  4879. decimal precision and scale of 0. The choice of binary versus
  4880. decimal precision is implementation-defined, but shall be the
  4881. same as SMALLINT.
  4882. 20)SMALLINT specifies the data type exact numeric, with scale of
  4883. 0 and binary or decimal precision. The choice of binary versus
  4884. decimal precision is implementation-defined, but shall be the
  4885. same as INTEGER. The precision of SMALLINT shall be less than or
  4886. equal to the precision of INTEGER.
  4887. 21)FLOAT specifies the data type approximate numeric, with binary
  4888. precision equal to or greater than the value of the specified
  4889. <precision>. The maximum value of <precision> is implementation-
  4890. defined. <precision> shall not be greater than this value.
  4891. 22)REAL specifies the data type approximate numeric, with implementation-
  4892. defined precision.
  4893. 23)DOUBLE PRECISION specifies the data type approximate numeric,
  4894. with implementation-defined precision that is greater than the
  4895. implementation-defined precision of REAL.
  4896. 24)For the <approximate numeric type>s FLOAT, REAL, and DOUBLE
  4897. PRECISION, the maximum and minimum values of the exponent are
  4898. implementation-defined.
  4899. 25)If <time precision> is not specified, then 0 is implicit. If
  4900. <timestamp precision> is not specified, then 6 is implicit.
  4901. 26)The maximum value of <time precision> and the maximum value of
  4902. <timestamp precision> shall be the same implementation-defined
  4903. value that is not less than 6. The values of <time precision>
  4904. and <timestamp precision> shall not be greater than that maximum
  4905. value.
  4906. 27)The length of a DATE is 10 positions. The length of a TIME is 8
  4907. positions plus the <time fractional seconds precision>, plus 1
  4908. position if the <time fractional seconds precision> is greater
  4909. than 0. The length of a TIME WITH TIME ZONE is 14 positions
  4910. plus the <time fractional seconds precision> plus 1 position if
  4911. the <time fractional seconds precision> is greater than 0. The
  4912. length of a TIMESTAMP is 19 positions plus the <time fractional
  4913. 110 Database Language SQL
  4914. X3H2-92-154/DBL CBR-002
  4915. 6.1 <data type>
  4916. seconds precision>, plus 1 position if the <time fractional sec-
  4917. onds precision> is greater than 0. The length of a TIMESTAMP
  4918. WITH TIME ZONE is 25 positions plus the <time fractional sec-
  4919. onds precision> plus 1 position if the <time fractional seconds
  4920. precision> is greater than 0.
  4921. 28)If an <interval qualifier> in an <interval type> includes no
  4922. fields other than YEAR and MONTH, then the <interval type> is a
  4923. year-month interval. If an <interval qualifier> in an <interval
  4924. type> includes any fields other than YEAR or MONTH, then the
  4925. <interval type> is a day-time interval.
  4926. 29)The i-th value of an interval data type corresponds to the i-th
  4927. <datetime field>.
  4928. 30)Within the non-null values of a <datetime type>, the value of
  4929. the time zone interval shall be in the range -12:59 to +13:00.
  4930. Note: The range for time zone intervals is larger than many
  4931. readers might expect because it is governed by political deci-
  4932. sions in governmental bodies rather than by any natural law.
  4933. Access Rules
  4934. None.
  4935. General Rules
  4936. 1) If any specification or operation attempts to cause an item of
  4937. a character type to contain a character that is not a member
  4938. of the character repertoire associated with the character item,
  4939. then an exception condition is raised: data exception-character
  4940. not in repertoire.
  4941. 2) For a <datetime type>,
  4942. Case:
  4943. a) If DATE is specified, then the data type contains the <date-
  4944. time field>s years, months, and days.
  4945. b) If TIME is specified, then the data type contains the <date-
  4946. time field>s hours, minutes, and seconds.
  4947. c) If TIMESTAMP is specified, then the data type contains the
  4948. <datetime field>s years, months, days, hours, minutes, and
  4949. seconds.
  4950. 3) For a <datetime type>, a <time fractional seconds precision>
  4951. that is an explicit or implicit <time precision> or <timestamp
  4952. precision> defines the number of decimal digits following the
  4953. decimal point in the SECOND <datetime field>.
  4954. Scalar expressions 111
  4955. X3H2-92-154/DBL CBR-002
  4956. 6.1 <data type>
  4957. 4) Table 10, "Valid values for fields in datetime items", specifies
  4958. the constraints on the values of the <datetime field>s in a
  4959. datetime data type.
  4960. _________Table_10-Valid_values_for_fields_in_datetime_items________
  4961. _Keyword____________Valid_values_of_datetime_fields________________
  4962. | YEAR | 0001 to 9999 |
  4963. | | |
  4964. | MONTH | 01 to 12 |
  4965. | | |
  4966. | DAY | Within the range 1 to 31, but further con- |
  4967. strained by the value of MONTH and YEAR
  4968. fields, according to the rules for well-
  4969. formed dates in the Gregorian calendar.
  4970. | HOUR | 00 to 23 |
  4971. | | |
  4972. | MINUTE | 00 to 59 |
  4973. | | |
  4974. | SECOND | 00 to 61.9(N) where "9(N)" indicates the num- |
  4975. ber of digits specified by <time fractional
  4976. seconds precision>.
  4977. | TIMEZONE_HOUR | 00 to 13 |
  4978. | | |
  4979. |_TIMEZONE_MINUTE__|_00_to_59______________________________________|
  4980. | | |
  4981. Note: Datetime data types will allow dates in the Gregorian
  4982. format to be stored in the date range 0001-01-01 CE through
  4983. 9999-12-31 CE. The range for SECOND allows for as many as two
  4984. "leap seconds". Interval arithmetic that involves leap seconds
  4985. or discontinuities in calendars will produce implementation-
  4986. defined results.
  4987. 5) If WITH TIME ZONE is not specified, then the time zone dis-
  4988. placement of the datetime data type is effectively the current
  4989. default time zone displacement of the SQL-session.
  4990. 6) If any specification or operation attempts to cause an item
  4991. of type datetime to take a value where the <datetime field>
  4992. YEAR has the value greater than 9999 or less than 1, then an
  4993. exception condition is raised: data exception-invalid datetime
  4994. format.
  4995. 7) The values of the <datetime field>s within an interval data type
  4996. are constrained as follows:
  4997. a) The value corresponding to the first <datetime field> is
  4998. an integer with at most N digits, where N is the <interval
  4999. leading field precision>.
  5000. b) Table 11, "Valid values for fields in INTERVAL items", spec-
  5001. ifies the constraints for the other <datetime field>s in the
  5002. interval data type.
  5003. 112 Database Language SQL
  5004. X3H2-92-154/DBL CBR-002
  5005. 6.1 <data type>
  5006. _________Table_11-Valid_values_for_fields_in_INTERVAL_items________
  5007. _Keyword______Valid_values_of_INTERVAL_fields______________________
  5008. | MONTH | 0 to 11 |
  5009. | | |
  5010. | HOUR | 0 to 23 |
  5011. | | |
  5012. | MINUTE | 0 to 59 |
  5013. | | |
  5014. | SECOND | 0 to 59.9(N) where "9(N)" indicates the number of |
  5015. digits specified by <interval fractional seconds
  5016. ______________precision>_in_the_<interval_qualifier>.______________
  5017. |8) An item o| type interval can contain positive or negative inter|
  5018. | vals. | |
  5019. | | |
  5020. Leveling Rules
  5021. 1) The following restrictions apply for Intermediate SQL:
  5022. a) A <datetime type> shall not specify a <time precision> or
  5023. <timestamp precision>.
  5024. b) A <data type> shall not be a <bit string type>.
  5025. 2) The following restrictions apply for Entry SQL in addition to
  5026. any Intermediate SQL restrictions:
  5027. a) A <character string type> shall not specify VARYING or
  5028. VARCHAR.
  5029. b) A <data type> shall not be a <datetime type> or an <interval
  5030. type>.
  5031. c) A <data type> shall not be a <national character string type>
  5032. nor specify CHARACTER SET.
  5033. Scalar expressions 113
  5034. X3H2-92-154/DBL CBR-002
  5035. 6.2 <value specification> and <target specification>
  5036. 6.2 <value specification> and <target specification>
  5037. Function
  5038. Specify one or more values, parameters, or variables.
  5039. Format
  5040. <value specification> ::=
  5041. <literal>
  5042. | <general value specification>
  5043. <unsigned value specification> ::=
  5044. <unsigned literal>
  5045. | <general value specification>
  5046. <general value specification> ::=
  5047. <parameter specification>
  5048. | <dynamic parameter specification>
  5049. | <variable specification>
  5050. | USER
  5051. | CURRENT_USER
  5052. | SESSION_USER
  5053. | SYSTEM_USER
  5054. | VALUE
  5055. <simple value specification> ::=
  5056. <parameter name>
  5057. | <embedded variable name>
  5058. | <literal>
  5059. <target specification> ::=
  5060. <parameter specification>
  5061. | <variable specification>
  5062. <simple target specification> ::=
  5063. <parameter name>
  5064. | <embedded variable name>
  5065. <parameter specification> ::=
  5066. <parameter name> [ <indicator parameter> ]
  5067. <indicator parameter> ::=
  5068. [ INDICATOR ] <parameter name>
  5069. <dynamic parameter specification> ::= <question mark>
  5070. <variable specification> ::=
  5071. <embedded variable name> [ <indicator variable> ]
  5072. <indicator variable> ::=
  5073. [ INDICATOR ] <embedded variable name>
  5074. 114 Database Language SQL
  5075. X3H2-92-154/DBL CBR-002
  5076. 6.2 <value specification> and <target specification>
  5077. Syntax Rules
  5078. 1) The data type of an <indicator parameter> or <indicator vari-
  5079. able> shall be exact numeric with a scale of 0.
  5080. 2) Each <parameter name> shall be contained in a <module>. Each
  5081. <embedded variable name> shall be contained in an <embedded
  5082. SQL statement>. Each <dynamic parameter specification> shall
  5083. be contained in a <preparable statement> that is dynamically
  5084. prepared in the current SQL-session through the execution of a
  5085. <prepare statement> or an <execute immediate statement>.
  5086. 3) If USER is specified, then CURRENT_USER is implicit.
  5087. 4) The data type of CURRENT_USER, SESSION_USER, and SYSTEM_USER is
  5088. character string. Whether the character string is fixed-length
  5089. or variable-length, and its length if it is fixed-length or
  5090. maximum length if it is variable-length, are implementation-
  5091. defined. The character set of the character string is SQL_TEXT.
  5092. 5) The <value specification> or <unsigned value specification>
  5093. VALUE shall be contained in a <domain constraint>. The data
  5094. type of an instance of VALUE is the <data type> of the <domain
  5095. definition> containing that <domain constraint>.
  5096. 6) If the data type of the <value specification> or <unsigned value
  5097. specification> is character string, then the <value specifi-
  5098. cation> or <unsigned value specification> has the Coercible
  5099. coercibility attribute, and the collating sequence is deter-
  5100. mined by Subclause 4.2.3, "Rules determining collating sequence
  5101. usage".
  5102. Access Rules
  5103. None.
  5104. General Rules
  5105. 1) A <value specification> or <unsigned value specification> speci-
  5106. fies a value that is not selected from a table.
  5107. 2) A <parameter specification> identifies a parameter or a parame-
  5108. ter and an indicator parameter in a <module>.
  5109. 3) A <dynamic parameter specification> identifies a parameter used
  5110. by a dynamically prepared statement.
  5111. 4) A <variable specification> identifies a host variable or a host
  5112. variable and an indicator variable.
  5113. 5) A <target specification> specifies a parameter or variable that
  5114. can be assigned a value.
  5115. Scalar expressions 115
  5116. X3H2-92-154/DBL CBR-002
  5117. 6.2 <value specification> and <target specification>
  5118. 6) If a <parameter specification> contains an <indicator parame-
  5119. ter> and the value of the indicator parameter is negative, then
  5120. the value specified by the <parameter specification> is null.
  5121. Otherwise, the value specified by a <parameter specification> is
  5122. the value of the parameter identified by the <parameter name>.
  5123. 7) If a <variable specification> contains an <indicator vari-
  5124. able> and the value of the indicator variable is negative, then
  5125. the value specified by the <variable specification> is null.
  5126. Otherwise, the value specified by a <variable specification> is
  5127. the value of the variable identified by the <embedded variable
  5128. name>.
  5129. 8) The value specified by a <literal> is the value represented by
  5130. that <literal>.
  5131. 9) The value specified by CURRENT_USER is the value of the current
  5132. <authorization identifier>.
  5133. 10)The value specified by SESSION_USER is the value of the SQL-
  5134. session <authorization identifier>.
  5135. 11)The value specified by SYSTEM_USER is equal to an implementation-
  5136. defined string that represents the operating system user who
  5137. executed the <module> that contains the SQL-statement whose ex-
  5138. ecution caused the SYSTEM_USER <general value specification> to
  5139. be evaluated.
  5140. 12)A <simple value specification> specifies a <value specifica-
  5141. tion> or <unsigned value specification> that is not null and
  5142. does not have an associated <indicator parameter> or <indicator
  5143. variable>.
  5144. 13)A <simple target specification> specifies a parameter or vari-
  5145. able that can be assigned a value that is not null.
  5146. Leveling Rules
  5147. 1) The following restrictions apply for Intermediate SQL:
  5148. a) In Intermediate SQL, the specific data type of <indicator
  5149. parameter>s and <indicator variable>s shall be the same
  5150. implementation-defined data type.
  5151. 2) The following restrictions apply for Entry SQL in addition to
  5152. any Intermediate SQL restrictions:
  5153. a) A <general value specification> shall not be a <dynamic pa-
  5154. rameter specification>.
  5155. b) A <general value specification> shall not specify VALUE.
  5156. 116 Database Language SQL
  5157. X3H2-92-154/DBL CBR-002
  5158. 6.2 <value specification> and <target specification>
  5159. c) A <general value specification> shall not specify CURRENT_
  5160. USER, SYSTEM_USER, or SESSION_USER.
  5161. Note: Although CURRENT_USER and USER are semantically the
  5162. same, in Entry SQL, CURRENT_USER must be specified as USER.
  5163. Scalar expressions 117
  5164. X3H2-92-154/DBL CBR-002
  5165. 6.3 <table reference>
  5166. 6.3 <table reference>
  5167. Function
  5168. Reference a table.
  5169. Format
  5170. <table reference> ::=
  5171. <table name> [ [ AS ] <correlation name>
  5172. [ <left paren> <derived column list> <right paren> ] ]
  5173. | <derived table> [ AS ] <correlation name>
  5174. [ <left paren> <derived column list> <right paren> ]
  5175. | <joined table>
  5176. <derived table> ::= <table subquery>
  5177. <derived column list> ::= <column name list>
  5178. <column name list> ::=
  5179. <column name> [ { <comma> <column name> }... ]
  5180. Syntax Rules
  5181. 1) A <correlation name> immediately contained in a <table refer-
  5182. ence> TR is exposed by TR. A <table name> immediately contained
  5183. in a <table reference> TR is exposed by TR if and only if TR
  5184. does not specify a <correlation name>.
  5185. 2) Case:
  5186. a) If a <table reference> TR is contained in a <from clause> FC
  5187. with no intervening <derived table>, then the scope clause
  5188. SC of TR is the <select statement: single row> or innermost
  5189. <query specification> that contains FC. The scope clause of
  5190. the exposed <correlation name> or exposed <table name> of TR
  5191. is the <select list>, <where clause>, <group by clause>, and
  5192. <having clause> of SC, together with the <join condition> of
  5193. all <joined table>s contained in SC that contains TR.
  5194. b) Otherwise, the scope clause SC of TR is the outermost <joined
  5195. table> that contains TR with no intervening <derived table>.
  5196. The scope of the exposed <correlation name> or exposed <table
  5197. name> of TR is the <join condition> of SC and of all <joined
  5198. table>s contained in SC that contain TR.
  5199. 3) A <table name> that is exposed by a <table reference> TR shall
  5200. not be the same as any other <table name> that is exposed by a
  5201. <table reference> with the same scope clause as TR.
  5202. 118 Database Language SQL
  5203. X3H2-92-154/DBL CBR-002
  5204. 6.3 <table reference>
  5205. 4) A <correlation name> that is exposed by a <table reference> TR
  5206. shall not be the same as any other <correlation name> that is
  5207. exposed by a <table reference> with the same scope clause as TR
  5208. and shall not be the same as the <qualified identifier> of any
  5209. <table name> that is exposed by a <table reference> with the
  5210. same scope clause as TR.
  5211. 5) A <table name> immediately contained in a <table reference> TR
  5212. has a scope clause and scope defined by that <table reference>
  5213. if and only if the <table name> is exposed by TR.
  5214. 6) The same <column name> shall not be specified more than once in
  5215. a <derived column list>.
  5216. 7) If a <derived column list> is specified in a <table reference>,
  5217. then the number of <column name>s in the <derived column list>
  5218. shall be the same as the degree of the table specified by the
  5219. <derived table> or the <table name> of that <table reference>,
  5220. and the name of the i-th column of that <derived table> or the
  5221. effective name of the i-th column of that <table name> is the
  5222. i-th <column name> in that <derived column list>.
  5223. 8) A <derived table> is an updatable derived table if and only if
  5224. the <query expression> simply contained in the <subquery> of the
  5225. <table subquery> of the <derived table> is updatable.
  5226. Access Rules
  5227. 1) Let T be the table identified by the <table name> immediately
  5228. contained in <table reference>. If the <table reference> is
  5229. contained in any of:
  5230. a) a <query expression> simply contained in a <cursor speci-
  5231. fication>, a <view definition>, a <direct select statement:
  5232. multiple rows>, or an <insert statement>; or
  5233. b) a <table expression> or <select list> immediately contained
  5234. in a <select statement: single row>; or
  5235. c) a <search condition> immediately contained in a <delete
  5236. statement: searched> or an <update statement: searched>; or
  5237. d) a <value expression> immediately contained in an <update
  5238. source>,
  5239. then the applicable privileges shall include SELECT for T.
  5240. General Rules
  5241. 1) The <correlation name> or exposed <table name> contained in a
  5242. <table reference> defines that <correlation name> or <table
  5243. name> to be an identifier of the table identified by the <table
  5244. name> or <derived table> of that <table reference>.
  5245. Scalar expressions 119
  5246. X3H2-92-154/DBL CBR-002
  5247. 6.3 <table reference>
  5248. Leveling Rules
  5249. 1) The following restrictions apply for Intermediate SQL:
  5250. a) A <table reference> shall not be a <derived table>.
  5251. 2) The following restrictions apply for Entry SQL in addition to
  5252. any Intermediate SQL restrictions:
  5253. a) A <table reference> shall not be a <joined table>.
  5254. b) The optional <key word> AS shall not be specified.
  5255. c) <derived column list> shall not be specified.
  5256. 120 Database Language SQL
  5257. X3H2-92-154/DBL CBR-002
  5258. 6.4 <column reference>
  5259. 6.4 <column reference>
  5260. Function
  5261. Reference a column.
  5262. Format
  5263. <column reference> ::= [ <qualifier> <period> ] <column name>
  5264. <qualifier> ::=
  5265. <table name>
  5266. | <correlation name>
  5267. Syntax Rules
  5268. 1) Let CR be the <column reference>, let CN be the <column name>
  5269. contained in CR, and let C be the column identified by CN.
  5270. 2) If CR contains a <qualifier> Q, then CR shall appear within the
  5271. scope of one or more <table name>s or <correlation name>s that
  5272. are equal to Q. If there is more than one such <table name> or
  5273. <correlation name>, then the one with the most local scope is
  5274. specified. Let T be the table associated with Q.
  5275. a) T shall include a column whose <column name> is CN.
  5276. b) If T is a <table reference> in a <joined table> J, then CN
  5277. shall not be a common column name in J.
  5278. Note: Common column name is defined in Subclause 7.5, "<joined
  5279. table>".
  5280. 3) If CR does not contain a <qualifier>, then CR shall be contained
  5281. within the scope of one or more <table name>s or <correlation
  5282. name>s whose associated tables include a column whose <column
  5283. name> is CN. Let the phrase possible qualifiers denote those
  5284. <table name>s and <correlation name>s.
  5285. a) Case:
  5286. i) If the most local scope contains exactly one possible
  5287. qualifier, then the qualifier Q equivalent to that unique
  5288. <table name> or <correlation name> is implicit.
  5289. ii) If there is more than one possible qualifier with most
  5290. local scope, then:
  5291. 1) Each possible qualifier shall be a <table name> or a
  5292. <correlation name> of a <table reference> that is di-
  5293. rectly contained in a <joined table> J.
  5294. Scalar expressions 121
  5295. X3H2-92-154/DBL CBR-002
  5296. 6.4 <column reference>
  5297. 2) CN shall be a common column name in J.
  5298. Note: Common column name is defined in Subclause 7.5,
  5299. "<joined table>".
  5300. 3) The implicit qualifier Q is implementation-dependent.
  5301. The scope of Q is that which Q would have had if J had
  5302. been replaced by the <table reference>:
  5303. ( J ) AS Q
  5304. b) Let T be the table associated with Q.
  5305. 4) The data type of CR is the data type of column C of T. CN shall
  5306. uniquely identify a column of T.
  5307. 5) If the data type of CR is character string, then CR has the
  5308. Implicit coercibility attribute and its collating sequence is
  5309. the default collating sequence for column C of T.
  5310. 6) If the data type of CR is TIME or TIMESTAMP, then the implicit
  5311. time zone of the data is the current default time zone for the
  5312. SQL-session.
  5313. 7) If the data type of CR is TIME WITH TIME ZONE or TIMESTAMP WITH
  5314. TIME ZONE, then the time zone of the data is the time zone rep-
  5315. resented in the value of CR.
  5316. 8) If CR is contained in a <table expression> TE and the scope
  5317. clause of the <table reference> immediately containing the <ta-
  5318. ble name> or <correlation name> Q also contains TE, then CR is
  5319. an outer reference to the table associated with Q.
  5320. 9) Let CR be the <column reference> and let C be the column identi-
  5321. fied by CR. C is an underlying column of CR. If C is a <derived
  5322. column>, then every underlying column of C is an underlying
  5323. column of CR.
  5324. Note: The underlying columns of a <derived column> are defined
  5325. in Subclause 7.9, "<query specification>".
  5326. Access Rules
  5327. 1) The applicable privileges shall include SELECT for T if CR is
  5328. contained in any of:
  5329. a) a <search condition> immediately contained in a <delete
  5330. statement: searched> or an <update statement: searched>; or
  5331. b) a <value expression> immediately contained in an <update
  5332. source>.
  5333. 122 Database Language SQL
  5334. X3H2-92-154/DBL CBR-002
  5335. 6.4 <column reference>
  5336. General Rules
  5337. 1) The <column reference> Q.CN references column C in a given row
  5338. of T.
  5339. 2) If the data type of CR is TIME, TIMESTAMP, TIME WITH TIME ZONE
  5340. or TIMESTAMP WITH TIME ZONE, then let TZ be an INTERVAL HOUR
  5341. TO MINUTE containing the value of the time zone displacement
  5342. associated with CR. The value of CR, normalized to UTC, is ef-
  5343. fectively computed as
  5344. CR + TZ.
  5345. Leveling Rules
  5346. 1) The following restrictions apply for Intermediate SQL;
  5347. None.
  5348. 2) The following restrictions apply for Entry SQL;
  5349. None.
  5350. Scalar expressions 123
  5351. X3H2-92-154/DBL CBR-002
  5352. 6.5 <set function specification>
  5353. 6.5 <set function specification>
  5354. Function
  5355. Specify a value derived by the application of a function to an
  5356. argument.
  5357. Format
  5358. <set function specification> ::=
  5359. COUNT <left paren> <asterisk> <right paren>
  5360. | <general set function>
  5361. <general set function> ::=
  5362. <set function type>
  5363. <left paren> [ <set quantifier> ] <value expression> <right paren>
  5364. <set function type> ::=
  5365. AVG | MAX | MIN | SUM | COUNT
  5366. <set quantifier> ::= DISTINCT | ALL
  5367. Syntax Rules
  5368. 1) If <set quantifier> is not specified, then ALL is implicit.
  5369. 2) The argument of COUNT(*) and the argument source of a <general
  5370. set function> is a table or a group of a grouped table as spec-
  5371. ified in Subclause 7.8, "<having clause>", and Subclause 7.9,
  5372. "<query specification>".
  5373. Note: argument source is defined in Subclause 7.8, "<having
  5374. clause>".
  5375. 3) Let T be the argument or argument source of a <set function
  5376. specification>.
  5377. 4) The <value expression> simply contained in <set function spec-
  5378. ification> shall not contain a <set function specification> or
  5379. a <subquery>. If the <value expression> contains a <column ref-
  5380. erence> that is an outer reference, then that outer reference
  5381. shall be the only <column reference> contained in the <value
  5382. expression>.
  5383. Note: Outer reference is defined in Subclause 6.4, "<column
  5384. reference>".
  5385. 5) If a <set function specification> contains a <column reference>
  5386. that is an outer reference, then the <set function specifica-
  5387. tion> shall be contained in either:
  5388. a) a <select list>, or
  5389. 124 Database Language SQL
  5390. X3H2-92-154/DBL CBR-002
  5391. 6.5 <set function specification>
  5392. b) a <subquery> of a <having clause>, in which case the scope
  5393. of the explicit or implicit <qualifier> of the <column refer-
  5394. ence> shall be a <table reference> that is directly contained
  5395. in the <table expression> that directly contains the <having
  5396. clause>.
  5397. Note: Outer reference is defined in Subclause 6.4, "<column
  5398. reference>".
  5399. 6) Let DT be the data type of the <value expression>.
  5400. 7) If COUNT is specified, then the data type of the result is exact
  5401. numeric with implementation-defined precision and scale of 0.
  5402. 8) If MAX or MIN is specified, then the data type of the result is
  5403. DT.
  5404. 9) If SUM or AVG is specified, then:
  5405. a) DT shall not be character string, bit string, or datetime.
  5406. b) If SUM is specified and DT is exact numeric with scale
  5407. S, then the data type of the result is exact numeric with
  5408. implementation-defined precision and scale S.
  5409. c) If AVG is specified and DT is exact numeric, then the data
  5410. type of the result is exact numeric with implementation-
  5411. defined precision not less than the precision of DT and
  5412. implementation-defined scale not less than the scale of DT.
  5413. d) If DT is approximate numeric, then the data type of the
  5414. result is approximate numeric with implementation-defined
  5415. precision not less than the precision of DT.
  5416. e) If DT is interval, then the data type of the result is inter-
  5417. val with the same precision as DT.
  5418. 10)If the data type of the result is character string, then the
  5419. collating sequence and the coercibility attribute are determined
  5420. as in Subclause 4.2.3, "Rules determining collating sequence
  5421. usage".
  5422. Access Rules
  5423. None.
  5424. General Rules
  5425. 1) Case:
  5426. a) If COUNT(*) is specified, then the result is the cardinality
  5427. of T.
  5428. Scalar expressions 125
  5429. X3H2-92-154/DBL CBR-002
  5430. 6.5 <set function specification>
  5431. b) Otherwise, let TX be the single-column table that is the
  5432. result of applying the <value expression> to each row of T
  5433. and eliminating null values. If one or more null values are
  5434. eliminated, then a completion condition is raised: warning-
  5435. null value eliminated in set function.
  5436. 2) If DISTINCT is specified, then let TXA be the result of elimi-
  5437. nating redundant duplicate values from TX. Otherwise, let TXA be
  5438. TX.
  5439. Case:
  5440. a) If the <general set function> COUNT is specified, then the
  5441. result is the cardinality of TXA.
  5442. b) If AVG, MAX, MIN, or SUM is specified, then
  5443. Case:
  5444. i) If TXA is empty, then the result is the null value.
  5445. ii) If AVG is specified, then the result is the average of the
  5446. values in TXA.
  5447. iii) If MAX or MIN is specified, then the result is respec-
  5448. tively the maximum or minimum value in TXA. These results
  5449. are determined using the comparison rules specified in
  5450. Subclause 8.2, "<comparison predicate>".
  5451. iv) If SUM is specified, then the result is the sum of the
  5452. values in TXA. If the sum is not within the range of the
  5453. data type of the result, then an exception condition is
  5454. raised: data exception-numeric value out of range.
  5455. Leveling Rules
  5456. 1) The following restrictions apply for Intermediate SQL:
  5457. a) If a <general set function> specifies DISTINCT, then the
  5458. <value expression> shall be a <column reference>.
  5459. 2) The following restrictions apply for Entry SQL in addition to
  5460. any Intermediate SQL restrictions:
  5461. a) If a <general set function> specifies or implies ALL, then
  5462. COUNT shall not be specified.
  5463. b) If a <general set function> specifies or implies ALL, then
  5464. the <value expression> shall include a <column reference>
  5465. that references a column of T.
  5466. c) If the <value expression> contains a <column reference> that
  5467. is an outer reference, then the <value expression> shall be a
  5468. <column reference>.
  5469. 126 Database Language SQL
  5470. X3H2-92-154/DBL CBR-002
  5471. 6.5 <set function specification>
  5472. d) No <column reference> contained in a <set function specifica-
  5473. tion> shall reference a column derived from a <value expres-
  5474. sion> that generally contains a <set function specification>.
  5475. Scalar expressions 127
  5476. X3H2-92-154/DBL CBR-002
  5477. 6.6 <numeric value function>
  5478. 6.6 <numeric value function>
  5479. Function
  5480. Specify a function yielding a value of type numeric.
  5481. Format
  5482. <numeric value function> ::=
  5483. <position expression>
  5484. | <extract expression>
  5485. | <length expression>
  5486. <position expression> ::=
  5487. POSITION <left paren> <character value expression>
  5488. IN <character value expression> <right paren>
  5489. <length expression> ::=
  5490. <char length expression>
  5491. | <octet length expression>
  5492. | <bit length expression>
  5493. <char length expression> ::=
  5494. { CHAR_LENGTH | CHARACTER_LENGTH }
  5495. <left paren> <string value expression> <right paren>
  5496. <octet length expression> ::=
  5497. OCTET_LENGTH <left paren> <string value expression> <right paren>
  5498. <bit length expression> ::=
  5499. BIT_LENGTH <left paren> <string value expression> <right paren>
  5500. <extract expression> ::=
  5501. EXTRACT <left paren> <extract field>
  5502. FROM <extract source> <right paren>
  5503. <extract field> ::=
  5504. <datetime field>
  5505. | <time zone field>
  5506. <time zone field> ::=
  5507. TIMEZONE_HOUR
  5508. | TIMEZONE_MINUTE
  5509. <extract source> ::=
  5510. <datetime value expression>
  5511. | <interval value expression>
  5512. 128 Database Language SQL
  5513. X3H2-92-154/DBL CBR-002
  5514. 6.6 <numeric value function>
  5515. Syntax Rules
  5516. 1) If <position expression> is specified, then the character reper-
  5517. toires of the two <character value expression>s shall be the
  5518. same.
  5519. 2) If <position expression> is specified, then the data type of the
  5520. result is exact numeric with implementation-defined precision
  5521. and scale 0.
  5522. 3) If <extract expression> is specified, then
  5523. Case:
  5524. a) If <extract field> is a <datetime field>, then it shall iden-
  5525. tify a <datetime field> of the <interval value expression> or
  5526. <datetime value expression> immediately contained in <extract
  5527. source>.
  5528. b) If <extract field> is a <time zone field>, then the data
  5529. type of the <extract source> shall be TIME WITH TIME ZONE or
  5530. TIMESTAMP WITH TIME ZONE.
  5531. 4) If <extract expression> is specified, then
  5532. Case:
  5533. a) If <datetime field> does not specify SECOND, then the data
  5534. type of the result is exact numeric with implementation-
  5535. defined precision and scale 0.
  5536. b) Otherwise, the data type of the result is exact numeric
  5537. with implementation-defined precision and scale. The
  5538. implementation-defined scale shall not be less than the spec-
  5539. ified or implied <time fractional seconds precision> or <in-
  5540. terval fractional seconds precision>, as appropriate, of the
  5541. SECOND <datetime field> of the <extract source>.
  5542. 5) If a <length expression> is specified, then the data type of the
  5543. result is exact numeric with implementation-defined precision
  5544. and scale 0.
  5545. Access Rules
  5546. None.
  5547. General Rules
  5548. 1) If <position expression> is specified and neither <character
  5549. value expression> is the null value, then
  5550. Case:
  5551. a) If the first <character value expression> has a length of 0,
  5552. then the result is 1.
  5553. Scalar expressions 129
  5554. X3H2-92-154/DBL CBR-002
  5555. 6.6 <numeric value function>
  5556. b) If the value of the first <character value expression> is
  5557. equal to an identical-length substring of contiguous char-
  5558. acters from the value of the second <character value ex-
  5559. pression>, then the result is 1 greater than the number of
  5560. characters within the value of the second <character value
  5561. expression> preceding the start of the first such substring.
  5562. c) Otherwise, the result is 0.
  5563. 2) If <position expression> is specified and either <character
  5564. value expression> is the null value, then the result is the null
  5565. value.
  5566. 3) If <extract expression> is specified, then
  5567. Case:
  5568. a) If the value of the <interval value expression> or the <date-
  5569. time value expression> is not the null value, then
  5570. Case:
  5571. i) If <extract field> is a <datetime field>, then the re-
  5572. sult is the value of the datetime field identified by that
  5573. <datetime field> and has the same sign as the <extract
  5574. source>.
  5575. Note: If the value of the identified <datetime field> is
  5576. zero or if <extract source> is not an <interval value ex-
  5577. pression>, then the sign is irrelevant.
  5578. ii) Otherwise, let TZ be the interval value of the implicit
  5579. or explicit time zone associated with the <datetime value
  5580. expression>. If <extract field> is TIMEZONE_HOUR, then the
  5581. result is calculated as
  5582. EXTRACT (HOUR FROM TZ)
  5583. Otherwise, the result is calculated as
  5584. EXTRACT (MINUTE FROM TZ)
  5585. b) Otherwise, the result is the null value.
  5586. 4) If a <char length expression> is specified, then
  5587. Case:
  5588. a) Let S be the <string value expression>. If the value of S is
  5589. not the null value, then
  5590. Case:
  5591. i) If the data type of S is a character data type, then the
  5592. result is the number of characters in the value of S.
  5593. ii) Otherwise, the result is OCTET_LENGTH(S).
  5594. b) Otherwise, the result is the null value.
  5595. 130 Database Language SQL
  5596. X3H2-92-154/DBL CBR-002
  5597. 6.6 <numeric value function>
  5598. 5) If an <octet length expression> is specified, then
  5599. Case:
  5600. a) Let S be the <string value expression>. If the value of S is
  5601. not the null value, then the result is the smallest integer
  5602. not less than the quotient of the division (BIT_LENGTH(S)/8).
  5603. b) Otherwise, the result is the null value.
  5604. 6) If a <bit length expression> is specified, then
  5605. Case:
  5606. a) Let S be the <string value expression>. If the value of S is
  5607. not the null value, then the result is the number of bits in
  5608. the value of S.
  5609. b) Otherwise, the result is the null value.
  5610. Leveling Rules
  5611. 1) The following restrictions apply for Intermediate SQL:
  5612. a) A <numeric value function> shall not be a <position expres-
  5613. sion>.
  5614. b) A <numeric value function> shall not contain a <length ex-
  5615. pression> that is a <bit length expression>.
  5616. 2) The following restrictions apply for Entry SQL in addition to
  5617. any Intermediate SQL restrictions:
  5618. a) A <numeric value function> shall not be a <length expres-
  5619. sion>.
  5620. b) A <numeric value function> shall not be an <extract expres-
  5621. sion>.
  5622. Scalar expressions 131
  5623. X3H2-92-154/DBL CBR-002
  5624. 6.7 <string value function>
  5625. 6.7 <string value function>
  5626. Function
  5627. Specify a function yielding a value of type character string or bit
  5628. string.
  5629. Format
  5630. <string value function> ::=
  5631. <character value function>
  5632. | <bit value function>
  5633. <character value function> ::=
  5634. <character substring function>
  5635. | <fold>
  5636. | <form-of-use conversion>
  5637. | <character translation>
  5638. | <trim function>
  5639. <character substring function> ::=
  5640. SUBSTRING <left paren> <character value expression> FROM <start position>
  5641. [ FOR <string length> ] <right paren>
  5642. <fold> ::= { UPPER | LOWER } <left paren> <character value expression> <right paren>
  5643. <form-of-use conversion> ::=
  5644. CONVERT <left paren> <character value expression>
  5645. USING <form-of-use conversion name> <right paren>
  5646. <character translation> ::=
  5647. TRANSLATE <left paren> <character value expression>
  5648. USING <translation name> <right paren>
  5649. <trim function> ::=
  5650. TRIM <left paren> <trim operands> <right paren>
  5651. <trim operands> ::=
  5652. [ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>
  5653. <trim source> ::= <character value expression>
  5654. <trim specification> ::=
  5655. LEADING
  5656. | TRAILING
  5657. | BOTH
  5658. <trim character> ::= <character value expression>
  5659. <bit value function> ::=
  5660. 132 Database Language SQL
  5661. X3H2-92-154/DBL CBR-002
  5662. 6.7 <string value function>
  5663. <bit substring function>
  5664. <bit substring function> ::=
  5665. SUBSTRING <left paren> <bit value expression> FROM <start position>
  5666. [ FOR <string length> ] <right paren>
  5667. <start position> ::= <numeric value expression>
  5668. <string length> ::= <numeric value expression>
  5669. Syntax Rules
  5670. 1) The data type of a <start position> and <string length> shall be
  5671. exact numeric with scale 0.
  5672. 2) If <character substring function> is specified, then:
  5673. a) The data type of the <character substring function> is
  5674. variable-length character string with maximum length equal to
  5675. the fixed length or maximum variable length of the <character
  5676. value expression>. The character repertoire and form-of-use
  5677. of the <character substring function> are the same as the
  5678. character repertoire and form-of-use of the <character value
  5679. expression>.
  5680. b) The collating sequence and the coercibility attribute
  5681. are determined as specified for monadic operators in
  5682. Subclause 4.2.3, "Rules determining collating sequence us-
  5683. age", where the first operand of SUBSTRING plays the role of
  5684. the monadic operand.
  5685. 3) If <fold> is specified, then:
  5686. a) The data type of the result of <fold> is the data type of the
  5687. <character value expression>.
  5688. b) The collating sequence and the coercibility attribute
  5689. are determined as specified for monadic operators in
  5690. Subclause 4.2.3, "Rules determining collating sequence us-
  5691. age", where the operand of the <fold> is the monadic operand.
  5692. 4) If <form-of-use conversion> is specified, then:
  5693. a) A <form-of-use conversion name> shall identify a form-of-use
  5694. conversion.
  5695. b) The data type of the result is variable-length character
  5696. string with implementation-defined maximum length. The
  5697. character set of the result is the same as the character
  5698. repertoire of the <character value expression> and form-
  5699. of-use determined by the form-of-use conversion identified
  5700. Scalar expressions 133
  5701. X3H2-92-154/DBL CBR-002
  5702. 6.7 <string value function>
  5703. by the <form-of-use conversion name>. Let CR be that char-
  5704. acter repertoire. The result has the Implicit coercibility
  5705. attribute and its collating sequence is X, where X is the
  5706. default collating sequence of CR.
  5707. 5) If <character translation> is specified, then
  5708. a) A <translation name> shall identify a character translation.
  5709. b) The data type of the <character translation> is variable-
  5710. length character string with implementation-defined maximum
  5711. length and character repertoire equal to the character reper-
  5712. toire of the target character set of the translation. Let CR
  5713. be that character repertoire. The result has the Implicit co-
  5714. ercibility attribute and its collating sequence is X, where X
  5715. is the default collating sequence of CR.
  5716. 6) If <trim function> is specified, then
  5717. a) If FROM is specified, then either <trim specification> or
  5718. <trim character> or both shall be specified.
  5719. b) If <trim specification> is not specified, then BOTH is im-
  5720. plicit.
  5721. c) If <trim character> is not specified, then ' ' is implicit.
  5722. d) If
  5723. TRIM ( SRC )
  5724. is specified, then
  5725. TRIM ( BOTH ' ' FROM SRC )
  5726. is implicit.
  5727. e) The data type of the <trim function> is variable-length char-
  5728. acter string with maximum length equal to the fixed length or
  5729. maximum variable length of the <trim source>.
  5730. f) If a <trim character> is specified, then <trim character> and
  5731. <trim source> shall be comparable.
  5732. g) The character repertoire and form-of-use of the <trim func-
  5733. tion> are the same as those of the <trim source>.
  5734. h) The collating sequence and the coercibility attribute
  5735. are determined as specified for monadic operators in
  5736. Subclause 4.2.3, "Rules determining collating sequence us-
  5737. age", where the <trim source> of TRIM plays the role of the
  5738. monadic operand.
  5739. 7) If <bit substring function> is specified, then the data type of
  5740. the <bit substring function> is variable-length bit string with
  5741. maximum length equal to the fixed length or maximum variable
  5742. length of the <bit value expression>.
  5743. 134 Database Language SQL
  5744. X3H2-92-154/DBL CBR-002
  5745. 6.7 <string value function>
  5746. Access Rules
  5747. 1) The applicable privileges shall include USAGE for every <trans-
  5748. lation name> contained in the <string value expression>.
  5749. General Rules
  5750. 1) If <character substring function> is specified, then:
  5751. a) Let C be the value of the <character value expression>, let
  5752. LC be the length of C, and let S be the value of the <start
  5753. position>.
  5754. b) If <string length> is specified, then let L be the value of
  5755. <string length> and let E be S+L. Otherwise, let E be the
  5756. larger of LC + 1 and S.
  5757. c) If either C, S, or L is the null value, then the result of
  5758. the <character substring function> is the null value.
  5759. d) If E is less than S, then an exception condition is raised:
  5760. data exception-substring error.
  5761. e) Case:
  5762. i) If S is greater than LC or if E is less than 1, then the
  5763. result of the <character substring function> is a zero-
  5764. length string.
  5765. ii) Otherwise,
  5766. 1) Let S1 be the larger of S and 1. Let E1 be the smaller
  5767. of E and LC+1. Let L1 be E1-S1.
  5768. 2) The result of the <character substring function> is
  5769. a character string containing the L1 characters of C
  5770. starting at character number S1 in the same order that
  5771. the characters appear in C.
  5772. 2) If <fold> is specified, then:
  5773. a) Let S be the value of the <character value expression>.
  5774. b) If S is the null value, then the result of the <fold> is the
  5775. null value.
  5776. c) Case:
  5777. i) If UPPER is specified, then the result of the <fold> is a
  5778. copy of S in which every <simple Latin lower case letter>
  5779. that has a corresponding <simple Latin upper case let-
  5780. ter> in the character repertoire of S is replaced by that
  5781. <simple Latin upper case letter>.
  5782. Scalar expressions 135
  5783. X3H2-92-154/DBL CBR-002
  5784. 6.7 <string value function>
  5785. ii) If LOWER is specified, then the result of the <fold> is a
  5786. copy of S in which every <simple Latin upper case letter>
  5787. that has a corresponding <simple Latin lower case let-
  5788. ter> in the character repertoire of S is replaced by that
  5789. <simple Latin lower case letter>.
  5790. 3) If a <character translation> is specified, then
  5791. Case:
  5792. a) If the value of <character value expression> is the null
  5793. value, then the result of the <character translation> is the
  5794. null value.
  5795. b) Otherwise, the value of the <character translation> is the
  5796. value of the <character value expression> after translation
  5797. to the character repertoire of the target character set of
  5798. the translation.
  5799. 4) If a <form-of-use conversion> is specified, then
  5800. Case:
  5801. a) If the value of <character value expression> is the null
  5802. value, then the result of the <form-of-use conversion> is the
  5803. null value.
  5804. b) Otherwise, the value of the <form-of-use conversion> is the
  5805. value of the <character value expression> after the applica-
  5806. tion of the form-of-use conversion specified by <form-of-use
  5807. conversion name>.
  5808. 5) If <trim function> is specified, then:
  5809. a) Let S be the value of the <trim source>.
  5810. b) If <trim character> is specified, then let SC be the value of
  5811. <trim character>; otherwise, let SC be <space>.
  5812. c) If either S or SC is the null value, then the result of the
  5813. <trim function> is the null value.
  5814. d) If the length in characters of SC is not 1, then an exception
  5815. condition is raised: data exception-trim error.
  5816. e) Case:
  5817. i) If BOTH is specified or if no <trim specification> is spec-
  5818. ified, then the result of the <trim function> is the value
  5819. of S with any leading or trailing characters equal to SC
  5820. removed.
  5821. ii) If TRAILING is specified, then the result of the <trim
  5822. function> is the value of S with any trailing characters
  5823. equal to SC removed.
  5824. 136 Database Language SQL
  5825. X3H2-92-154/DBL CBR-002
  5826. 6.7 <string value function>
  5827. iii) If LEADING is specified, then the result of the <trim func-
  5828. tion> is the value of S with any leading characters equal
  5829. to SC removed.
  5830. 6) If <bit substring function> is specified, then:
  5831. a) Let B be the value of the <bit value expression>, let LB be
  5832. the length in bits of B, and let S be the value of the <start
  5833. position>.
  5834. b) If <string length> is specified, then let L be the value of
  5835. <string length> and let E be S+L. Otherwise, let E be the
  5836. larger of LB + 1 and S.
  5837. c) If either B, S, or L is the null value, then the result of
  5838. the <bit substring function> is the null value.
  5839. d) If E is less than S, then an exception condition is raised:
  5840. data exception-substring error.
  5841. e) Case:
  5842. i) If S is greater than LB or if E is less than 1, then the
  5843. result of the <bit substring function> is a zero-length
  5844. string.
  5845. ii) Otherwise,
  5846. 1) Let S1 be the larger of S and 1. Let E1 be the smaller
  5847. of E and LB+1. Let L1 be E1-S1.
  5848. 2) The result of the <bit substring function> is a bit
  5849. string containing L1 bits of B starting at bit number S1
  5850. in the same order that the bits appear in B.
  5851. Leveling Rules
  5852. 1) The following restrictions apply for Intermediate SQL:
  5853. a) A <character value function> shall not be a <fold>.
  5854. b) Conforming Intermediate SQL language shall contain no <char-
  5855. acter translation>.
  5856. c) Conforming Intermediate SQL language shall contain no <form-
  5857. of-use conversion>.
  5858. d) Conforming Intermediate SQL language shall contain no <bit
  5859. value function>.
  5860. 2) The following restrictions apply for Entry SQL in addition to
  5861. any Intermediate SQL restrictions:
  5862. a) A <character value function> shall not be a <character sub-
  5863. string function>.
  5864. Scalar expressions 137
  5865. X3H2-92-154/DBL CBR-002
  5866. 6.7 <string value function>
  5867. b) A <character value function> shall not be a <trim function>.
  5868. 138 Database Language SQL
  5869. X3H2-92-154/DBL CBR-002
  5870. 6.8 <datetime value function>
  5871. 6.8 <datetime value function>
  5872. Function
  5873. Specify a function yielding a value of type datetime.
  5874. Format
  5875. <datetime value function> ::=
  5876. <current date value function>
  5877. | <current time value function>
  5878. | <current timestamp value function>
  5879. <current date value function> ::= CURRENT_DATE
  5880. <current time value function> ::=
  5881. CURRENT_TIME [ <left paren> <time precision> <right paren> ]
  5882. <current timestamp value function> ::=
  5883. CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
  5884. Syntax Rules
  5885. 1) The data type of a <current date value function> is DATE. The
  5886. data type of a <current time value function> is TIME WITH TIME
  5887. ZONE. The data type of a <current timestamp value function> is
  5888. TIMESTAMP WITH TIME ZONE.
  5889. Note: See the Syntax Rules of Subclause 6.1, "<data type>", for
  5890. rules governing <time precision> and <timestamp precision>.
  5891. Access Rules
  5892. None.
  5893. General Rules
  5894. 1) The <datetime value function>s CURRENT_DATE, CURRENT_TIME, and
  5895. CURRENT_TIMESTAMP respectively return the current date, current
  5896. time, and current timestamp; the time and timestamp values are
  5897. returned with time zone displacement equal to the current time
  5898. zone displacement of the SQL-session.
  5899. 2) If specified, <time precision> and <timestamp precision> respec-
  5900. tively determine the precision of the time or timestamp value
  5901. returned.
  5902. 3) If an SQL-statement generally contains more than one reference
  5903. to one or more <datetime value function>s, then all such ref-
  5904. erences are effectively evaluated simultaneously. The time of
  5905. Scalar expressions 139
  5906. X3H2-92-154/DBL CBR-002
  5907. 6.8 <datetime value function>
  5908. evaluation of the <datetime value function> during the execution
  5909. of the SQL-statement is implementation-dependent.
  5910. Leveling Rules
  5911. 1) The following restrictions apply for Intermediate SQL:
  5912. a) Conforming Intermediate SQL language shall contain no <time
  5913. precision> or <timestamp precision>.
  5914. 2) The following restrictions apply for Entry SQL in addition to
  5915. any Intermediate SQL restrictions:
  5916. a) Conforming Entry SQL language shall not contain any <datetime
  5917. value function>.
  5918. 140 Database Language SQL
  5919. X3H2-92-154/DBL CBR-002
  5920. 6.9 <case expression>
  5921. 6.9 <case expression>
  5922. Function
  5923. Specify a conditional value.
  5924. Format
  5925. <case expression> ::=
  5926. <case abbreviation>
  5927. | <case specification>
  5928. <case abbreviation> ::=
  5929. NULLIF <left paren> <value expression> <comma>
  5930. <value expression> <right paren>
  5931. | COALESCE <left paren> <value expression>
  5932. { <comma> <value expression> }... <right paren>
  5933. <case specification> ::=
  5934. <simple case>
  5935. | <searched case>
  5936. <simple case> ::=
  5937. CASE <case operand>
  5938. <simple when clause>...
  5939. [ <else clause> ]
  5940. END
  5941. <searched case> ::=
  5942. CASE
  5943. <searched when clause>...
  5944. [ <else clause> ]
  5945. END
  5946. <simple when clause> ::= WHEN <when operand> THEN <result>
  5947. <searched when clause> ::= WHEN <search condition> THEN <result>
  5948. <else clause> ::= ELSE <result>
  5949. <case operand> ::= <value expression>
  5950. <when operand> ::= <value expression>
  5951. <result> ::= <result expression> | NULL
  5952. <result expression> ::= <value expression>
  5953. Scalar expressions 141
  5954. X3H2-92-154/DBL CBR-002
  5955. 6.9 <case expression>
  5956. Syntax Rules
  5957. 1) NULLIF (V1, V2) is equivalent to the following <case specifica-
  5958. tion>:
  5959. CASE WHEN V1=V2 THEN NULL ELSE V1 END
  5960. 2) COALESCE (V1, V2) is equivalent to the following <case specifi-
  5961. cation>:
  5962. CASE WHEN V1 IS NOT NULL THEN V1 ELSE V2 END
  5963. 3) COALESCE (V1, V2, . . . ,n ), for n >= 3, is equivalent to the
  5964. following <case specification>:
  5965. CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,n )
  5966. END
  5967. 4) If a <case specification> specifies a <simple case>, then let CO
  5968. be the <case operand>:
  5969. a) The data type of each <when operand> WO shall be comparable
  5970. with the data type of the <case operand>.
  5971. b) The <case specification> is equivalent to a <searched case>
  5972. in which each <searched when clause> specifies a <search
  5973. condition> of the form "CO=WO".
  5974. 5) At least one <result> in a <case specification> shall specify a
  5975. <result expression>.
  5976. 6) If an <else clause> is not specified, then ELSE NULL is im-
  5977. plicit.
  5978. 7) The data type of a <case specification> is determined by ap-
  5979. plying Subclause 9.3, "Set operation result data types", to the
  5980. data types of all <result expression>s in the <case specifica-
  5981. tion>.
  5982. Access Rules
  5983. None.
  5984. General Rules
  5985. 1) Case:
  5986. a) If a <result> specifies NULL, then its value is the null
  5987. value.
  5988. b) If a <result> specifies a <value expression>, then its value
  5989. is the value of that <value expression>.
  5990. 142 Database Language SQL
  5991. X3H2-92-154/DBL CBR-002
  5992. 6.9 <case expression>
  5993. 2) Case:
  5994. a) If the <search condition> of some <searched when clause> in
  5995. a <case specification> is true, then the value of the <case
  5996. specification> is the value of the <result> of the first
  5997. (leftmost) <searched when clause> whose <search condition> is
  5998. true, cast as the data type of the <case specification>.
  5999. b) If no <search condition> in a <case specification> is true,
  6000. then the value of the <case expression> is the value of the
  6001. <result> of the explicit or implicit <else clause>, cast as
  6002. the data type of the <case specification>.
  6003. Leveling Rules
  6004. 1) The following restrictions apply for Intermediate SQL:
  6005. None.
  6006. 2) The following restrictions apply for Entry SQL in addition to
  6007. any Intermediate SQL restrictions:
  6008. a) Conforming Entry SQL language shall not contain any <case
  6009. expression>.
  6010. Scalar expressions 143
  6011. X3H2-92-154/DBL CBR-002
  6012. 6.10 <cast specification>
  6013. 6.10 <cast specification>
  6014. Function
  6015. Specify a data conversion.
  6016. Format
  6017. <cast specification> ::=
  6018. CAST <left paren> <cast operand> AS <cast target> <right paren>
  6019. <cast operand> ::=
  6020. <value expression>
  6021. | NULL
  6022. <cast target> ::=
  6023. <domain name>
  6024. | <data type>
  6025. Syntax Rules
  6026. 1) Case:
  6027. a) If a <domain name> is specified, then let TD be the <data
  6028. type> of the specified domain.
  6029. b) If a <data type> is specified, then let TD be the specified
  6030. <data type>.
  6031. 2) The data type of the result of the <cast specification> is TD.
  6032. 3) If the <cast operand> is a <value expression>, then let SD be
  6033. the underlying data type of the <value expression>.
  6034. 4) If the <cast operand> is a <value expression>, then the valid
  6035. combinations of TD and SD in a <cast specification> are given by
  6036. the following table. Y indicates that the combination is syntac-
  6037. tically valid without restriction; M indicates that the combi-
  6038. nation is valid subject to other syntax rules in this Subclause
  6039. being satisfied; and N indicates that the combination is not
  6040. valid:
  6041. <data type>
  6042. SD of <data type> of TD
  6043. <value
  6044. expression> EN AN VC FC VB FB D T TS YM DT
  6045. EN Y Y Y Y N N N N N M M
  6046. AN Y Y Y Y N N N N N N N
  6047. C Y Y M M Y Y Y Y Y Y Y
  6048. B N N Y Y Y Y N N N N N
  6049. D N N Y Y N N Y N Y N N
  6050. 144 Database Language SQL
  6051. X3H2-92-154/DBL CBR-002
  6052. 6.10 <cast specification>
  6053. T N N Y Y N N N Y Y N N
  6054. TS N N Y Y N N Y Y Y N N
  6055. YM M N Y Y N N N N N Y N
  6056. DT M N Y Y N N N N N N Y
  6057. Where:
  6058. EN = Exact Numeric
  6059. AN = Approximate Numeric
  6060. C = Character (Fixed- or Variable-length)
  6061. FC = Fixed-length Character
  6062. VC = Variable-length Character
  6063. B = Bit String (Fixed- or Variable-length)
  6064. FB = Fixed-length Bit String
  6065. VB = Variable-length Bit String
  6066. D = Date
  6067. T = Time
  6068. TS = Timestamp
  6069. YM = Year-Month Interval
  6070. DT = Day-Time Interval
  6071. 5) If TD is an interval and SD is exact numeric, then TD shall
  6072. contain only a single <datetime field>.
  6073. 6) If TD is exact numeric and SD is an interval, then SD shall
  6074. contain only a single <datetime field>.
  6075. 7) If SD is character string and TD is fixed-length or variable-
  6076. length character string, then the character repertoires of SD
  6077. and TD shall be the same.
  6078. 8) If TD is a fixed-length or variable-length character string,
  6079. then the collating sequence of the result of the <cast speci-
  6080. fication> is the default collating sequence for the character
  6081. repertoire of TD and the result of the <cast specification> has
  6082. the Coercible coercibility attribute.
  6083. Access Rules
  6084. 1) If <domain name> is specified, then the applicable privileges
  6085. shall include USAGE.
  6086. General Rules
  6087. 1) If the <cast operand> is a <value expression>, then let SV be
  6088. its value.
  6089. 2) Case:
  6090. a) If the <cast operand> specifies NULL or if SV is the null
  6091. value, then the result of the <cast specification> is the
  6092. null value.
  6093. Scalar expressions 145
  6094. X3H2-92-154/DBL CBR-002
  6095. 6.10 <cast specification>
  6096. b) Otherwise, let TV be the result of the <cast specifica-
  6097. tion> as specified in the remaining General Rules of this
  6098. Subclause.
  6099. 3) If TD is exact numeric, then
  6100. Case:
  6101. a) If SD is exact numeric or approximate numeric, then
  6102. Case:
  6103. i) If there is a representation of SV in the data type TD
  6104. that does not lose any leading significant digits after
  6105. rounding or truncating if necessary, then TV is that rep-
  6106. resentation. The choice of whether to round or truncate is
  6107. implementation-defined.
  6108. ii) Otherwise, an exception condition is raised: data exception-
  6109. numeric value out of range.
  6110. b) If SD is character string, then SV is replaced by SV with any
  6111. leading or trailing <space>s removed.
  6112. Case:
  6113. i) If SV does not comprise a <signed numeric literal> as
  6114. defined by the rules for <literal> in Subclause 5.3,
  6115. "<literal>", then an exception condition is raised: data
  6116. exception-invalid character value for cast.
  6117. ii) Otherwise, let LT be that <signed numeric literal>. The
  6118. <cast specification> is equivalent to
  6119. CAST ( LT AS TD )
  6120. c) If SD is an interval data type, then
  6121. Case:
  6122. i) If there is a representation of SV in the data type TD that
  6123. does not lose any leading significant digits, then TV is
  6124. that representation.
  6125. ii) Otherwise, an exception condition is raised: data exception-
  6126. numeric value out of range.
  6127. 4) If TD is approximate numeric, then
  6128. Case:
  6129. a) If SD is exact numeric or approximate numeric, then
  6130. Case:
  6131. i) If there is a representation of SV in the data type TD
  6132. that does not lose any leading significant digits after
  6133. 146 Database Language SQL
  6134. X3H2-92-154/DBL CBR-002
  6135. 6.10 <cast specification>
  6136. rounding or truncating if necessary, then TV is that rep-
  6137. resentation. The choice of whether to round or truncate is
  6138. implementation-defined.
  6139. ii) Otherwise, an exception condition is raised: data exception-
  6140. numeric value out of range.
  6141. b) If SD is character string, then SV is replaced by SV with any
  6142. leading or trailing <space>s removed.
  6143. Case:
  6144. i) If SV does not comprise a <signed numeric literal> as
  6145. defined by the rules for <literal> in Subclause 5.3,
  6146. "<literal>", then an exception condition is raised: data
  6147. exception-invalid character value for cast.
  6148. ii) Otherwise, let LT be that <signed numeric literal>. The
  6149. <cast specification> is equivalent to
  6150. CAST ( LT AS TD )
  6151. 5) If TD is fixed-length character string, then let LTD be the
  6152. length in characters of TD.
  6153. Case:
  6154. a) If SD is exact numeric, then let YP be the shortest character
  6155. string that conforms to the definition of <exact numeric
  6156. literal> in Subclause 5.3, "<literal>", whose scale is the
  6157. same as the scale of SD and whose interpreted value is the
  6158. absolute value of SV.
  6159. If SV is less than 0, then let Y be the result of
  6160. '-' | YP
  6161. Otherwise, let Y be YP.
  6162. Case:
  6163. i) If Y contains any <SQL language character> that is not
  6164. in the repertoire of TD, then an exception condition is
  6165. raised: data exception-invalid character value for cast.
  6166. ii) If the length in characters LY of Y is equal to LTD, then
  6167. TV is Y.
  6168. iii) If the length in characters LY of Y is less than LTD, then
  6169. TV is Y extended on the right by LTD-LY <space>s.
  6170. iv) Otherwise, an exception condition is raised: data exception-
  6171. string data, right truncation.
  6172. b) If SD is approximate numeric, then:
  6173. i) Let YP be a character string as follows:
  6174. Scalar expressions 147
  6175. X3H2-92-154/DBL CBR-002
  6176. 6.10 <cast specification>
  6177. Case:
  6178. 1) If SV equals 0, then YP is '0E0'.
  6179. 2) Otherwise, YP is the shortest character string that con-
  6180. forms to the definition of <approximate numeric literal>
  6181. in Subclause 5.3, "<literal>", whose interpreted value
  6182. is equal to the absolute value of SV and whose <man-
  6183. tissa> consists of a single <digit> that is not '0',
  6184. followed by a <period> and an <unsigned integer>.
  6185. ii) If SV is less than 0, then let Y be the result of
  6186. '-' | YP
  6187. otherwise, let Y be YP.
  6188. iii) Case:
  6189. 1) If Y contains any <SQL language character> that is not
  6190. in the repertoire of TD, then an exception condition is
  6191. raised: data exception-invalid character value for cast.
  6192. 2) If the length in characters LY of Y is equal to LTD,
  6193. then TV is Y.
  6194. 3) If the length in characters LY of Y is less than LTD,
  6195. then TV is Y extended on the right by LTD-LY <space>s.
  6196. 4) Otherwise, an exception condition is raised: data
  6197. exception-string data, right truncation.
  6198. c) If SD is fixed-length character string or variable-length
  6199. character string, then
  6200. Case:
  6201. i) If the length in characters of SV is equal to LTD, then TV
  6202. is SV.
  6203. ii) If the length in characters of SV is larger than LTD, then
  6204. TV is the first LTD characters of SV. If any of the re-
  6205. maining characters of SV are non-<space> characters, then a
  6206. completion condition is raised: warning-string data, right
  6207. truncation.
  6208. iii) If the length in characters M of SV is smaller than LTD,
  6209. then TV is SV extended on the right by LTD-M <space>s.
  6210. d) If SD is fixed-length bit string or variable-length bit
  6211. string, then let LSV be the value of BIT_LENGTH(SV) and let
  6212. B be the BIT_LENGTH of the character with the smallest BIT_
  6213. LENGTH in the form-of-use of TD. Let PAD be the value of the
  6214. remainder of the division LSV/B. Let NC be a character whose
  6215. bits all have the value 0.
  6216. 148 Database Language SQL
  6217. X3H2-92-154/DBL CBR-002
  6218. 6.10 <cast specification>
  6219. If PAD is not 0, then append (B - PAD) 0-valued bits to
  6220. the least significant end of SV; a completion condition is
  6221. raised: warning-implicit zero-bit padding.
  6222. Let SVC be the possibly padded value of SV expressed as a
  6223. character string without regard to valid character encodings
  6224. and let LTDS be a character string of LTD characters of value
  6225. NC characters in the form-of-use of TD.
  6226. TV is the result of
  6227. SUBSTRING (SVC | LTDS FROM 1 FOR LTD)
  6228. Case:
  6229. i) If the length of TV is less than the length of SVC, then a
  6230. completion condition is raised: warning-string data, right
  6231. truncation.
  6232. ii) If the length of TV is greater than the length of SVC, then
  6233. a completion condition is raised: warning-implicit zero-bit
  6234. padding.
  6235. e) If SD is a datetime data type or an interval data type, then
  6236. let Y be the shortest character string that conforms to the
  6237. definition of <literal> in Subclause 5.3, "<literal>", and
  6238. such that the interpreted value of Y is SV and the inter-
  6239. preted precision of Y is the precision of SD.
  6240. Case:
  6241. i) If Y contains any <SQL language character> that is not
  6242. in the repertoire of TD, then an exception condition is
  6243. raised: data exception-invalid character value for cast.
  6244. ii) If the length in characters LY of Y is equal to LTD, then
  6245. TV is Y.
  6246. iii) If the length in characters LY of Y is less than LTD, then
  6247. TV is Y extended on the right by LTD-LY <space>s.
  6248. iv) Otherwise, an exception condition is raised: data exception-
  6249. string data, right truncation.
  6250. 6) If TD is variable-length character string, then let MLTD be the
  6251. maximum length in characters of TD.
  6252. Case:
  6253. a) If SD is exact numeric, then let YP be the shortest character
  6254. string that conforms to the definition of <exact numeric
  6255. literal> in Subclause 5.3, "<literal>", whose scale is the
  6256. same as the scale of SD and whose interpreted value is the
  6257. absolute value of SV.
  6258. If SV is less than 0, then let Y be the result of
  6259. '-' | YP
  6260. Scalar expressions 149
  6261. X3H2-92-154/DBL CBR-002
  6262. 6.10 <cast specification>
  6263. Otherwise, let Y be YP.
  6264. Case:
  6265. i) If Y contains any <SQL language character> that is not
  6266. in the repertoire of TD, then an exception condition is
  6267. raised: data exception-invalid character value for cast.
  6268. ii) If the length in characters LY of Y is less than or equal
  6269. to MLTD, then TV is Y.
  6270. iii) Otherwise, an exception condition is raised: data exception-
  6271. string data, right truncation.
  6272. b) If SD is approximate numeric, then
  6273. i) Let YP be a character string as follows:
  6274. Case:
  6275. 1) If SV equals 0, then YP is '0E0'.
  6276. 2) Otherwise, YP is the shortest character string that con-
  6277. forms to the definition of <approximate numeric literal>
  6278. in Subclause 5.3, "<literal>", whose interpreted value
  6279. is equal to the absolute value of SV and whose <man-
  6280. tissa> consists of a single <digit> that is not '0',
  6281. followed by a <period> and an <unsigned integer>.
  6282. ii) If SV is less than 0, then let Y be the result of
  6283. '-' | YP
  6284. otherwise, let Y be YP.
  6285. iii) Case:
  6286. 1) If Y contains any <SQL language character> that is not
  6287. in the repertoire of TD, then an exception condition is
  6288. raised: data exception-invalid character value for cast.
  6289. 2) If the length in characters LY of Y is less than or
  6290. equal to MLTD, then TV is Y.
  6291. 3) Otherwise, an exception condition is raised: data
  6292. exception-string data, right truncation.
  6293. c) If SD is fixed-length character string or variable-length
  6294. character string, then
  6295. Case:
  6296. i) If the length in characters of SV is less than or equal to
  6297. MLTD, then TV is SV.
  6298. 150 Database Language SQL
  6299. X3H2-92-154/DBL CBR-002
  6300. 6.10 <cast specification>
  6301. ii) If the length in characters of SV is larger than MLTD,
  6302. then TV is the first MLTD characters of SV. If any of the
  6303. remaining characters of SV are non-<space> characters,
  6304. then a completion condition is raised: warning-string data,
  6305. right truncation.
  6306. d) If SD is fixed-length bit string or variable-length bit
  6307. string, then let LSV be the value of BIT_LENGTH(SV) and let
  6308. B be the BIT_LENGTH of the character with the smallest BIT_
  6309. LENGTH in the form-of-use of TD. Let PAD be the value of the
  6310. remainder of the division LSV/B.
  6311. If PAD is not 0, then append (B - PAD) 0-valued bits to
  6312. the least significant end of SV; a completion condition is
  6313. raised: warning-implicit zero-bit padding.
  6314. Let SVC be the possible padded value of SV expressed as a
  6315. character string without regard to valid character encodings.
  6316. Case:
  6317. i) If CHARACTER_LENGTH (SVC) is not greater than MLTD, then TV
  6318. is SVC.
  6319. ii) Otherwise, TV is the result of
  6320. SUBSTRING (SVC FROM 1 FOR MLTD)
  6321. If the length of TV is less than the length of SVC, then a
  6322. completion condition is raised: warning-string data, right
  6323. truncation.
  6324. e) If SD is a datetime data type or an interval data type then
  6325. let Y be the shortest character string that conforms to the
  6326. definition of <literal> in Subclause 5.3, "<literal>", and
  6327. such that the interpreted value of Y is SV and the inter-
  6328. preted precision of Y is the precision of SD.
  6329. Case:
  6330. i) If Y contains any <SQL language character> that is not
  6331. in the repertoire of TD, then an exception condition is
  6332. raised: data exception-invalid character value for cast.
  6333. ii) If the length in characters LY of Y is less than or equal
  6334. to MLTD, then TV is Y.
  6335. iii) Otherwise, an exception condition is raised: data exception-
  6336. string data, right truncation.
  6337. 7) If TD is fixed-length bit string, then let LTD be the length in
  6338. bits of TD. Let BLSV be the result of BIT_LENGTH(SV).
  6339. Case:
  6340. a) If BLSV is equal to LTD, then TV is SV expressed as a bit
  6341. string with a length in bits of BLSV.
  6342. Scalar expressions 151
  6343. X3H2-92-154/DBL CBR-002
  6344. 6.10 <cast specification>
  6345. b) If BLSV is larger than LTD, then TV is the first LTD bits of
  6346. SV expressed as a bit string with a length in bits of LTD,
  6347. and a completion condition is raised: warning-string data,
  6348. right truncation.
  6349. c) If BLSV is smaller than LTD, then TV is SV expressed as a bit
  6350. string extended on the right with LTD-BLSV bits whose values
  6351. are all 0 and a completion condition is raised: warning-
  6352. implicit zero-bit padding.
  6353. 8) If TD is variable-length bit string, then let MLTD be the
  6354. maximum length in bits of TD. Let BLSV be the result of BIT_
  6355. LENGTH(SV).
  6356. Case:
  6357. a) If BLSV is less than or equal to MLTD, then TV is SV ex-
  6358. pressed as a bit string with a length in bits of BLSV.
  6359. b) If BLSV is larger than MLTD, then TV is the first MLTD bits
  6360. of SV expressed as a bit string with a length in bits of MLTD
  6361. and a completion condition is raised: warning-string data,
  6362. right truncation.
  6363. 9) If TD is the datetime data type DATE, then
  6364. Case:
  6365. a) If SD is character string, then SV is replaced by
  6366. TRIM ( BOTH ' ' FROM SV )
  6367. Case:
  6368. i) If the rules for <literal> in Subclause 5.3, "<literal>",
  6369. can be applied to SV to determine a valid value of the data
  6370. type TD, then let TV be that value.
  6371. ii) Otherwise, an exception condition is raised: data exception-
  6372. invalid character value for cast.
  6373. b) If SD is a date, then TV is SV.
  6374. c) If SD is a timestamp, then TV is the year, month, and day
  6375. <datetime field>s of SV adjusted to the implicit or explicit
  6376. time zone displacement of SV.
  6377. 10)If TD is the datetime data type TIME, then
  6378. Case:
  6379. a) If SD is character string, then SV is replaced by
  6380. TRIM ( BOTH ' ' FROM SV )
  6381. Case:
  6382. 152 Database Language SQL
  6383. X3H2-92-154/DBL CBR-002
  6384. 6.10 <cast specification>
  6385. i) If the rules for <literal> in Subclause 5.3, "<literal>",
  6386. can be applied to SV to determine a valid value of the data
  6387. type TD, then let TV be that value.
  6388. ii) Otherwise, an exception condition is raised: data exception-
  6389. invalid character value for cast.
  6390. b) If SD is a time, then TV is SV. If TD is specified WITH TIME
  6391. ZONE, then TV also includes the implicit or explicit time
  6392. zone displacement of SV; otherwise, TV is adjusted to the
  6393. current time zone displacement of the SQL-session.
  6394. c) If SD is a timestamp, then TV is the hour, minute, and second
  6395. <datetime field>s of SV. If TD is specified WITH TIME ZONE,
  6396. then TV also includes the implicit or explicit time zone
  6397. displacement of SV; otherwise, TV is adjusted to the current
  6398. time zone displacement of the SQL-session.
  6399. 11)If TD is the datetime data type TIMESTAMP, then
  6400. Case:
  6401. a) If SD is character string, then SV is replaced by
  6402. TRIM ( BOTH ' ' FROM SV )
  6403. Case:
  6404. i) If the rules for <literal> in Subclause 5.3, "<literal>",
  6405. can be applied to SV to determine a valid value of the data
  6406. type TD, then let TV be that value.
  6407. ii) Otherwise, an exception condition is raised: data exception-
  6408. invalid character value for cast.
  6409. b) If SD is a date, then the <datetime field>s hour, minute,
  6410. and second of TV are set to 0 and the <datetime field>s year,
  6411. month, and day of TV are set to their respective values in
  6412. SV. If TD is specified WITH TIME ZONE, then the time zone
  6413. fields of TV are set to the current time zone displacement of
  6414. the SQL-session.
  6415. c) If SD is a time, then the <datetime field>s year, month, and
  6416. day of TV are set to their respective values in an execution
  6417. of CURRENT_DATE and the <datetime field>s hour, minute, and
  6418. second of TV are set to their respective values in SV. If TD
  6419. is specified WITH TIME ZONE, then the time zone fields of TV
  6420. are set to the explicit or implicit time zone interval of SV.
  6421. d) If SD is a timestamp, then TV is SV.
  6422. 12)If TD is interval, then
  6423. Case:
  6424. a) If SD is exact numeric, then
  6425. Scalar expressions 153
  6426. X3H2-92-154/DBL CBR-002
  6427. 6.10 <cast specification>
  6428. Case:
  6429. i) If the representation of SV in the data type TD would re-
  6430. sult in the loss of leading significant digits, then an
  6431. exception condition is raised: data exception-interval
  6432. field overflow.
  6433. ii) Otherwise, TV is that representation.
  6434. b) If SD is character string, then SV is replaced by
  6435. TRIM ( BOTH ' ' FROM SV )
  6436. Case:
  6437. i) If the rules for <literal> in Subclause 5.3, "<literal>",
  6438. can be applied to SV to determine a valid value of the data
  6439. type TD, then let TV be that value.
  6440. ii) Otherwise, an exception condition is raised: data exception-
  6441. invalid character value for cast.
  6442. c) If SD is interval and TD and SD have the same interval preci-
  6443. sion, then TV is SV.
  6444. d) If SD is interval and TD and SD have different interval pre-
  6445. cisions, then let Q be the least significant <datetime field>
  6446. of TD.
  6447. i) Let Y be the result of converting SV to a scalar in units Q
  6448. according to the natural rules for intervals as defined in
  6449. the Gregorian calendar.
  6450. ii) Normalize Y to conform to the datetime qualifier "P TO Q"
  6451. of TD. If this would result in loss of precision of the
  6452. leading datetime field of Y, then an exception condition is
  6453. raised: data exception-interval field overflow.
  6454. iii) TV is the value of Y.
  6455. 13)If the <cast specification> contains a <domain name> and that
  6456. <domain name> refers to a domain that contains a <domain con-
  6457. straint> and if TV does not satisfy the <check constraint> of
  6458. the <domain constraint>, then an exception condition is raised:
  6459. integrity constraint violation.
  6460. Leveling Rules
  6461. 1) The following restrictions apply for Intermediate SQL:
  6462. None.
  6463. 2) The following restrictions apply for Entry SQL in addition to
  6464. any Intermediate SQL restrictions:
  6465. a) Conforming Entry SQL language shall not contain any <cast
  6466. specification>.
  6467. 154 Database Language SQL
  6468. X3H2-92-154/DBL CBR-002
  6469. 6.11 <value expression>
  6470. 6.11 <value expression>
  6471. Function
  6472. Specify a value.
  6473. Format
  6474. <value expression> ::=
  6475. <numeric value expression>
  6476. | <string value expression>
  6477. | <datetime value expression>
  6478. | <interval value expression>
  6479. <value expression primary> ::=
  6480. <unsigned value specification>
  6481. | <column reference>
  6482. | <set function specification>
  6483. | <scalar subquery>
  6484. | <case expression>
  6485. | <left paren> <value expression> <right paren>
  6486. | <cast specification>
  6487. Syntax Rules
  6488. 1) The data type of a <value expression> is the data type of the
  6489. <numeric value expression>, <string value expression>, <datetime
  6490. value expression>, or <interval value expression>, respectively.
  6491. 2) If the data type of a <value expression primary> is character
  6492. string, then the collating sequence and coercibility attribute
  6493. of the <value expression primary> are the collating sequence and
  6494. coercibility attribute of the <unsigned value specification>,
  6495. <column reference>, <set function specification>, <scalar sub-
  6496. query>, <case expression>, <value expression>, or <cast specifi-
  6497. cation> immediately contained in the <value expression primary>.
  6498. 3) Let C be some column. Let VE be the <value expression>. C is an
  6499. underlying column of VE if and only if C is identified by some
  6500. <column reference> contained in VE.
  6501. Access Rules
  6502. None.
  6503. Scalar expressions 155
  6504. X3H2-92-154/DBL CBR-002
  6505. 6.11 <value expression>
  6506. General Rules
  6507. 1) When a <value expression> V is evaluated for a row of a table,
  6508. each reference to a column of that table by a <column reference>
  6509. directly contained in V is a reference to the value of that
  6510. column in that row.
  6511. 2) If a <value expression primary> is a <scalar subquery> and the
  6512. result of the <subquery> is empty, then the result of the <value
  6513. expression primary> is the null value.
  6514. Leveling Rules
  6515. 1) The following restrictions apply for Intermediate SQL:
  6516. None.
  6517. 2) The following restrictions apply for Entry SQL in addition to
  6518. any Intermediate SQL restrictions:
  6519. a) A <value expression> shall not be a <datetime value expres-
  6520. sion>.
  6521. b) A <value expression> shall not be an <interval value expres-
  6522. sion>.
  6523. c) A <value expression primary> shall not be a <case expres-
  6524. sion>.
  6525. d) A <value expression primary> shall not be a <cast specifica-
  6526. tion>.
  6527. e) A <value expression primary> shall not be a <scalar subquery>
  6528. except when the <value expression primary> is simply con-
  6529. tained in a <value expression> that is simply contained in
  6530. the second <row value constructor> of a <comparison predi-
  6531. cate>.
  6532. 156 Database Language SQL
  6533. X3H2-92-154/DBL CBR-002
  6534. 6.12 <numeric value expression>
  6535. 6.12 <numeric value expression>
  6536. Function
  6537. Specify a numeric value.
  6538. Format
  6539. <numeric value expression> ::=
  6540. <term>
  6541. | <numeric value expression> <plus sign> <term>
  6542. | <numeric value expression> <minus sign> <term>
  6543. <term> ::=
  6544. <factor>
  6545. | <term> <asterisk> <factor>
  6546. | <term> <solidus> <factor>
  6547. <factor> ::=
  6548. [ <sign> ] <numeric primary>
  6549. <numeric primary> ::=
  6550. <value expression primary>
  6551. | <numeric value function>
  6552. Syntax Rules
  6553. 1) If the data type of both operands of a dyadic arithmetic opera-
  6554. tor is exact numeric, then the data type of the result is exact
  6555. numeric, with precision and scale determined as follows:
  6556. a) Let S1 and S2 be the scale of the first and second operands
  6557. respectively.
  6558. b) The precision of the result of addition and subtraction is
  6559. implementation-defined, and the scale is the maximum of S1
  6560. and S2.
  6561. c) The precision of the result of multiplication is implementation-
  6562. defined, and the scale is S1 + S2.
  6563. d) The precision and scale of the result of division is
  6564. implementation-defined.
  6565. 2) If the data type of either operand of a dyadic arithmetic op-
  6566. erator is approximate numeric, then the data type of the re-
  6567. sult is approximate numeric. The precision of the result is
  6568. implementation-defined.
  6569. 3) The data type of a <factor> is that of the immediately contained
  6570. <numeric primary>.
  6571. Scalar expressions 157
  6572. X3H2-92-154/DBL CBR-002
  6573. 6.12 <numeric value expression>
  6574. 4) The data type of a <numeric primary> shall be numeric.
  6575. Access Rules
  6576. None.
  6577. General Rules
  6578. 1) If the value of any <numeric primary> simply contained in a
  6579. <numeric value expression> is the null value, then the result of
  6580. the <numeric value expression> is the null value.
  6581. 2) If the <numeric value expression> contains only a <numeric pri-
  6582. mary>, then the value of the <numeric value expression> is the
  6583. value of the specified <numeric primary>.
  6584. 3) The monadic arithmetic operators <plus sign> and <minus sign>
  6585. (+ and -, respectively) specify monadic plus and monadic minus,
  6586. respectively. Monadic plus does not change its operand. Monadic
  6587. minus reverses the sign of its operand.
  6588. 4) The dyadic arithmetic operators <plus sign>, <minus sign>, <as-
  6589. terisk>, and <solidus> (+, -, *, and /, respectively) specify
  6590. addition, subtraction, multiplication, and division, respec-
  6591. tively. If the value of a divisor is zero, then an exception
  6592. condition is raised: data exception-division by zero.
  6593. 5) If the type of the result of an arithmetic operation is exact
  6594. numeric, then
  6595. Case:
  6596. a) If the operator is not division and the mathematical result
  6597. of the operation is not exactly representable with the pre-
  6598. cision and scale of the result type, then an exception con-
  6599. dition is raised: data exception-numeric value out of range.
  6600. b) If the operator is division and the approximate mathemati-
  6601. cal result of the operation represented with the precision
  6602. and scale of the result type loses one or more leading sig-
  6603. nificant digits after rounding or truncating if necessary,
  6604. then an exception condition is raised: data exception-numeric
  6605. value out of range. The choice of whether to round or trun-
  6606. cate is implementation-defined.
  6607. 6) If the type of the result of an arithmetic operation is approx-
  6608. imate numeric and the exponent of the approximate mathematical
  6609. result of the operation is not within the implementation-defined
  6610. exponent range for the result type, then an exception condition
  6611. is raised: data exception-numeric value out of range.
  6612. 158 Database Language SQL
  6613. X3H2-92-154/DBL CBR-002
  6614. 6.12 <numeric value expression>
  6615. Leveling Rules
  6616. 1) The following restrictions apply for Intermediate SQL:
  6617. None.
  6618. 2) The following restrictions apply for Entry SQL in addition to
  6619. any Intermediate SQL restrictions:
  6620. None.
  6621. Scalar expressions 159
  6622. X3H2-92-154/DBL CBR-002
  6623. 6.13 <string value expression>
  6624. 6.13 <string value expression>
  6625. Function
  6626. Specify a character string value or a bit string value.
  6627. Format
  6628. <string value expression> ::=
  6629. <character value expression>
  6630. | <bit value expression>
  6631. <character value expression> ::=
  6632. <concatenation>
  6633. | <character factor>
  6634. <concatenation> ::=
  6635. <character value expression> <concatenation operator>
  6636. <character factor>
  6637. <character factor> ::=
  6638. <character primary> [ <collate clause> ]
  6639. <character primary> ::=
  6640. <value expression primary>
  6641. | <string value function>
  6642. <bit value expression> ::=
  6643. <bit concatenation>
  6644. | <bit factor>
  6645. <bit concatenation> ::=
  6646. <bit value expression> <concatenation operator> <bit factor>
  6647. <bit factor> ::= <bit primary>
  6648. <bit primary> ::=
  6649. <value expression primary>
  6650. | <string value function>
  6651. Syntax Rules
  6652. 1) The data type of a <character primary> shall be character
  6653. string.
  6654. 2) Character strings of different character repertoires shall
  6655. not be mixed in a <character value expression>. The character
  6656. repertoire of a <character value expression> is the character
  6657. repertoire of its components.
  6658. 160 Database Language SQL
  6659. X3H2-92-154/DBL CBR-002
  6660. 6.13 <string value expression>
  6661. 3) Case:
  6662. a) If <concatenation> is specified, then:
  6663. Let D1 be the data type of the <character value expression>
  6664. and let D2 be the data type of the <character factor>. Let
  6665. M be the length in characters of D1 plus the length in char-
  6666. acters of D2. Let VL be the implementation-defined maximum
  6667. length of a variable-length character string and let FL be
  6668. the implementation-defined maximum length of a fixed-length
  6669. character string.
  6670. Case:
  6671. i) If the data type of the <character value expression> or
  6672. <character factor> is variable-length character string,
  6673. then the data type of the <concatenation> is variable-
  6674. length character string with maximum length equal to the
  6675. lesser of M and VL.
  6676. ii) If the data type of the <character value expression> and
  6677. <character factor> is fixed-length character string, then M
  6678. shall not be greater than FL and the data type of the <con-
  6679. catenation> is fixed-length character string with length M.
  6680. b) Otherwise, the data type of the <character value expression>
  6681. is the data type of the <character factor>.
  6682. 4) Case:
  6683. a) If <character factor> is specified, then
  6684. Case:
  6685. i) If <collate clause> is specified, then the <character value
  6686. expression> has the collating sequence given in <collate
  6687. clause>, and has the Explicit coercibility attribute.
  6688. ii) Otherwise, if <value expression primary> or <string value
  6689. function> are specified, then the collating sequence and
  6690. coercibility attribute of the <character factor> are spec-
  6691. ified in Subclause 6.2, "<value specification> and <target
  6692. specification>", and Subclause 6.7, "<string value func-
  6693. tion>", respectively.
  6694. b) If <concatenation> is specified, then the collating sequence
  6695. and the coercibility attribute are determined as specified
  6696. for dyadic operators in Subclause 4.2.3, "Rules determining
  6697. collating sequence usage".
  6698. 5) The data type of a <bit primary> shall be bit string.
  6699. Scalar expressions 161
  6700. X3H2-92-154/DBL CBR-002
  6701. 6.13 <string value expression>
  6702. 6) Case:
  6703. a) If <bit concatenation> is specified, then let D1 be the
  6704. data type of the <bit value expression>, let D2 be the data
  6705. type of the <bit factor>, let M be the length in bits of D1
  6706. plus the length in bits of D2, let VL be the implementation-
  6707. defined maximum length of a variable-length bit string, and
  6708. let FL be the implementation-defined maximum length of a
  6709. fixed-length bit string.
  6710. Case:
  6711. i) If the data type of the <bit value expression> or <bit
  6712. factor> is variable-length bit string, then the data type
  6713. of the <bit concatenation> is variable-length bit string
  6714. with maximum length equal to the lesser of M and VL.
  6715. ii) If the data type of the <bit value expression> and <bit
  6716. factor> is fixed-length bit string, then M shall not be
  6717. greater than FL and the data type of the <bit concatena-
  6718. tion> is fixed-length bit string with length M.
  6719. b) Otherwise, the data type of a <bit value expression> is the
  6720. data type of the <bit factor>.
  6721. Access Rules
  6722. None.
  6723. General Rules
  6724. 1) If the value of any <character primary> simply contained in a
  6725. <character value expression> is the null value, then the result
  6726. of the <character value expression> is the null value.
  6727. 2) If <concatenation> is specified, then let S1 and S2 be the re-
  6728. sult of the <character value expression> and <character factor>,
  6729. respectively.
  6730. Case:
  6731. a) If either S1 or S2 is the null value, then the result of the
  6732. <concatenation> is the null value.
  6733. b) Otherwise, let S be the string consisting of S1 followed by
  6734. S2 and let M be the length of S.
  6735. Case:
  6736. i) If the data type of either S1 or S2 is variable-length
  6737. character string, then
  6738. Case:
  6739. 1) If M is less than or equal to VL, then the result of the
  6740. <concatenation> is S with length M.
  6741. 162 Database Language SQL
  6742. X3H2-92-154/DBL CBR-002
  6743. 6.13 <string value expression>
  6744. 2) If M is greater than VL and the right-most M-VL charac-
  6745. ters of S are all the <space> character, then the result
  6746. of the <concatenation> is the first VL characters of S
  6747. with length VL.
  6748. 3) Otherwise, an exception condition is raised: data
  6749. exception-string data, right truncation.
  6750. ii) If the data types of both S1 and S2 are fixed-length char-
  6751. acter string, then the result of the <concatenation> is
  6752. S.
  6753. 3) If the value of any <bit primary> simply contained in a <bit
  6754. value expression> is the null value, then the result of the <bit
  6755. value expression> is the null value.
  6756. 4) If <bit concatenation> is specified, then let S1 and S2 be the
  6757. result of the <bit value expression> and <bit factor>, respec-
  6758. tively.
  6759. Case:
  6760. a) If either S1 or S2 is the null value, then the result of the
  6761. <bit concatenation> is the null value.
  6762. b) Otherwise, let S be the string consisting of S1 followed by
  6763. S2 and let M be the length in bits of S.
  6764. Case:
  6765. i) If the data type of either S1 or S2 is variable-length bit
  6766. string, then
  6767. Case:
  6768. 1) If M is less than or equal to VL, then the result of the
  6769. <bit concatenation> is S with length M.
  6770. 2) If M is greater than VL and the right-most M-VL bits of
  6771. S are all 0-valued, then the result of the <bit concate-
  6772. nation> is the first VL bits of S with length VL.
  6773. 3) Otherwise, an exception condition is raised: data
  6774. exception-string data, right truncation.
  6775. ii) If the data types of both S1 and S2 are fixed-length bit
  6776. string, then the result of the <bit concatenation> is S.
  6777. Leveling Rules
  6778. 1) The following restrictions apply for Intermediate SQL:
  6779. a) Conforming Intermediate SQL language shall not contain any
  6780. <collate clause>.
  6781. b) Conforming Intermediate SQL language shall contain no <bit
  6782. value expression>.
  6783. Scalar expressions 163
  6784. X3H2-92-154/DBL CBR-002
  6785. 6.13 <string value expression>
  6786. 2) The following restrictions apply for Entry SQL in addition to
  6787. any Intermediate SQL restrictions:
  6788. a) A <character value expression> shall not be a <concatena-
  6789. tion>.
  6790. 164 Database Language SQL
  6791. X3H2-92-154/DBL CBR-002
  6792. 6.14 <datetime value expression>
  6793. 6.14 <datetime value expression>
  6794. Function
  6795. Specify a datetime value.
  6796. Format
  6797. <datetime value expression> ::=
  6798. <datetime term>
  6799. | <interval value expression> <plus sign> <datetime term>
  6800. | <datetime value expression> <plus sign> <interval term>
  6801. | <datetime value expression> <minus sign> <interval term>
  6802. <datetime term> ::=
  6803. <datetime factor>
  6804. <datetime factor> ::=
  6805. <datetime primary> [ <time zone> ]
  6806. <datetime primary> ::=
  6807. <value expression primary>
  6808. | <datetime value function>
  6809. <time zone> ::=
  6810. AT <time zone specifier>
  6811. <time zone specifier> ::=
  6812. LOCAL
  6813. | TIME ZONE <interval value expression>
  6814. Syntax Rules
  6815. 1) The data type of a <datetime primary> shall be datetime.
  6816. 2) Case:
  6817. a) If the <datetime value expression> is a <datetime term>, then
  6818. the precision of the result of the <datetime value expres-
  6819. sion> is the precision of the <datetime value function> or
  6820. <value expression primary> that it simply contains.
  6821. b) Otherwise, the precision of the result of the <datetime value
  6822. expression> is the precision of the <datetime value expres-
  6823. sion> or <datetime term> that it simply contains.
  6824. 3) If an <interval value expression> or <interval term> is spec-
  6825. ified, then the <interval value expression> or <interval term>
  6826. shall only contain <datetime field>s that are contained within
  6827. the <datetime value expression> or <datetime term>.
  6828. Scalar expressions 165
  6829. X3H2-92-154/DBL CBR-002
  6830. 6.14 <datetime value expression>
  6831. 4) The data type of the <interval value expression> immediately
  6832. contained in a <time zone specifier> shall be INTERVAL HOUR TO
  6833. MINUTE.
  6834. 5) Case:
  6835. a) If the data type of the <datetime primary> is DATE, then
  6836. <time zone> shall not be specified.
  6837. b) If the data type of the <datetime primary> is TIME or
  6838. TIMESTAMP and <time zone> is not specified, then "AT LOCAL"
  6839. is implicit.
  6840. Access Rules
  6841. None.
  6842. General Rules
  6843. 1) If the result of any <datetime primary>, <interval value expres-
  6844. sion>, <datetime value expression>, or <interval term> simply
  6845. contained in a <datetime value expression> is the null value,
  6846. then the result of the <datetime value expression> is the null
  6847. value.
  6848. 2) If <time zone> is specified or implied and the <interval value
  6849. expression> immediately contained in <time zone specifier> is
  6850. the null value, then the result of the <datetime value expres-
  6851. sion> is the null value.
  6852. 3) If a <datetime value expression> immediately contains the opera-
  6853. tor + or -, then the result is effectively evaluated as follows:
  6854. a) Case:
  6855. i) If <datetime value expression> immediately contains the
  6856. operator + and the <interval value expression> or <interval
  6857. term> is not negative, or if <datetime value expression>
  6858. immediately contains the operator - and the <interval term>
  6859. is negative, then successive <datetime field>s of the <in-
  6860. terval value expression> or <interval term> are added to
  6861. the corresponding fields of the <datetime value expression>
  6862. or <datetime term>.
  6863. ii) Otherwise, successive <datetime field>s of the <interval
  6864. value expression> or <interval term> are subtracted from
  6865. the corresponding fields of the <datetime value expression>
  6866. or <datetime term>.
  6867. b) Arithmetic is performed so as to maintain the integrity of
  6868. the datetime data type that is the result of the <datetime
  6869. value expression>. This may involve carry from or to the
  6870. immediately next more significant <datetime field>. If the
  6871. data type of the <datetime value expression> is TIME, then
  6872. 166 Database Language SQL
  6873. X3H2-92-154/DBL CBR-002
  6874. 6.14 <datetime value expression>
  6875. arithmetic on the HOUR <datetime field> is undertaken modulo
  6876. 24. If the <interval value expression> or <interval term> is
  6877. a year-month interval, then the DAY field of the result is
  6878. the same as the DAY field of the <datetime term> or <datetime
  6879. value expression>.
  6880. c) If, after the preceding step, any <datetime field> of the
  6881. result is outside the permissible range of values for the
  6882. field or the result is invalid based on the natural rules for
  6883. dates and times, then an exception condition is raised: data
  6884. exception-datetime field overflow.
  6885. Note: For the permissible range of values for <datetime
  6886. field>s, see Table 10, "Valid values for fields in datetime
  6887. items".
  6888. 4) If <time zone> is specified or implied, then:
  6889. a) If LOCAL is specified, then let TZ be the current default
  6890. time zone displacement of the SQL-session. Otherwise, let
  6891. TZ be the value of the <simple value specification> simply
  6892. contained in the <time zone>.
  6893. b) If the value of the <interval value expression> immediately
  6894. contained in <time zone specifier> is less than INTERVAL
  6895. -'12:59' or greater than INTERVAL +'13:00', then an excep-
  6896. tion condition is raised: data exception-invalid time zone
  6897. displacement value.
  6898. c) Let DV be the value of the <datetime primary> directly con-
  6899. tained in the <datetime value expression> expressed as a
  6900. datetime normalized to UTC.
  6901. d) The value of the <datetime value expression> is calculated
  6902. as:
  6903. DV - TZ
  6904. Leveling Rules
  6905. 1) The following restrictions apply for Intermediate SQL:
  6906. None.
  6907. 2) The following restrictions apply for Entry SQL in addition to
  6908. any Intermediate SQL restrictions:
  6909. a) Conforming Entry SQL language shall not contain any <datetime
  6910. value expression>.
  6911. Scalar expressions 167
  6912. X3H2-92-154/DBL CBR-002
  6913. 6.15 <interval value expression>
  6914. 6.15 <interval value expression>
  6915. Function
  6916. Specify an interval value.
  6917. Format
  6918. <interval value expression> ::=
  6919. <interval term>
  6920. | <interval value expression 1> <plus sign> <interval term 1>
  6921. | <interval value expression 1> <minus sign> <interval term 1>
  6922. | <left paren> <datetime value expression> <minus sign>
  6923. <datetime term> <right paren> <interval qualifier>
  6924. <interval term> ::=
  6925. <interval factor>
  6926. | <interval term 2> <asterisk> <factor>
  6927. | <interval term 2> <solidus> <factor>
  6928. | <term> <asterisk> <interval factor>
  6929. <interval factor> ::=
  6930. [ <sign> ] <interval primary>
  6931. <interval primary> ::=
  6932. <value expression primary> [ <interval qualifier> ]
  6933. <interval value expression 1> ::= <interval value expression>
  6934. <interval term 1> ::= <interval term>
  6935. <interval term 2> ::= <interval term>
  6936. Syntax Rules
  6937. 1) The data type of an <interval value expression> is interval. The
  6938. data type of an <interval primary> shall be interval.
  6939. 2) An <interval primary> shall specify <interval qualifier> only if
  6940. the <interval primary> specifies a <dynamic parameter specifica-
  6941. tion>.
  6942. 3) Case:
  6943. a) If the <interval value expression> simply contains an <in-
  6944. terval qualifier>, then the result contains the <datetime
  6945. field>s specified in the <interval qualifier>.
  6946. b) If the <interval value expression> is an <interval term>,
  6947. then the result of an <interval value expression> contains
  6948. the same <datetime field>s as the <interval primary>.
  6949. 168 Database Language SQL
  6950. X3H2-92-154/DBL CBR-002
  6951. 6.15 <interval value expression>
  6952. c) If <interval term 1> is specified, then the result contains
  6953. all the <datetime field>s that are contained within either
  6954. <interval value expression 1> or <interval term 1>.
  6955. 4) Case:
  6956. a) If <interval term 1> is a year-month interval, then <interval
  6957. value expression 1> shall be a year-month interval.
  6958. b) If <interval term 1> is a day-time interval, then <interval
  6959. value expression 1> shall be a day-time interval.
  6960. 5) If <datetime value expression> is specified, then <datetime
  6961. value expression> and <datetime term> shall be comparable.
  6962. Access Rules
  6963. None.
  6964. General Rules
  6965. 1) If an <interval term> specifies "<term> * <interval factor>",
  6966. then let T and F be respectively the value of the <term> and
  6967. the value of the <interval factor>. The result of the <interval
  6968. term> is the result of F * T.
  6969. 2) If the result of any <interval primary>, <datetime value ex-
  6970. pression>, <datetime term>, or <factor> simply contained in an
  6971. <interval value expression> is the null value, then the result
  6972. of the <interval value expression> is the null value.
  6973. 3) If the <sign> of an <interval factor> is <minus sign>, then the
  6974. value of the <interval factor> is the negative of the value of
  6975. the <interval primary>.
  6976. 4) If <interval term 2> is specified, then:
  6977. a) Let X be the value of <interval term 2> and let Y be the
  6978. value of <factor>.
  6979. b) Let P and Q be respectively the most significant and least
  6980. significant <datetime field>s of <interval term 2>.
  6981. c) Let E be an exact numeric result of the operation
  6982. CAST (CAST (X AS INTERVAL Q) AS E1)
  6983. where E1 is an exact numeric data type of sufficient scale
  6984. and precision so as to not lose significant digits.
  6985. d) Let OP be the operator * or / specified in the <interval
  6986. value expression>.
  6987. Scalar expressions 169
  6988. X3H2-92-154/DBL CBR-002
  6989. 6.15 <interval value expression>
  6990. e) Let I, the result of the <interval value expression> ex-
  6991. pressed in terms of the <datetime field> Q, be the result
  6992. of
  6993. CAST ((E OP Y) AS INTERVAL Q).
  6994. f) The result of the <interval value expression> is
  6995. CAST (I AS INTERVAL W)
  6996. where W is an <interval qualifier> identifying the <datetime
  6997. field>s P TO Q, but with <interval leading field precision>
  6998. such that significant digits are not lost.
  6999. 5) If <interval term 1> is specified, then let P and Q be respec-
  7000. tively the most significant and least significant <datetime
  7001. field>s in <interval term 1> and <interval value expression 1>,
  7002. let X be the value of <interval value expression 1>, and let Y
  7003. be the value of <interval term 1>.
  7004. a) Let A be an exact numeric result of the operation
  7005. CAST (CAST (X AS INTERVAL Q) AS E1)
  7006. where E1 is an exact numeric data type of sufficient scale
  7007. and precision so as to not lose significant digits.
  7008. b) Let B be an exact numeric result of the operation
  7009. CAST (CAST (Y AS INTERVAL Q) AS E2)
  7010. where E2 is an exact numeric data type of sufficient scale
  7011. and precision so as to not lose significant digits.
  7012. c) Let OP be the operator + or - specified in the <interval
  7013. value expression>.
  7014. d) Let I, the result of the <interval value expression> ex-
  7015. pressed in terms of the <datetime field> Q, be the result
  7016. of:
  7017. CAST ((A OP B) AS INTERVAL Q)
  7018. e) The result of the <interval value expression> is
  7019. CAST (I AS INTERVAL W)
  7020. where W is an <interval qualifier> identifying the <datetime
  7021. field>s P TO Q, but with <interval leading field precision>
  7022. such that significant digits are not lost.
  7023. 6) If <datetime value expression> is specified, then let Y be the
  7024. least significant <datetime field> specified by <interval qual-
  7025. ifier>. Let A be the value represented by <datetime value ex-
  7026. pression> and let B be the value represented by <datetime term>.
  7027. 170 Database Language SQL
  7028. X3H2-92-154/DBL CBR-002
  7029. 6.15 <interval value expression>
  7030. Evaluation of <interval value expression> proceeds as follows:
  7031. a) A and B are converted to integer scalars A2 and B2 respec-
  7032. tively in units Y as displacements from some implementation-
  7033. dependent start datetime.
  7034. b) The result is determined by effectively computing A2-B2 and
  7035. then converting the difference to an interval using an <in-
  7036. terval qualifier> whose <end field> is Y and whose <start
  7037. field> is sufficiently significant to avoid loss of signif-
  7038. icant digits. That interval is then converted to an inter-
  7039. val using the specified <interval qualifier>, rounding or
  7040. truncating if necessary. The choice of whether to round or
  7041. truncate is implementation-defined.
  7042. Leveling Rules
  7043. 1) The following restrictions apply for Intermediate SQL:
  7044. None.
  7045. 2) The following restrictions apply for Entry SQL in addition to
  7046. any Intermediate SQL restrictions:
  7047. a) Conforming Entry SQL language shall not contain any <interval
  7048. value expression>.
  7049. Scalar expressions 171
  7050. X3H2-92-154/DBL CBR-002
  7051. 172 Database Language SQL
  7052. X3H2-92-154/DBL CBR-002
  7053. 7 Query expressions
  7054. 7.1 <row value constructor>
  7055. Function
  7056. Specify an ordered set of values to be constructed into a row or
  7057. partial row.
  7058. Format
  7059. <row value constructor> ::=
  7060. <row value constructor element>
  7061. | <left paren> <row value constructor list> <right paren>
  7062. | <row subquery>
  7063. <row value constructor list> ::=
  7064. <row value constructor element>
  7065. [ { <comma> <row value constructor element> }... ]
  7066. <row value constructor element> ::=
  7067. <value expression>
  7068. | <null specification>
  7069. | <default specification>
  7070. <null specification> ::=
  7071. NULL
  7072. <default specification> ::=
  7073. DEFAULT
  7074. Syntax Rules
  7075. 1) If a <row value constructor> simply contains a <null speci-
  7076. fication> or a <default specification>, then the <row value
  7077. constructor> shall be simply contained in a <query expression>
  7078. that is simply contained in an <insert statement>.
  7079. 2) A <row value constructor element> immediately contained in a
  7080. <row value constructor> shall not be a <value expression> of the
  7081. form "<left paren> <value expression> <right paren>".
  7082. Note: This Rule removes a syntactic ambiguity. A <row value
  7083. constructor> of this form is permitted, but is parsed in the
  7084. form "<left paren> <row value constructor list> <right paren>".
  7085. Query expressions 173
  7086. X3H2-92-154/DBL CBR-002
  7087. 7.1 <row value constructor>
  7088. 3) A <row value constructor> that immediately contains a <row value
  7089. constructor element> X is equivalent to a <row value construc-
  7090. tor> of the form
  7091. ( X )
  7092. 4) The data types of the column or columns of a <row value con-
  7093. structor> are the data types of the <row value constructor ele-
  7094. ment> or <row value constructor element>s or the columns of the
  7095. <row subquery> simply contained in the <row value constructor>.
  7096. 5) If a <row value constructor> is derived from a <row subquery>,
  7097. then the degree of the <row value constructor> is the degree
  7098. of the table resulting from the <row subquery>; otherwise, the
  7099. degree of the <row value constructor> is the number of <row
  7100. value constructor element>s that occur in its specification.
  7101. Access Rules
  7102. None.
  7103. General Rules
  7104. 1) The value of a <null specification> is the null value.
  7105. 2) The value of a <default specification> is the default value in-
  7106. dicated in the column descriptor for the corresponding column in
  7107. the explicit or implicit <insert column list> simply contained
  7108. in the <insert statement>.
  7109. 3) Case:
  7110. a) If a <row value constructor list> is specified, then the re-
  7111. sult of the <row value constructor> is a row of columns whose
  7112. i-th column has an implementation-dependent name different
  7113. from the <column name> of all other columns contained in the
  7114. SQL-statement and whose value is the value of the i-th <row
  7115. value constructor element> in the <row value constructor
  7116. list>.
  7117. b) If the <row value constructor> is a <row subquery>, then:
  7118. i) Let R be the result of the <row subquery> and let D be the
  7119. degree of R.
  7120. ii) If the cardinality of R is 0, then the result of the <row
  7121. value constructor> is D null values.
  7122. iii) If the cardinality of R is 1, then the result of the <row
  7123. value constructor> is R.
  7124. 174 Database Language SQL
  7125. X3H2-92-154/DBL CBR-002
  7126. 7.1 <row value constructor>
  7127. Leveling Rules
  7128. 1) The following restrictions apply for Intermediate SQL:
  7129. a) A <row value constructor> that is not simply contained in
  7130. a <table value constructor> shall not contain more than one
  7131. <row value constructor element>.
  7132. 2) The following restrictions apply for Entry SQL in addition to
  7133. any Intermediate SQL restrictions:
  7134. a) A <row value constructor element> shall not specify DEFAULT.
  7135. Query expressions 175
  7136. X3H2-92-154/DBL CBR-002
  7137. 7.2 <table value constructor>
  7138. 7.2 <table value constructor>
  7139. Function
  7140. Specify a set of <row value constructor>s to be constructed into a
  7141. table.
  7142. Format
  7143. <table value constructor> ::=
  7144. VALUES <table value constructor list>
  7145. <table value constructor list> ::=
  7146. <row value constructor> [ { <comma> <row value constructor> }... ]
  7147. Syntax Rules
  7148. 1) All <row value constructor>s shall be of the same degree.
  7149. Access Rules
  7150. None.
  7151. General Rules
  7152. 1) Let Ti be a table whose j-th column has the same data type as
  7153. the j-th <value expression> in the i-th <row value construc-
  7154. tor> and let Ti contain one row whose j-th column has the same
  7155. value as the j-th <value expression> in the i-th <row value
  7156. constructor>.
  7157. 2) The result of the <table value constructor> is the same as the
  7158. result of
  7159. T1 [ UNION ALL T2 [ . . . UNION ALL n ] . . . ]
  7160. Leveling Rules
  7161. 1) The following restrictions apply for Intermediate SQL:
  7162. a) A <table value constructor> shall contain exactly one <row
  7163. value constructor> that shall be of the form "(<row value
  7164. constructor list>)".
  7165. b) A <table value constructor> shall be the <query expression>
  7166. of an <insert statement>.
  7167. 2) The following restrictions apply for Entry SQL in addition to
  7168. any Intermediate SQL restrictions:
  7169. None.
  7170. 176 Database Language SQL
  7171. X3H2-92-154/DBL CBR-002
  7172. 7.3 <table expression>
  7173. 7.3 <table expression>
  7174. Function
  7175. Specify a table or a grouped table.
  7176. Format
  7177. <table expression> ::=
  7178. <from clause>
  7179. [ <where clause> ]
  7180. [ <group by clause> ]
  7181. [ <having clause> ]
  7182. Syntax Rules
  7183. 1) The result of a <table expression> is a derived table in which
  7184. the descriptor of the i-th column is the same as the descriptor
  7185. of the i-th column of the table specified by the <from clause>.
  7186. 2) Let C be some column. Let TE be the <table expression>. C is an
  7187. underlying column of TE if and only if C is an underlying column
  7188. of some <column reference> contained in TE.
  7189. Access Rules
  7190. None.
  7191. General Rules
  7192. 1) If all optional clauses are omitted, then the result of the <ta-
  7193. ble expression> is the same as the result of the <from clause>.
  7194. Otherwise, each specified clause is applied to the result of
  7195. the previously specified clause and the result of the <table ex-
  7196. pression> is the result of the application of the last specified
  7197. clause.
  7198. Leveling Rules
  7199. 1) The following restrictions apply for Intermediate SQL:
  7200. None.
  7201. 2) The following restrictions apply for Entry SQL in addition to
  7202. any Intermediate SQL restrictions:
  7203. a) If the table identified in the <from clause> is a grouped
  7204. view, then the <table expression> shall not contain a <where
  7205. clause>, <group by clause>, or <having clause>.
  7206. Query expressions 177
  7207. X3H2-92-154/DBL CBR-002
  7208. 7.4 <from clause>
  7209. 7.4 <from clause>
  7210. Function
  7211. Specify a table derived from one or more named tables.
  7212. Format
  7213. <from clause> ::= FROM <table reference> [ { <comma> <table reference> }... ]
  7214. Syntax Rules
  7215. 1) Case:
  7216. a) If the <from clause> contains a single <table reference> with
  7217. no intervening <derived table> or <joined table>, then the
  7218. descriptor of the result of the <from clause> is the same
  7219. as the descriptor of the table identified by that <table
  7220. reference>.
  7221. b) If the <from clause> contains more than one <table reference>
  7222. with no intervening <derived table> or <joined table>, then
  7223. the descriptors of the columns of the result of the <from
  7224. clause> are the descriptors of the columns of the tables
  7225. identified by the <table reference>s, in the order in which
  7226. the <table reference>s appear in the <from clause> and in the
  7227. order in which the columns are defined within each table.
  7228. Access Rules
  7229. None.
  7230. General Rules
  7231. 1) Case:
  7232. a) If the <from clause> contains a single <table reference> with
  7233. no intervening <derived table> or <joined table>, then the
  7234. result of the <from clause> is the table identified by that
  7235. <table reference>.
  7236. b) If the <from clause> contains more than one <table reference>
  7237. with no intervening <derived table> or <joined table>, then
  7238. the result of the <from clause> is the extended Cartesian
  7239. product of the tables identified by those <table reference>s.
  7240. The extended Cartesian product, CP, is the multiset of all
  7241. rows R such that R is the concatenation of a row from each
  7242. of the identified tables in the order in which they are iden-
  7243. tified. The cardinality of CP is the product of the cardi-
  7244. nalities of the identified tables. The ordinal position of a
  7245. 178 Database Language SQL
  7246. X3H2-92-154/DBL CBR-002
  7247. 7.4 <from clause>
  7248. column in CP is N+S, where N is the ordinal position of that
  7249. column in the identified table T from which it is derived and
  7250. S is the sum of the degrees of the tables identified before T
  7251. in the <from clause>.
  7252. Leveling Rules
  7253. 1) The following restrictions apply for Intermediate SQL:
  7254. None.
  7255. 2) The following restrictions apply for Entry SQL in addition to
  7256. any Intermediate SQL restrictions:
  7257. a) If the table identified by <table name> is a grouped view,
  7258. then the <from clause> shall contain exactly one <table ref-
  7259. erence>.
  7260. Query expressions 179
  7261. X3H2-92-154/DBL CBR-002
  7262. 7.5 <joined table>
  7263. 7.5 <joined table>
  7264. Function
  7265. Specify a table derived from a Cartesian product, inner or outer
  7266. join, or union join.
  7267. Format
  7268. <joined table> ::=
  7269. <cross join>
  7270. | <qualified join>
  7271. | <left paren> <joined table> <right paren>
  7272. <cross join> ::=
  7273. <table reference> CROSS JOIN <table reference>
  7274. <qualified join> ::=
  7275. <table reference> [ NATURAL ] [ <join type> ] JOIN
  7276. <table reference> [ <join specification> ]
  7277. <join specification> ::=
  7278. <join condition>
  7279. | <named columns join>
  7280. <join condition> ::= ON <search condition>
  7281. <named columns join> ::=
  7282. USING <left paren> <join column list> <right paren>
  7283. <join type> ::=
  7284. INNER
  7285. | <outer join type> [ OUTER ]
  7286. | UNION
  7287. <outer join type> ::=
  7288. LEFT
  7289. | RIGHT
  7290. | FULL
  7291. <join column list> ::= <column name list>
  7292. Syntax Rules
  7293. 1) Let TR1 and TR2 be the first and second <table reference>s of
  7294. the <joined table>, respectively. Let T1 and T2 be the tables
  7295. identified by TR1 and TR2, respectively. Let TA and TB be the
  7296. correlation names of TR1 and TR2, respectively. Let CP be:
  7297. SELECT * FROM TR1, TR2
  7298. 2) If a <qualified join> is specified, then
  7299. 180 Database Language SQL
  7300. X3H2-92-154/DBL CBR-002
  7301. 7.5 <joined table>
  7302. Case:
  7303. a) If NATURAL is specified, then a <join specification> shall
  7304. not be specified.
  7305. b) If UNION is specified, then neither NATURAL nor a <join spec-
  7306. ification> shall be specified.
  7307. c) Otherwise, a <join specification> shall be specified.
  7308. 3) If a <qualified join> is specified and a <join type> is not
  7309. specified, then INNER is implicit.
  7310. 4) If a <qualified join> containing a <join condition> is speci-
  7311. fied, then;
  7312. a) Each <column reference> directly contained in the <search
  7313. condition> shall unambiguously reference a column of T1 or T2
  7314. or be an outer reference.
  7315. b) If a <value expression> directly contained in the <search
  7316. condition> is a <set function specification>, then the
  7317. <joined table> shall be contained in a <having clause> or
  7318. <select list> and the <set function specification> shall
  7319. contain a <column reference> that is an outer reference.
  7320. Note: Outer reference is defined in Subclause 6.4, "<column
  7321. reference>".
  7322. 5) If neither NATURAL is specified nor a <join specification> sim-
  7323. ply containing a <named columns join> is specified, then the
  7324. descriptors of the columns of the result of the <joined table>
  7325. are the same as the descriptors of the columns of CP.
  7326. 6) If NATURAL is specified or if a <join specification> simply
  7327. containing a <named columns join> is specified, then:
  7328. a) If NATURAL is specified, then let common column name be a
  7329. <column name> that is the <column name> of exactly one column
  7330. of T1 and the <column name> of exactly one column of T2. T1
  7331. shall not have any duplicate common column names and T2 shall
  7332. not have any duplicate common column names. Let corresponding
  7333. join columns refer to all columns of T1 and T2 that have
  7334. common column names, if any.
  7335. b) If a <named columns join> is specified, then every <column
  7336. name> in the <join column list> shall be the <column name>
  7337. of exactly one column of T1 and the <column name> of exactly
  7338. one column of T2. Let common column name be the name of such
  7339. a column. Let corresponding join columns refer to the columns
  7340. of T1 and T2 identified in the <join column list>.
  7341. c) Let 1 and C2 be a pair of corresponding join columns con-
  7342. tained in T1 and T2, respectively. C1 and C2 shall be compa-
  7343. rable.
  7344. Query expressions 181
  7345. X3H2-92-154/DBL CBR-002
  7346. 7.5 <joined table>
  7347. d) Let SLCC be a <select list> of <derived column>s of the form
  7348. COALESCE ( TA.C, TB.C ) AS C
  7349. for every column C that is a corresponding join column, taken
  7350. in order of their ordinal positions in T1.
  7351. e) Let SL1 be a <select list> of those <column name>s of T1
  7352. that are not corresponding join columns, taken in order of
  7353. their ordinal positions in T1, and let SLT2 be a <select
  7354. list> of those <column name>s of T2 that are not correspond-
  7355. ing join columns, taken in order of their ordinal positions
  7356. in T2.
  7357. f) The descriptors of the columns of the result of the <joined
  7358. table> are the same as the descriptors of the columns of the
  7359. result of
  7360. SELECT SLCC, SLT1, SLT2 FROM TR1, TR2
  7361. 7) For every column CR of the result of the <joined table> that
  7362. is not a corresponding join column and that corresponds to a
  7363. column C1 of T1, CR is possibly nullable if any of the following
  7364. conditions are true:
  7365. a) RIGHT, FULL, or UNION is specified, or
  7366. b) INNER, LEFT, or CROSS JOIN is specified or implicit and 1 is
  7367. possibly nullable.
  7368. 8) For every column CR of the result of the <joined table> that
  7369. is not a corresponding join column and that corresponds to a
  7370. column C2 of T2, CR is possibly nullable if any of the following
  7371. conditions are true:
  7372. a) LEFT, FULL, or UNION is specified, or
  7373. b) INNER, RIGHT, or CROSS JOIN is specified or implicit and C
  7374. is possibly nullable.
  7375. 9) For every column CR of the result of the <joined table> that
  7376. is a corresponding join column and that corresponds to a column
  7377. C1 of T1 and C2 of T2, CR is possibly nullable if any of the
  7378. following conditions are true:
  7379. a) RIGHT, FULL, or UNION is specified and 1 is possibly nul-
  7380. lable, or
  7381. b) LEFT, FULL, or UNION is specified and 2 is possibly nul-
  7382. lable.
  7383. 10)The <joined table> is a read-only table.
  7384. 182 Database Language SQL
  7385. X3H2-92-154/DBL CBR-002
  7386. 7.5 <joined table>
  7387. Access Rules
  7388. None.
  7389. General Rules
  7390. 1) Case:
  7391. a) If <join type> is UNION, then let T be the empty set.
  7392. b) If a <cross join> is specified, then let T be the multiset of
  7393. rows of CP.
  7394. c) If a <join condition> is specified, then let T be the multi-
  7395. set of rows of CP for which the specified <search condition>
  7396. is true.
  7397. d) If NATURAL is specified or <named columns join> is specified,
  7398. then
  7399. Case:
  7400. i) If there are corresponding join columns, then let T be the
  7401. multiset of rows of CP for which the corresponding join
  7402. columns have equal values.
  7403. ii) Otherwise, let T be the multiset of rows of CP.
  7404. 2) Let P1 be the multiset of rows of T1 for which there exists in T
  7405. some row that is the concatenation of some row R1 of T1 and some
  7406. row R2 of T2. Let P2 be the multiset of rows of T2 for which
  7407. there exists in T some row that is the concatenation of some row
  7408. R1 of T1 and some row R2 of T2.
  7409. 3) Let U1 be those rows of T1 that are not in P1 and let U2 be
  7410. those rows of T2 that are not in P2.
  7411. 4) Let D1 and D2 be the degree of T1 and T2, respectively. Let
  7412. X1 be U1 extended on the right with D2 columns containing the
  7413. null value. Let X2 be U2 extended on the left with D1 columns
  7414. containing the null value.
  7415. 5) Let XN1 and XN2 be effective distinct names for X1 and X2, re-
  7416. spectively. Let TN be an effective name for T.
  7417. Case:
  7418. a) If INNER or <cross join> is specified, then let S be the
  7419. multiset of rows of T.
  7420. b) If LEFT is specified, then let S be the multiset of rows
  7421. resulting from:
  7422. SELECT * FROM TN
  7423. UNION ALL
  7424. SELECT * FROM XN1
  7425. Query expressions 183
  7426. X3H2-92-154/DBL CBR-002
  7427. 7.5 <joined table>
  7428. c) If RIGHT is specified, then let S be the multiset of rows
  7429. resulting from:
  7430. SELECT * FROM TN
  7431. UNION ALL
  7432. SELECT * FROM XN2
  7433. d) If FULL is specified, then let S be the multiset of rows
  7434. resulting from:
  7435. SELECT * FROM TN
  7436. UNION ALL
  7437. SELECT * FROM XN1
  7438. UNION ALL
  7439. SELECT * FROM XN2
  7440. e) If UNION is specified, then let S be the multiset of rows
  7441. resulting from:
  7442. SELECT * FROM XN1
  7443. UNION ALL
  7444. SELECT * FROM XN2
  7445. 6) Let SN be an effective name of S.
  7446. Case:
  7447. a) If NATURAL is specified or a <named columns join> is speci-
  7448. fied, then the result of the <joined table> is the multiset
  7449. of rows resulting from:
  7450. SELECT SLCC, SLT1, SLT2 FROM SN
  7451. b) Otherwise, the result of the <joined table> is S.
  7452. Leveling Rules
  7453. 1) The following restrictions apply for Intermediate SQL:
  7454. a) Conforming Intermediate SQL language shall contain no <cross
  7455. join>.
  7456. b) Conforming Intermediate SQL language shall not specify UNION
  7457. JOIN.
  7458. 2) The following restrictions apply for Entry SQL in addition to
  7459. any Intermediate SQL restrictions:
  7460. a) Conforming Entry SQL language shall not contain any <joined
  7461. table>.
  7462. 184 Database Language SQL
  7463. X3H2-92-154/DBL CBR-002
  7464. 7.6 <where clause>
  7465. 7.6 <where clause>
  7466. Function
  7467. Specify a table derived by the application of a <search condition>
  7468. to the result of the preceding <from clause>.
  7469. Format
  7470. <where clause> ::= WHERE <search condition>
  7471. Syntax Rules
  7472. 1) Let T be the result of the preceding <from clause>. Each <column
  7473. reference> directly contained in the <search condition> shall
  7474. unambiguously reference a column of T or be an outer reference.
  7475. Note: Outer reference is defined in Subclause 6.4, "<column
  7476. reference>".
  7477. 2) If a <value expression> directly contained in the <search condi-
  7478. tion> is a <set function specification>, then the <where clause>
  7479. shall be contained in a <having clause> or <select list> and the
  7480. <column reference> in the <set function specification> shall be
  7481. an outer reference.
  7482. Note: Outer reference is defined in Subclause 6.4, "<column
  7483. reference>".
  7484. 3) No <column reference> contained in a <subquery> in the <search
  7485. condition> that references a column of T shall be specified in a
  7486. <set function specification>.
  7487. Access Rules
  7488. None.
  7489. General Rules
  7490. 1) The <search condition> is applied to each row of T. The result
  7491. of the <where clause> is a table of those rows of T for which
  7492. the result of the <search condition> is true.
  7493. 2) Each <subquery> in the <search condition> is effectively exe-
  7494. cuted for each row of T and the results used in the application
  7495. of the <search condition> to the given row of T. If any executed
  7496. <subquery> contains an outer reference to a column of T, then
  7497. the reference is to the value of that column in the given row of
  7498. T.
  7499. Note: Outer reference is defined in Subclause 6.4, "<column
  7500. reference>".
  7501. Query expressions 185
  7502. X3H2-92-154/DBL CBR-002
  7503. 7.6 <where clause>
  7504. Leveling Rules
  7505. 1) The following restrictions apply for Intermediate SQL:
  7506. None.
  7507. 2) The following restrictions apply for Entry SQL in addition to
  7508. any Intermediate SQL restrictions:
  7509. a) A <value expression> directly contained in the <search condi-
  7510. tion> shall not include a reference to a column that gener-
  7511. ally contains a <set function specification>.
  7512. 186 Database Language SQL
  7513. X3H2-92-154/DBL CBR-002
  7514. 7.7 <group by clause>
  7515. 7.7 <group by clause>
  7516. Function
  7517. Specify a grouped table derived by the application of the <group by
  7518. clause> to the result of the previously specified clause.
  7519. Format
  7520. <group by clause> ::=
  7521. GROUP BY <grouping column reference list>
  7522. <grouping column reference list> ::=
  7523. <grouping column reference> [ { <comma> <grouping column reference> }... ]
  7524. <grouping column reference> ::=
  7525. <column reference> [ <collate clause> ]
  7526. Syntax Rules
  7527. 1) If no <where clause> is specified, then let T be the result of
  7528. the preceding <from clause>; otherwise, let T be the result of
  7529. the preceding <where clause>.
  7530. 2) Each <column reference> in the <group by clause> shall unambigu-
  7531. ously reference a column of T. A column referenced in a <group
  7532. by clause> is a grouping column.
  7533. 3) For every grouping column, if <collate clause> is specified,
  7534. then the data type of the <column reference> shall be character
  7535. string. The column descriptor of the corresponding column in the
  7536. result has the collating sequence specified in <collate clause>
  7537. and the coercibility attribute Explicit.
  7538. Access Rules
  7539. None.
  7540. General Rules
  7541. 1) The result of the <group by clause> is a partitioning of T into
  7542. a set of groups. The set is the minimum number of groups such
  7543. that, for each grouping column of each group of more than one
  7544. row, no two values of that grouping column are distinct.
  7545. 2) Every row of a given group contains equal values of a given
  7546. grouping column. When a <search condition> or <value expression>
  7547. is applied to a group, a reference to a grouping column is a
  7548. reference to that value.
  7549. Note: See the General Rules of Subclause 8.2, "<comparison pred-
  7550. icate>".
  7551. Query expressions 187
  7552. X3H2-92-154/DBL CBR-002
  7553. 7.7 <group by clause>
  7554. Leveling Rules
  7555. 1) The following restrictions apply for Intermediate SQL:
  7556. a) Conforming Intermediate SQL language shall not contain any
  7557. <collate clause>.
  7558. 2) The following restrictions apply for Entry SQL in addition to
  7559. any Intermediate SQL restrictions:
  7560. None.
  7561. 188 Database Language SQL
  7562. X3H2-92-154/DBL CBR-002
  7563. 7.8 <having clause>
  7564. 7.8 <having clause>
  7565. Function
  7566. Specify a grouped table derived by the elimination of groups from
  7567. the result of the previously specified clause that do not meet the
  7568. <search condition>.
  7569. Format
  7570. <having clause> ::= HAVING <search condition>
  7571. Syntax Rules
  7572. 1) If neither a <where clause> nor a <group by clause> is speci-
  7573. fied, then let T be the result of the preceding <from clause>;
  7574. if a <where clause> is specified, but a <group by clause> is
  7575. not specified, then let T be the result of the preceding <where
  7576. clause>; otherwise, let T be the result of the preceding <group
  7577. by clause>. Each <column reference> directly contained in the
  7578. <search condition> shall unambiguously reference a grouping
  7579. column of T or be an outer reference.
  7580. Note: Outer reference is defined in Subclause 6.4, "<column
  7581. reference>".
  7582. 2) Each <column reference> contained in a <subquery> in the <search
  7583. condition> that references a column of T shall reference a
  7584. grouping column of T or shall be specified within a <set func-
  7585. tion specification>.
  7586. 3) The <having clause> is possibly non-deterministic if it contains
  7587. a reference to a column C of T that has a data type of character
  7588. string and:
  7589. a) C is specified within a <set function specification> that
  7590. specifies MIN or MAX, or
  7591. b) C is a grouping column of T.
  7592. Access Rules
  7593. None.
  7594. General Rules
  7595. 1) Let T be the result of the preceding <from clause>, <where
  7596. clause>, or <group by clause>. If that clause is not a <group
  7597. by clause>, then T consists of a single group and does not have
  7598. a grouping column.
  7599. 2) The <search condition> is applied to each group of T. The result
  7600. of the <having clause> is a grouped table of those groups of T
  7601. for which the result of the <search condition> is true.
  7602. Query expressions 189
  7603. X3H2-92-154/DBL CBR-002
  7604. 7.8 <having clause>
  7605. 3) When the <search condition> is applied to a given group of T,
  7606. that group is the argument or argument source of each <set func-
  7607. tion specification> directly contained in the <search condition>
  7608. unless the <column reference> in the <set function specifica-
  7609. tion> is an outer reference.
  7610. Note: Outer reference is defined in Subclause 6.4, "<column
  7611. reference>".
  7612. 4) Each <subquery> in the <search condition> is effectively exe-
  7613. cuted for each group of T and the result used in the application
  7614. of the <search condition> to the given group of T. If any exe-
  7615. cuted <subquery> contains an outer reference to a column of T,
  7616. then the reference is to the values of that column in the given
  7617. group of T.
  7618. Note: Outer reference is defined in Subclause 6.4, "<column
  7619. reference>".
  7620. Leveling Rules
  7621. 1) The following restrictions apply for Intermediate SQL:
  7622. None.
  7623. 2) The following restrictions apply for Entry SQL in addition to
  7624. any Intermediate SQL restrictions:
  7625. None.
  7626. 190 Database Language SQL
  7627. X3H2-92-154/DBL CBR-002
  7628. 7.9 <query specification>
  7629. 7.9 <query specification>
  7630. Function
  7631. Specify a table derived from the result of a <table expression>.
  7632. Format
  7633. <query specification> ::=
  7634. SELECT [ <set quantifier> ] <select list> <table expression>
  7635. <select list> ::=
  7636. <asterisk>
  7637. | <select sublist> [ { <comma> <select sublist> }... ]
  7638. <select sublist> ::=
  7639. <derived column>
  7640. | <qualifier> <period> <asterisk>
  7641. <derived column> ::= <value expression> [ <as clause> ]
  7642. <as clause> ::= [ AS ] <column name>
  7643. Syntax Rules
  7644. 1) Let T be the result of the <table expression>.
  7645. 2) The degree of the table specified by a <query specification> is
  7646. equal to the cardinality of the <select list>.
  7647. 3) Case:
  7648. a) If the <select list> "*" is simply contained in a <subquery>
  7649. that is immediately contained in an <exists predicate>, then
  7650. the <select list> is equivalent to a <value expression> that
  7651. is an arbitrary <literal>.
  7652. b) Otherwise, the <select list> "*" is equivalent to a <value
  7653. expression> sequence in which each <value expression> is a
  7654. <column reference> that references a column of T and each
  7655. column of T is referenced exactly once. The columns are ref-
  7656. erenced in the ascending sequence of their ordinal position
  7657. within T.
  7658. 4) The <select sublist> "<qualifier>.*" for some <qualifier> Q is
  7659. equivalent to a <value expression> sequence in which each <value
  7660. expression> is a <column reference> CR that references a column
  7661. of T that is not a common column of a <joined table>. Each col-
  7662. umn of T that is not a common column of a <joined table> shall
  7663. be referenced exactly once. The columns shall be referenced in
  7664. the ascending sequence of their ordinal positions within T.
  7665. Note: common column of a <joined table> is defined in Subclause 7.5,
  7666. "<joined table>".
  7667. Query expressions 191
  7668. X3H2-92-154/DBL CBR-002
  7669. 7.9 <query specification>
  7670. 5) Let C be some column. Let QS be the <query specification>. Let
  7671. DCi, for i ranging from 1 to the number of <derived column>s
  7672. inclusively, be the i-th <derived column> simply contained in
  7673. the <select list> of QS. For all i, C is an underlying column
  7674. of DCi, and of any <column reference> that identifies DCi, if
  7675. and only if C is an underlying column of the <value expression>
  7676. of DCi, or C is an underlying column of the <table expression>
  7677. immediately contained in QS.
  7678. 6) Each <column reference> directly contained in each <value ex-
  7679. pression> and each <column reference> contained in a <set
  7680. function specification> directly contained in each <value ex-
  7681. pression> shall unambiguously reference a column of T.
  7682. 7) If T is a grouped table, then each <column reference> in each
  7683. <value expression> that references a column of T shall refer-
  7684. ence a grouping column or be specified within a <set function
  7685. specification>. If T is not a grouped table and any <value ex-
  7686. pression> contains a <set function specification> that contains
  7687. a reference to a column of T or any <value expression> directly
  7688. contains a <set function specification> that does not contain an
  7689. outer reference, then every <column reference> in every <value
  7690. expression> that references a column of T shall be specified
  7691. within a <set function specification>.
  7692. 8) Each column of the table that is the result of a <query spec-
  7693. ification> has a column descriptor that includes a data type
  7694. descriptor that is the same as the data type descriptor of the
  7695. <value expression> from which the column was derived.
  7696. 9) Case:
  7697. a) If the i-th <derived column> in the <select list> specifies
  7698. an <as clause> that contains a <column name> C, then the
  7699. <column name> of the i-th column of the result is C.
  7700. b) If the i-th <derived column> in the <select list> does not
  7701. specify an <as clause> and the <value expression> of that
  7702. <derived column> is a single <column reference>, then the
  7703. <column name> of the i-th column of the result is C.
  7704. c) Otherwise, the <column name> of the i-th column of the <query
  7705. specification> is implementation-dependent and different
  7706. from the <column name> of any column, other than itself, of
  7707. a table referenced by any <table reference> contained in the
  7708. SQL-statement.
  7709. 10)A column of the table that is the result of a <query specifica-
  7710. tion> is possibly nullable if and only if it contains a <column
  7711. reference> for a column C that is possibly nullable, an <indica-
  7712. tor parameter>, an <indicator variable>, a <subquery>, CAST NULL
  7713. AS X (X represents a <data type> or a <domain name>), SYSTEM_
  7714. USER, or a <set function specification> that does not contain
  7715. COUNT.
  7716. 192 Database Language SQL
  7717. X3H2-92-154/DBL CBR-002
  7718. 7.9 <query specification>
  7719. 11)Let TREF be the <table reference>s that are simply contained
  7720. in the <from clause> of the <table expression>. The simply un-
  7721. derlying tables of the <query specification> are the tables
  7722. identified by the <table name>s and <derived table>s contained
  7723. in TREF without an intervening <derived table>.
  7724. 12)A <query specification> QS is updatable if and only if the fol-
  7725. lowing conditions hold:
  7726. a) QS does not specify DISTINCT.
  7727. b) Every <value expression> contained in the <select list> imme-
  7728. diately contained in QS consists of a <column reference>, and
  7729. no <column reference> appears more than once.
  7730. c) The <from clause> immediately contained in the <table ex-
  7731. pression> immediately contained in QS specifies exactly one
  7732. <table reference> and that <table reference> refers either to
  7733. a base table or to an updatable derived table.
  7734. Note: updatable derived table is defined in Subclause 6.3,
  7735. "<table reference>".
  7736. d) If the <table expression> immediately contained in QS imme-
  7737. diately contains a <where clause> WC, then no leaf generally
  7738. underlying table of QS shall be a generally underlying table
  7739. of any <query expression> contained in WC.
  7740. e) The <table expression> immediately contained in QS does not
  7741. include a <group by clause> or a <having clause>.
  7742. 13)A <query specification> is possibly non-deterministic if any of
  7743. the following conditions are true:
  7744. a) The <set quantifier> DISTINCT is specified and one of the
  7745. columns of T has a data type of character string; or
  7746. b) The <query specification> directly contains a <having clause>
  7747. that is possibly non-deterministic; or
  7748. c) The <select list> contains a reference to a column C of T
  7749. that has a data type of character string and either
  7750. i) C is specified with a <set function specification> that
  7751. specifies MIN or MAX, or
  7752. ii) C is a grouping column of T.
  7753. Access Rules
  7754. None.
  7755. Query expressions 193
  7756. X3H2-92-154/DBL CBR-002
  7757. 7.9 <query specification>
  7758. General Rules
  7759. 1) Case:
  7760. a) If T is not a grouped table, then
  7761. Case:
  7762. i) If the <select list> contains a <set function specifica-
  7763. tion> that contains a reference to a column of T or di-
  7764. rectly contains a <set function specification> that does
  7765. not contain an outer reference, then T is the argument or
  7766. argument source of each such <set function specification>
  7767. and the result of the <query specification> is a table con-
  7768. sisting of 1 row. The i-th value of the row is the value
  7769. specified by the i-th <value expression>.
  7770. ii) If the <select list> does not include a <set function spec-
  7771. ification> that contains a reference to T, then each <value
  7772. expression> is applied to each row of T yielding a table of
  7773. M rows, where M is the cardinality of T. The i-th column of
  7774. the table contains the values derived by the evaluation of
  7775. the i-th <value expression>.
  7776. Case:
  7777. 1) If the <set quantifier> DISTINCT is not specified, then
  7778. the table is the result of the <query specification>.
  7779. 2) If the <set quantifier> DISTINCT is specified, then the
  7780. result of the <query specification> is the table derived
  7781. from that table by the elimination of any redundant
  7782. duplicate rows.
  7783. b) If T is a grouped table, then
  7784. Case:
  7785. i) If T has 0 groups, then the result of the <query specifica-
  7786. tion> is an empty table.
  7787. ii) If T has one or more groups, then each <value expression>
  7788. is applied to each group of T yielding a table of M rows,
  7789. where M is the number of groups in T. The i-th column of
  7790. the table contains the values derived by the evaluation of
  7791. the i-th <value expression>. When a <value expression> is
  7792. applied to a given group of T, that group is the argument
  7793. or argument source of each <set function specification> in
  7794. the <value expression>.
  7795. Case:
  7796. 1) If the <set quantifier> DISTINCT is not specified, then
  7797. the table is the result of the <query specification>.
  7798. 194 Database Language SQL
  7799. X3H2-92-154/DBL CBR-002
  7800. 7.9 <query specification>
  7801. 2) If the <set quantifier> DISTINCT is specified, then the
  7802. result of the <query specification> is the table derived
  7803. from T by the elimination of any redundant duplicate
  7804. rows.
  7805. Leveling Rules
  7806. 1) The following restrictions apply for Intermediate SQL:
  7807. a) The <set quantifier> DISTINCT shall not be specified more
  7808. than once in a <query specification>, excluding any <sub-
  7809. query> of that <query specification>.
  7810. 2) The following restrictions apply for Entry SQL in addition to
  7811. any Intermediate SQL restrictions:
  7812. a) A <query specification> is not updatable if the <where
  7813. clause> of the <table expression> contains a <subquery>.
  7814. b) A <select sublist> shall be a <derived column>.
  7815. c) If the <table expression> of the <query specification> is a
  7816. grouped view, then the <select list> shall not contain a <set
  7817. function specification>.
  7818. Query expressions 195
  7819. X3H2-92-154/DBL CBR-002
  7820. 7.10 <query expression>
  7821. 7.10 <query expression>
  7822. Function
  7823. Specify a table.
  7824. Format
  7825. <query expression> ::=
  7826. <non-join query expression>
  7827. | <joined table>
  7828. <non-join query expression> ::=
  7829. <non-join query term>
  7830. | <query expression> UNION [ ALL ] [ <corresponding spec> ] <query term>
  7831. | <query expression> EXCEPT [ ALL ] [ <corresponding spec> ] <query term>
  7832. <query term> ::=
  7833. <non-join query term>
  7834. | <joined table>
  7835. <non-join query term> ::=
  7836. <non-join query primary>
  7837. | <query term> INTERSECT [ ALL ] [ <corresponding spec> ] <query primary>
  7838. <query primary> ::=
  7839. <non-join query primary>
  7840. | <joined table>
  7841. <non-join query primary> ::=
  7842. <simple table>
  7843. | <left paren> <non-join query expression> <right paren>
  7844. <simple table> ::=
  7845. <query specification>
  7846. | <table value constructor>
  7847. | <explicit table>
  7848. <explicit table> ::= TABLE <table name>
  7849. <corresponding spec> ::=
  7850. CORRESPONDING [ BY <left paren> <corresponding column list> <right paren> ]
  7851. <corresponding column list> ::= <column name list>
  7852. 196 Database Language SQL
  7853. X3H2-92-154/DBL CBR-002
  7854. 7.10 <query expression>
  7855. Syntax Rules
  7856. 1) Let T be the table specified by the <query expression>.
  7857. 2) The <explicit table>
  7858. TABLE <table name>
  7859. is equivalent to the <query expression>
  7860. ( SELECT * FROM <table name> )
  7861. 3) Let set operator be UNION [ALL], EXCEPT [ALL], or INTERSECT
  7862. [ALL].
  7863. 4) T is an updatable table and the <query expression> is updatable
  7864. if and only if it simply contains a <query expression> QE or a
  7865. <query specification> QS and:
  7866. a) the <query expression> contains QE or QS without an inter-
  7867. vening <non-join query expression> that specified UNION or
  7868. EXCEPT;
  7869. b) the <query expression> contains QE or QS without an interven-
  7870. ing <non-join query term> that specifies INTERSECT; and
  7871. c) QE or QS is updatable.
  7872. 5) Case:
  7873. a) If a <simple table> is a <query specification>, then the
  7874. column descriptor of the i-th column of the <simple table> is
  7875. the same as the column descriptor of the i-th column of the
  7876. <query specification>.
  7877. b) If a <simple table> is an <explicit table>, then the column
  7878. descriptor of the i-th column of the <simple table> is the
  7879. same as the column descriptor of the i-th column of the table
  7880. identified by the <table name> contained in the <explicit
  7881. table>.
  7882. c) Otherwise, the column descriptor of the i-th column of the
  7883. <simple table> is same as the column descriptor of the i-
  7884. th column of the <table value constructor>, except that the
  7885. <column name> is implementation-dependent and different from
  7886. the <column name> of any column, other than itself, of a
  7887. table referenced by any <table reference> contained in the
  7888. SQL-statement.
  7889. 6) Case:
  7890. a) If a <non-join query primary> is a <simple table>, then the
  7891. column descriptor of the i-th column of the <non-join query
  7892. primary> is the same as the column descriptor of the i-th
  7893. column of the <simple table>.
  7894. Query expressions 197
  7895. X3H2-92-154/DBL CBR-002
  7896. 7.10 <query expression>
  7897. b) Otherwise, the column descriptor of the i-th column of the
  7898. <non-join query primary> is the same as the column descriptor
  7899. of the i-th column of the <non-join query expression>.
  7900. 7) Case:
  7901. a) If a <query primary> is a <non-join query primary>, then the
  7902. column descriptor of the i-th column of the <query primary>
  7903. is the same as the column descriptor of the i-th column of
  7904. the <non-join query primary>.
  7905. b) Otherwise, the column descriptor of the i-th column of the
  7906. <query primary> is the same as the column descriptor of the
  7907. i-th column of the <joined table>.
  7908. 8) If a set operator is specified in a <non-join query term> or a
  7909. <non-join query expression>, then let T1, T2, and TR be respec-
  7910. tively the first operand, the second operand, and the result of
  7911. the <non-join query term> or <non-join query expression>. Let
  7912. TN1 and TN2 be the effective names for T1 and T2, respectively.
  7913. 9) If a set operator is specified in a <non-join query term> or a
  7914. <non-join query expression>, then let OP be the set operator.
  7915. Case:
  7916. a) If CORRESPONDING is specified, then:
  7917. i) Within the columns of T1, the same <column name> shall not
  7918. be specified more than once and within the columns of T2,
  7919. the same <column name> shall not be specified more than
  7920. once.
  7921. ii) At least one column of T1 shall have a <column name> that
  7922. is the <column name> of some column of T2.
  7923. iii) Case:
  7924. 1) If <corresponding column list> is not specified, then
  7925. let SL be a <select list> of those <column name>s that
  7926. are <column name>s of both T1 and T2 in the order that
  7927. those <column name>s appear in T1.
  7928. 2) If <corresponding column list> is specified, then let
  7929. SL be a <select list> of those <column name>s explic-
  7930. itly appearing in the <corresponding column list> in
  7931. the order that these <column name>s appear in the <cor-
  7932. responding column list>. Every <column name> in the
  7933. <corresponding column list> shall be a <column name> of
  7934. both T1 and T2.
  7935. iv) The <non-join query term> or <non-join query expression> is
  7936. equivalent to:
  7937. ( SELECT SL FROM TN1 ) OP ( SELECT SL FROM TN2 )
  7938. 198 Database Language SQL
  7939. X3H2-92-154/DBL CBR-002
  7940. 7.10 <query expression>
  7941. b) If CORRESPONDING is not specified, then T1 and T2 shall be of
  7942. the same degree.
  7943. 10)Case:
  7944. a) If the <non-join query term> is a <non-join query primary>,
  7945. then the column descriptor of the i-th column of the <non-
  7946. join query term> is same as the column descriptor of the i-th
  7947. column of the <non-join query primary>.
  7948. b) Otherwise,
  7949. i) Case:
  7950. 1) Let C be the <column name> of the i-th column of T1. If
  7951. the <column name> of the i-th column of T2 is C, then
  7952. the <column name> of the i-th column of TR is C.
  7953. 2) Otherwise, the <column name> of the i-th column of TR is
  7954. implementation-dependent and different from the <column
  7955. name> of any column, other than itself, of any table
  7956. referenced by any <table reference> contained in the
  7957. SQL-statement.
  7958. ii) The data type of the i-th column of TR is determined by
  7959. applying Subclause 9.3, "Set operation result data types",
  7960. to the data types of the i-th column of T1 and the i-th
  7961. column of T2. If the i-th column of both T1 and T2 are
  7962. known not nullable, then the i-th column of TR is known
  7963. not nullable; otherwise, the i-th column of T is possibly
  7964. nullable.
  7965. 11)Case:
  7966. a) If a <query term> is a <non-join query term>, then the column
  7967. descriptor of the i-th column of the <query term> is the same
  7968. as the column descriptor of the i-th column of the <non-join
  7969. query term>.
  7970. b) Otherwise, the column descriptor of the i-th column of the
  7971. <query term> is the same as the column descriptor of the i-th
  7972. column of the <joined table>.
  7973. 12)Case:
  7974. a) If a <non-join query expression> is a <non-join query term>,
  7975. then the column descriptor of the i-th column of the <non-
  7976. join query expression> is the same as the column descriptor
  7977. of the i-th column of the <non-join query term>.
  7978. Query expressions 199
  7979. X3H2-92-154/DBL CBR-002
  7980. 7.10 <query expression>
  7981. b) Otherwise,
  7982. i) Case:
  7983. 1) Let C be the <column name> of the i-th column of T1. If
  7984. the <column name> of the i-th column of T2 is C, then
  7985. the <column name> of the i-th column of TR is C.
  7986. 2) Otherwise, the <column name> of the i-th column of TR is
  7987. implementation-dependent and different from the <column
  7988. name> of any column, other than itself, of any table
  7989. referenced by any <table reference> contained in the
  7990. SQL-statement.
  7991. ii) The data type of the i-th column of TR is determined by
  7992. applying Subclause 9.3, "Set operation result data types",
  7993. to the data types of the i-th column of T1 and the i-th
  7994. column of T2. If the i-th column of both T1 and T2 are
  7995. known not nullable, then the i-th column of TR is known
  7996. not nullable; otherwise, the i-th column of T is possibly
  7997. nullable.
  7998. 13)Case:
  7999. a) If a <query expression> is a <non-join query expression>,
  8000. then the column descriptor of the i-th column of the <query
  8001. expression> is the same as the column descriptor of the i-th
  8002. column of the <non-join query expression>.
  8003. b) Otherwise, the column descriptor of the i-th column of the
  8004. <query expression> is the same as the column descriptor of
  8005. the i-th column of the <joined table>.
  8006. 14)The simply underlying tables of a <query expression> are the
  8007. tables identified by those <table name>s, <query expression>s,
  8008. and <derived table>s contained in the <query expression> without
  8009. an intervening <derived table>, an intervening <query specifica-
  8010. tion>, or an intervening <join condition>.
  8011. 15)A <query expression> is possibly non-deterministic if
  8012. a) it contains a set operator UNION and ALL is not specified, or
  8013. if it contains EXCEPT or INTERSECT; and
  8014. b) the first or second operand contains a column that has a data
  8015. type of character string.
  8016. 16)The underlying columns of each column of QE and of QE itself are
  8017. defined as follows:
  8018. a) A column of a <table value constructor> has no underlying
  8019. columns.
  8020. b) The underlying columns of every i-th column of a <simple
  8021. table> ST are the underlying columns of the i-th column of
  8022. the table immediately contained in ST.
  8023. 200 Database Language SQL
  8024. X3H2-92-154/DBL CBR-002
  8025. 7.10 <query expression>
  8026. c) If no set operator is specified, then the underlying columns
  8027. of every i-th column of QE are the underlying columns of the
  8028. i-th column of the <simple table> simply contained in QE.
  8029. d) If a set operator is specified, then the underlying columns
  8030. of every i-th column of QE are the underlying columns of the
  8031. i-th column of T1 and those of the i-th column of T2.
  8032. e) Let C be some column. C is an underlying column of QE if and
  8033. only if C is an underlying column of some column of QE.
  8034. Access Rules
  8035. None.
  8036. General Rules
  8037. 1) Case:
  8038. a) If no set operator is specified, then T is the result of the
  8039. specified <simple table> or <joined table>.
  8040. b) If a set operator is specified, then the result of applying
  8041. the set operator is a table containing the following rows:
  8042. i) Let R be a row that is a duplicate of some row in T1 or of
  8043. some row in T2 or both. Let m be the number of duplicates
  8044. of R in T1 and let n be the number of duplicates of R in
  8045. T2, where m � 0 and n � 0.
  8046. ii) If ALL is not specified, then
  8047. Case:
  8048. 1) If UNION is specified, then
  8049. Case:
  8050. A) If m > 0 or n > 0, then T contains exactly one dupli-
  8051. cate of R.
  8052. B) Otherwise, T contains no duplicate of R.
  8053. 2) If EXCEPT is specified, then
  8054. Case:
  8055. A) If m > 0 and n = 0, then T contains exactly one dupli-
  8056. cate of R.
  8057. B) Otherwise, T contains no duplicate of R.
  8058. 3) If INTERSECT is specified, then
  8059. Case:
  8060. A) If m > 0 and n > 0, then T contains exactly one dupli-
  8061. cate of R.
  8062. Query expressions 201
  8063. X3H2-92-154/DBL CBR-002
  8064. 7.10 <query expression>
  8065. B) Otherwise, T contains no duplicates of R.
  8066. iii) If ALL is specified, then
  8067. Case:
  8068. 1) If UNION is specified, then the number of duplicates of
  8069. R that T contains is (m + n).
  8070. 2) If EXCEPT is specified, then the number of duplicates of
  8071. R that T contains is the maximum of (m - n) and 0.
  8072. 3) If INTERSECT is specified, then the number of duplicates
  8073. of R that T contains is the minimum of m and n.
  8074. Note: See the General Rules of Subclause 8.2, "<comparison pred-
  8075. icate>".
  8076. 2) If a set operator is specified, then for each column whose data
  8077. type is interval, let UDT be in turn the data type of the cor-
  8078. responding column of T and let SV be the value of the column
  8079. in each row of the first and second operands. The value of the
  8080. corresponding column of T in the corresponding row of T is
  8081. CAST (SV AS UDT)
  8082. Leveling Rules
  8083. 1) The following restrictions apply for Intermediate SQL:
  8084. a) A <simple table> shall not be a <table value constructor>
  8085. except in an <insert statement>.
  8086. b) Conforming Intermediate SQL shall contain no <explicit ta-
  8087. ble>.
  8088. 2) The following restrictions apply for Entry SQL in addition to
  8089. any Intermediate SQL restrictions:
  8090. a) A <query expression> shall not specify EXCEPT.
  8091. b) A <query term> shall not specify INTERSECT.
  8092. c) A <query expression> shall not contain a <joined table>.
  8093. d) A <query expression> shall not specify CORRESPONDING.
  8094. e) If UNION is specified, then except for column names, the
  8095. descriptors of the first and second operands shall be iden-
  8096. tical and the descriptor of the result is identical to the
  8097. descriptor of the operands.
  8098. 202 Database Language SQL
  8099. X3H2-92-154/DBL CBR-002
  8100. 7.11 <scalar subquery>, <row subquery>, and <table subquery>
  8101. 7.11 <scalar subquery>, <row subquery>, and <table subquery>
  8102. Function
  8103. Specify a scalar value, a row, or a table derived from a <query
  8104. expression>.
  8105. Format
  8106. <scalar subquery> ::= <subquery>
  8107. <row subquery> ::= <subquery>
  8108. <table subquery> ::= <subquery>
  8109. <subquery> ::= <left paren> <query expression> <right paren>
  8110. Syntax Rules
  8111. 1) The degree of a <scalar subquery> shall be 1.
  8112. 2) The degree of a <row subquery> shall be greater than 1.
  8113. 3) The data type of a <scalar subquery> is the data type of the
  8114. column of the <query expression> immediately contained in the
  8115. <scalar subquery>.
  8116. 4) The data types of the columns of a <row subquery> or <table
  8117. subquery> are the data types of the respective columns of the
  8118. <query expression> immediately contained in the <row subquery>
  8119. or <table subquery>.
  8120. Access Rules
  8121. None.
  8122. General Rules
  8123. 1) If the cardinality of a <scalar subquery> or a <row subquery> is
  8124. greater than 1, then an exception condition is raised: cardinal-
  8125. ity violation.
  8126. Leveling Rules
  8127. 1) The following restrictions apply for Intermediate SQL:
  8128. 2) The following restrictions apply for Entry SQL in addition to
  8129. any Intermediate SQL restrictions:
  8130. a) If a <subquery> is contained in a <comparison predicate>,
  8131. then the <table expression> in the <query specification>
  8132. shall not contain a <group by clause> or a <having clause>
  8133. and shall not identify a grouped view.
  8134. Query expressions 203
  8135. X3H2-92-154/DBL CBR-002
  8136. 7.11 <scalar subquery>, <row subquery>, and <table subquery>
  8137. b) The <query expression> contained in a <subquery> shall be a
  8138. <query specification>.
  8139. 204 Database Language SQL
  8140. X3H2-92-154/DBL CBR-002
  8141. 8 Predicates
  8142. 8.1 <predicate>
  8143. Function
  8144. Specify a condition that can be evaluated to give a truth value of
  8145. true, false, or unknown.
  8146. Format
  8147. <predicate> ::=
  8148. <comparison predicate>
  8149. | <between predicate>
  8150. | <in predicate>
  8151. | <like predicate>
  8152. | <null predicate>
  8153. | <quantified comparison predicate>
  8154. | <exists predicate>
  8155. | <unique predicate>
  8156. | <match predicate>
  8157. | <overlaps predicate>
  8158. Syntax Rules
  8159. None.
  8160. Access Rules
  8161. None.
  8162. General Rules
  8163. 1) The result of a <predicate> is a truth value derived according
  8164. to the General Rules of Subclause 8.2, "<comparison predicate>",
  8165. Subclause 8.3, "<between predicate>", Subclause 8.4, "<in predi-
  8166. cate>", Subclause 8.5, "<like predicate>", Subclause 8.6, "<null
  8167. predicate>", Subclause 8.7, "<quantified comparison predi-
  8168. cate>", Subclause 8.8, "<exists predicate>", Subclause 8.9,
  8169. "<unique predicate>", Subclause 8.10, "<match predicate>", or
  8170. Subclause 8.11, "<overlaps predicate>", as appropriate.
  8171. Predicates 205
  8172. X3H2-92-154/DBL CBR-002
  8173. 8.1 <predicate>
  8174. Leveling Rules
  8175. 1) The following restrictions apply for Intermediate SQL:
  8176. a) A <predicate> shall not be a <match predicate>.
  8177. 2) The following restrictions apply for Entry SQL in addition to
  8178. any Intermediate SQL restrictions:
  8179. a) Conforming Entry SQL language shall not contain any <overlaps
  8180. predicate>.
  8181. b) Conforming Entry SQL language shall not contain any <unique
  8182. predicate>.
  8183. 206 Database Language SQL
  8184. X3H2-92-154/DBL CBR-002
  8185. 8.2 <comparison predicate>
  8186. 8.2 <comparison predicate>
  8187. Function
  8188. Specify a comparison of two row values.
  8189. Format
  8190. <comparison predicate> ::=
  8191. <row value constructor> <comp op> <row value constructor>
  8192. <comp op> ::=
  8193. <equals operator>
  8194. | <not equals operator>
  8195. | <less than operator>
  8196. | <greater than operator>
  8197. | <less than or equals operator>
  8198. | <greater than or equals operator>
  8199. Syntax Rules
  8200. 1) The two <row value constructor>s shall be of the same degree.
  8201. 2) Let corresponding values be values with the same ordinal posi-
  8202. tion in the two <row value constructor>s.
  8203. 3) The data types of the corresponding values of the two <row value
  8204. constructor>s shall be comparable.
  8205. 4) Let X be a value in the first <row value constructor> and Y be
  8206. the corresponding value in the second <row value constructor>.
  8207. If X and Y have data type character string, then the pair-wise
  8208. comparison collating sequence used to compare X and Y is de-
  8209. termined by the table for collating sequences for comparisons
  8210. (Subclause 4.2.3, "Rules determining collating sequence usage").
  8211. For any pair of corresponding character strings, let CS be the
  8212. identified collating sequence.
  8213. Access Rules
  8214. None.
  8215. General Rules
  8216. 1) Let X and Y be any two corresponding <row value constructor
  8217. element>s. Let XV and YV be the values represented by X and Y,
  8218. respectively.
  8219. Case:
  8220. a) If XV or YV is the null value, then "X <comp op> Y" is un-
  8221. known.
  8222. Predicates 207
  8223. X3H2-92-154/DBL CBR-002
  8224. 8.2 <comparison predicate>
  8225. b) If XV and YV are non-null values, then "X <comp op> Y" is
  8226. true or false as follows:
  8227. i) "X = Y" is true if and only if XV and YV are equal.
  8228. ii) "X <> Y" is true if and only if XV and YV are not equal.
  8229. iii) "X < Y" is true if and only if XV is less than YV.
  8230. iv) "X > Y" is true if and only if XV is greater than YV.
  8231. v) "X <= Y" is true if and only if XV is not greater than YV.
  8232. vi) "X >= Y" is true if and only if XV is not less than YV.
  8233. vii) "X <comp op> Y" is false if and only if "X <comp op> Y" is
  8234. not true.
  8235. 2) Numbers are compared with respect to their algebraic value.
  8236. 3) The comparison of two character strings is determined as fol-
  8237. lows:
  8238. a) If the length in characters of X is not equal to the length
  8239. in characters of Y, then the shorter string is effectively
  8240. replaced, for the purposes of comparison, with a copy of
  8241. itself that has been extended to the length of the longer
  8242. string by concatenation on the right of one or more pad char-
  8243. acters, where the pad character is chosen based on CS. If
  8244. CS has the NO PAD attribute, then the pad character is an
  8245. implementation-dependent character different from any char-
  8246. acter in the character set of X and Y that collates less
  8247. than any string under CS. Otherwise, the pad character is a
  8248. <space>.
  8249. b) The result of the comparison of X and Y is given by the col-
  8250. lating sequence CS.
  8251. c) Depending on the collating sequence, two strings may com-
  8252. pare as equal even if they are of different lengths or con-
  8253. tain different sequences of characters. When the operations
  8254. MAX, MIN, DISTINCT, references to a grouping column, and the
  8255. UNION, EXCEPT, and INTERSECT operators refer to character
  8256. strings, the specific value selected by these operations from
  8257. a set of such equal values is implementation-dependent.
  8258. Note: If the coercibility attribute of the comparison is
  8259. Coercible, then the collating sequence used is the default de-
  8260. fined for the character repertoire. See also other Syntax Rules
  8261. in this Subclause, Subclause 10.4, "<character set specifi-
  8262. cation>", and Subclause 11.28, "<character set definition>".
  8263. 208 Database Language SQL
  8264. X3H2-92-154/DBL CBR-002
  8265. 8.2 <comparison predicate>
  8266. 4) The comparison of two bit string values, X and Y, is determined
  8267. by comparison of their bits with the same ordinal position.
  8268. If Xi and Yi are the values of the i-th bits of X and Y, re-
  8269. spectively, and if LX is the length in bits of X and LY is the
  8270. length in bits of Y, then:
  8271. a) X is equal to Y if and only if X = LY and Xi = Yi for all i.
  8272. b) X is less than Y if and only if:
  8273. i) LX < LY and Xi = Yi for all i less than or equal to LX; or
  8274. ii) Xi = Yi for all i < n and Xn = 0 and Yn = 1 for some n less
  8275. than or equal to the minimum of LX and LY.
  8276. 5) The comparison of two datetimes is determined according to the
  8277. interval resulting from their subtraction. Let X and Y be the
  8278. two values to be compared and let H be the least significant
  8279. <datetime field> of X and Y. The result of X <comp op> Y is
  8280. defined as:
  8281. ( X - Y ) H <comp op> INTERVAL (0) H
  8282. Note: Two datetimes are comparable only if they have the same
  8283. <datetime field>s; see Subclause 4.5.1, "Datetimes".
  8284. 6) The comparison of two intervals is determined by the compari-
  8285. son of their corresponding values after conversion to integers
  8286. in some common base unit. Let X and Y be the two intervals to
  8287. be compared. Let A TO B be the specified or implied datetime
  8288. qualifier of X and C TO D be the specified or implied datetime
  8289. qualifier of Y. Let T be the least significant <datetime field>
  8290. of B and D and let U be a datetime qualifier of the form T(N),
  8291. where N is an <interval leading field precision> large enough so
  8292. that significance is not lost in the CAST operation.
  8293. X is effectively replaced by CAST (X AS INTERVAL U).
  8294. Y is effectively replaced by CAST (Y AS INTERVAL U).
  8295. The result of the comparison is effectively computed as:
  8296. CAST ( X AS INTEGER ) <comp op> CAST ( Y AS INTEGER )
  8297. 7) Let Rx and Ry be the two <row value constructor>s of the <com-
  8298. parison predicate> and let RXi and RYi be the i-th <row value
  8299. constructor element>s of Rx and Ry, respectively. "Rx <comp op>
  8300. Ry" is true, false, or unknown as follows:
  8301. a) "x = Ry" is true if and only if RXi = RYi for all i.
  8302. b) "x <> Ry" is true if and only if RXi <> RYi for some i.
  8303. c) "x < Ry" is true if and only if RXi = RYi for all i < n and
  8304. RXn < RYn for some n.
  8305. d) "x > Ry" is true if and only if RXi = RYi for all i < n and
  8306. RXn > RYn for some n.
  8307. Predicates 209
  8308. X3H2-92-154/DBL CBR-002
  8309. 8.2 <comparison predicate>
  8310. e) "x <= Ry" is true if and only if Rx = Ry or Rx < Ry.
  8311. f) "x >= Ry" is true if and only if Rx = Ry or Rx > Ry.
  8312. g) "x = Ry" is false if and only if "Rx <> Ry" is true.
  8313. h) "x <> Ry" is false if and only if "Rx = Ry" is true.
  8314. i) "x < Ry" is false if and only if "Rx >= Ry" is true.
  8315. j) "x > Ry" is false if and only if "Rx <= Ry" is true.
  8316. k) "x <= Ry" is false if and only if "Rx > Ry" is true.
  8317. l) "x >= Ry" is false if and only if "Rx < Ry" is true.
  8318. m) "x <comp op> Ry" is unknown if and only if "Rx <comp op> Ry"
  8319. is neither true nor false.
  8320. Leveling Rules
  8321. 1) The following restrictions apply for Intermediate SQL:
  8322. None.
  8323. 2) The following restrictions apply for Entry SQL in addition to
  8324. any Intermediate SQL restrictions:
  8325. None.
  8326. 210 Database Language SQL
  8327. X3H2-92-154/DBL CBR-002
  8328. 8.3 <between predicate>
  8329. 8.3 <between predicate>
  8330. Function
  8331. Specify a range comparison.
  8332. Format
  8333. <between predicate> ::=
  8334. <row value constructor> [ NOT ] BETWEEN
  8335. <row value constructor> AND <row value constructor>
  8336. Syntax Rules
  8337. 1) The three <row value constructor>s shall be of the same degree.
  8338. 2) Let respective values be values with the same ordinal position
  8339. in the two <row value constructor>s.
  8340. 3) The data types of the respective values of the three <row value
  8341. constructor>s shall be comparable.
  8342. 4) Let X, Y, and Z be the first, second, and third <row value con-
  8343. structor>s, respectively.
  8344. 5) "X NOT BETWEEN Y AND Z" is equivalent to "NOT ( X BETWEEN Y AND
  8345. Z )".
  8346. 6) "X BETWEEN Y AND Z" is equivalent to "X>=Y AND X<=Z".
  8347. Access Rules
  8348. None.
  8349. General Rules
  8350. None.
  8351. Leveling Rules
  8352. 1) The following restrictions apply for Intermediate SQL:
  8353. None.
  8354. 2) The following restrictions apply for Entry SQL in addition to
  8355. any Intermediate SQL restrictions:
  8356. None.
  8357. Predicates 211
  8358. X3H2-92-154/DBL CBR-002
  8359. 8.4 <in predicate>
  8360. 8.4 <in predicate>
  8361. Function
  8362. Specify a quantified comparison.
  8363. Format
  8364. <in predicate> ::=
  8365. <row value constructor>
  8366. [ NOT ] IN <in predicate value>
  8367. <in predicate value> ::=
  8368. <table subquery>
  8369. | <left paren> <in value list> <right paren>
  8370. <in value list> ::=
  8371. <value expression> { <comma> <value expression> }...
  8372. Syntax Rules
  8373. 1) Let IVL be an <in value list>.
  8374. ( IVL )
  8375. is equivalent to the <table value constructor>:
  8376. ( VALUES IVL )
  8377. 2) Let RVC be the <row value constructor> and let IPV be the <in
  8378. predicate value>.
  8379. 3) The expression
  8380. RVC NOT IN IPV
  8381. is equivalent to
  8382. NOT ( RVC IN IPV )
  8383. 4) The expression
  8384. RVC IN IPV
  8385. is equivalent to
  8386. RVC = ANY IPV
  8387. Access Rules
  8388. None.
  8389. General Rules
  8390. None.
  8391. 212 Database Language SQL
  8392. X3H2-92-154/DBL CBR-002
  8393. 8.4 <in predicate>
  8394. Leveling Rules
  8395. 1) The following restrictions apply for Intermediate SQL:
  8396. a) Conforming Intermediate SQL language shall not contain a
  8397. <value expression> in an <in value list> that is not a <value
  8398. specification>.
  8399. 2) The following restrictions apply for Entry SQL in addition to
  8400. any Intermediate SQL restrictions:
  8401. None.
  8402. Predicates 213
  8403. X3H2-92-154/DBL CBR-002
  8404. 8.5 <like predicate>
  8405. 8.5 <like predicate>
  8406. Function
  8407. Specify a pattern-match comparison.
  8408. Format
  8409. <like predicate> ::=
  8410. <match value> [ NOT ] LIKE <pattern>
  8411. [ ESCAPE <escape character> ]
  8412. <match value> ::= <character value expression>
  8413. <pattern> ::= <character value expression>
  8414. <escape character> ::= <character value expression>
  8415. Syntax Rules
  8416. 1) The data types of <match value>, <pattern>, and <escape char-
  8417. acter> shall be character string. <match value>, <pattern>, and
  8418. <escape character> shall be comparable.
  8419. 2) Let M be the result of the <character value expression> of the
  8420. <match value>, let P be the result of the <character value
  8421. expression> of the <pattern>, and let E be the result of the
  8422. <character value expression> of the <escape character> if one is
  8423. specified.
  8424. 3) "M NOT LIKE P" is equivalent to "NOT (M LIKE P)".
  8425. 4) Case:
  8426. a) If <escape character> is not specified, then the collat-
  8427. ing sequence used for the <like predicate> is determined by
  8428. Table 3, "Collating sequence usage for comparisons", taking
  8429. <match value> as comparand 1 and <pattern> as comparand 2.
  8430. b) Otherwise, let C1 be the coercibility attribute and collat-
  8431. ing sequence of the <match value>, and C2 be the coercibility
  8432. attribute and collating sequence of the <pattern>. Let C3 be
  8433. the resulting coercibility attribute and collating sequence
  8434. as determined by Table 2, "Collating coercibility rules for
  8435. dyadic operators", taking C1 as the operand 1 coercibility
  8436. and C2 as the operand 2 coercibility. The collating sequence
  8437. used for the <like predicate> is determined by Table 3,
  8438. "Collating sequence usage for comparisons", taking C3 as the
  8439. coercibility attribute and collating sequence of comparand 1
  8440. and <escape character> as comparand 2.
  8441. 214 Database Language SQL
  8442. X3H2-92-154/DBL CBR-002
  8443. 8.5 <like predicate>
  8444. Access Rules
  8445. None.
  8446. General Rules
  8447. 1) If an <escape character> is specified and M, P, or E is the null
  8448. value, then
  8449. M LIKE P ESCAPE E
  8450. is unknown.
  8451. 2) If an <escape character> is not specified and M or P is the null
  8452. value, then
  8453. M LIKE P
  8454. is unknown.
  8455. 3) Case:
  8456. a) If an <escape character> is specified, then:
  8457. i) If the length in characters of E is not equal to 1, then
  8458. an exception condition is raised: data exception-invalid
  8459. escape character.
  8460. ii) If there is not a partitioning of the string P into sub-
  8461. strings such that each substring has length 1 or 2, no
  8462. substring of length 1 is the escape character E, and each
  8463. substring of length 2 is the escape character E followed by
  8464. either the escape character E, an <underscore> character,
  8465. or the <percent> character, then an exception condition is
  8466. raised: data exception-invalid escape sequence.
  8467. If there is such a partitioning of P, then in that parti-
  8468. tioning, each substring with length 2 represents a single
  8469. occurrence of the second character of that substring. Each
  8470. substring with length 1 that is the <underscore> character
  8471. represents an arbitrary character specifier. Each substring
  8472. with length 1 that is the <percent> character represents
  8473. an arbitrary string specifier. Each substring with length
  8474. 1 that is neither the <underscore> character nor the <per-
  8475. cent> character represents the character that it contains.
  8476. b) If an <escape character> is not specified, then each <under-
  8477. score> character in P represents an arbitrary character spec-
  8478. ifier, each <percent> character in P represents an arbitrary
  8479. string specifier, and each character in P that is neither the
  8480. <underscore> character nor the <percent> character represents
  8481. itself.
  8482. Predicates 215
  8483. X3H2-92-154/DBL CBR-002
  8484. 8.5 <like predicate>
  8485. 4) The string P is a sequence of the minimum number of substring
  8486. specifiers such that each <character representation> of P is
  8487. part of exactly one substring specifier. A substring specifier
  8488. is an arbitrary character specifier, an arbitrary string spec-
  8489. ifier, or any sequence of <character representation>s other
  8490. than an arbitrary character specifier or an arbitrary string
  8491. specifier.
  8492. 5) Case:
  8493. a) If M and P are character strings whose lengths are variable
  8494. and if the lengths of both M and P are 0, then
  8495. M LIKE P
  8496. is true.
  8497. b) The <predicate>
  8498. M LIKE P
  8499. is true if there exists a partitioning of M into substrings
  8500. such that:
  8501. i) A substring of M is a sequence of 0 or more contiguous
  8502. <character representation>s of M and each <character repre-
  8503. sentation> of M is part of exactly one substring.
  8504. ii) If the i-th substring specifier of P is an arbitrary char-
  8505. acter specifier, the i-th substring of M is any single
  8506. <character representation>.
  8507. iii) If the i-th substring specifier of P is an arbitrary string
  8508. specifier, then the i-th substring of M is any sequence of
  8509. 0 or more <character representation>s.
  8510. iv) If the i-th substring specifier of P is neither an arbi-
  8511. trary character specifier nor an arbitrary string speci-
  8512. fier, then the i-th substring of M is equal to that sub-
  8513. string specifier according to the collating sequence of
  8514. the <like predicate>, without the appending of <space>
  8515. characters to M, and has the same length as that substring
  8516. specifier.
  8517. v) The number of substrings of M is equal to the number of
  8518. substring specifiers of P.
  8519. c) Otherwise,
  8520. M LIKE P
  8521. is false.
  8522. 216 Database Language SQL
  8523. X3H2-92-154/DBL CBR-002
  8524. 8.5 <like predicate>
  8525. Leveling Rules
  8526. 1) The following restrictions apply for Intermediate SQL:
  8527. None.
  8528. 2) The following restrictions apply for Entry SQL in addition to
  8529. any Intermediate SQL restrictions:
  8530. a) The <match value> shall be a <column reference>.
  8531. b) A <pattern> shall be a <value specification>.
  8532. c) An <escape character> shall be a <value specification>.
  8533. Predicates 217
  8534. X3H2-92-154/DBL CBR-002
  8535. 8.6 <null predicate>
  8536. 8.6 <null predicate>
  8537. Function
  8538. Specify a test for a null value.
  8539. Format
  8540. <null predicate> ::= <row value constructor> IS [ NOT ] NULL
  8541. Syntax Rules
  8542. None.
  8543. Access Rules
  8544. None.
  8545. General Rules
  8546. 1) Let R be the value of the <row value constructor>.
  8547. 2) If all the values in R are the null value, then "R IS NULL" is
  8548. true; otherwise, it is false.
  8549. 3) If none of the values in R are the null value, then "R IS NOT
  8550. NULL" is true; otherwise, it is false.
  8551. Note: For all R, "R IS NOT NULL" has the same result as "NOT
  8552. R IS NULL" if and only if R is of degree 1. Table 12, "<null
  8553. predicate> semantics", specifies this behavior.
  8554. ________________Table_12-<null_predicate>_semantics________________
  8555. R IS R IS NOT NOT R IS NOT R IS NOT
  8556. _Expression_______NULL____NULL__________NULL__________NULL_________
  8557. | degree 1: null | true | false | false | true |
  8558. | | | | | |
  8559. | degree 1: not | false | true | true | false |
  8560. null
  8561. | degree > 1: | true | false | false | true |
  8562. | all null | | | | |
  8563. | | | | | |
  8564. | degree > 1: | false | false | true | true |
  8565. | some null | | | | |
  8566. | | | | | |
  8567. | degree > 1: | false | true | true | false |
  8568. |_none_null______|_______|_____________|____________|______________|
  8569. | | | | | |
  8570. |Leveling Rules | | | | |
  8571. | | | | | |
  8572. 218 Database Language SQL
  8573. X3H2-92-154/DBL CBR-002
  8574. 8.6 <null predicate>
  8575. 1) The following restrictions apply for Intermediate SQL:
  8576. None.
  8577. 2) The following restrictions apply for Entry SQL in addition to
  8578. any Intermediate SQL restrictions:
  8579. a) A <row value constructor> shall be a <column reference>.
  8580. Predicates 219
  8581. X3H2-92-154/DBL CBR-002
  8582. 8.7 <quantified comparison predicate>
  8583. 8.7 <quantified comparison predicate>
  8584. Function
  8585. Specify a quantified comparison.
  8586. Format
  8587. <quantified comparison predicate> ::=
  8588. <row value constructor> <comp op> <quantifier> <table subquery>
  8589. <quantifier> ::= <all> | <some>
  8590. <all> ::= ALL
  8591. <some> ::= SOME | ANY
  8592. Syntax Rules
  8593. 1) The <row value constructor> shall be of the same degree as the
  8594. result of the <table subquery>.
  8595. 2) The data types of the values of the <row value constructor>
  8596. shall be respectively comparable to those of the columns of the
  8597. <table subquery>.
  8598. 3) The collating sequence for each pair of respective values in
  8599. the <quantified comparison predicate> is determined in the same
  8600. manner as described in Subclause 8.2, "<comparison predicate>".
  8601. Access Rules
  8602. None.
  8603. General Rules
  8604. 1) Let R be the result of the <row value constructor> and let T be
  8605. the result of the <table subquery>.
  8606. 2) The result of "R <comp op> <quantifier> T" is derived by the
  8607. application of the implied <comparison predicate> "R <comp op>
  8608. RT" to every row RT in T:
  8609. Case:
  8610. a) If T is empty or if the implied <comparison predicate> is
  8611. true for every row RT in T, then "R <comp op> <all> T" is
  8612. true.
  8613. b) If the implied <comparison predicate> is false for at least
  8614. one row RT in T, then "R <comp op> <all> T" is false.
  8615. 220 Database Language SQL
  8616. X3H2-92-154/DBL CBR-002
  8617. 8.7 <quantified comparison predicate>
  8618. c) If the implied <comparison predicate> is true for at least
  8619. one row RT in T, then "R <comp op> <some> T" is true.
  8620. d) If T is empty or if the implied <comparison predicate> is
  8621. false for every row RT in T, then "R <comp op> <some> T" is
  8622. false.
  8623. e) If "R <comp op> <quantifier> T" is neither true nor false,
  8624. then it is unknown.
  8625. Leveling Rules
  8626. 1) The following restrictions apply for Intermediate SQL:
  8627. None.
  8628. 2) The following restrictions apply for Entry SQL in addition to
  8629. any Intermediate SQL restrictions:
  8630. None.
  8631. Predicates 221
  8632. X3H2-92-154/DBL CBR-002
  8633. 8.8 <exists predicate>
  8634. 8.8 <exists predicate>
  8635. Function
  8636. Specify a test for a non-empty set.
  8637. Format
  8638. <exists predicate> ::= EXISTS <table subquery>
  8639. Syntax Rules
  8640. None.
  8641. Access Rules
  8642. None.
  8643. General Rules
  8644. 1) Let T be the result of the <table subquery>.
  8645. 2) If the cardinality of T is greater than 0, then the result of
  8646. the <exists predicate> is true; otherwise, the result of the
  8647. <exists predicate> is false.
  8648. Leveling Rules
  8649. 1) The following restrictions apply for Intermediate SQL:
  8650. None.
  8651. 2) The following restrictions apply for Entry SQL in addition to
  8652. any Intermediate SQL restrictions:
  8653. None.
  8654. 222 Database Language SQL
  8655. X3H2-92-154/DBL CBR-002
  8656. 8.9 <unique predicate>
  8657. 8.9 <unique predicate>
  8658. Function
  8659. Specify a test for the absence of duplicate rows.
  8660. Format
  8661. <unique predicate> ::= UNIQUE <table subquery>
  8662. Syntax Rules
  8663. None.
  8664. Access Rules
  8665. None.
  8666. General Rules
  8667. 1) Let T be the result of the <table subquery>.
  8668. 2) If there are no two rows in T such that the value of each column
  8669. in one row is non-null and is equal to the value of the cor-
  8670. responding column in the other row according to Subclause 8.2,
  8671. "<comparison predicate>", then the result of the <unique predi-
  8672. cate> is true; otherwise, the result of the <unique predicate>
  8673. is false.
  8674. Leveling Rules
  8675. 1) The following restrictions apply for Intermediate SQL:
  8676. None.
  8677. 2) The following restrictions apply for Entry SQL in addition to
  8678. any Intermediate SQL restrictions:
  8679. a) Conforming Entry SQL language shall not contain any <unique
  8680. predicate>.
  8681. Predicates 223
  8682. X3H2-92-154/DBL CBR-002
  8683. 8.10 <match predicate>
  8684. 8.10 <match predicate>
  8685. Function
  8686. Specify a test for matching rows.
  8687. Format
  8688. <match predicate> ::=
  8689. <row value constructor> MATCH [ UNIQUE ] [ PARTIAL | FULL ] <table subquery>
  8690. Syntax Rules
  8691. 1) The <row value constructor> shall be of the same degree as the
  8692. <table subquery>.
  8693. 2) The data types of the values of the <row value constructor>
  8694. shall be respectively comparable to those of the corresponding
  8695. columns of the <table subquery>.
  8696. 3) The collating sequence for each pair of respective values in the
  8697. <match predicate> is determined in the same manner as described
  8698. in Subclause 8.2, "<comparison predicate>".
  8699. Access Rules
  8700. None.
  8701. General Rules
  8702. 1) Let R be the <row value constructor>.
  8703. 2) If neither PARTIAL nor FULL is specified, then
  8704. Case:
  8705. a) If some value in R is the null value, then the <match predi-
  8706. cate> is true.
  8707. b) If no value in R is the null value, then
  8708. Case:
  8709. i) If UNIQUE is not specified and there exists a (possibly
  8710. non-unique) row RTi of the <table subquery> such that
  8711. R = RTi
  8712. then the <match predicate> is true.
  8713. ii) If UNIQUE is specified and there is a unique row RTi of the
  8714. <table subquery> such that
  8715. R = RTi
  8716. 224 Database Language SQL
  8717. X3H2-92-154/DBL CBR-002
  8718. 8.10 <match predicate>
  8719. then the <match predicate> is true.
  8720. iii) Otherwise, the <match predicate> is false.
  8721. 3) If PARTIAL is specified, then
  8722. Case:
  8723. a) If all values in R are the null value, then the <match predi-
  8724. cate> is true.
  8725. b) Otherwise,
  8726. Case:
  8727. i) If UNIQUE is not specified and there exists a (possibly
  8728. non-unique) row RTi of the <table subquery> such that each
  8729. non-null value of R equals its corresponding value in RTi,
  8730. then the <match predicate> is true.
  8731. ii) If UNIQUE is specified and there is a unique row RTi of the
  8732. <table subquery> such that each non-null value of R equals
  8733. its corresponding value in RTi, then the <match predicate>
  8734. is true.
  8735. iii) Otherwise, the <match predicate> is false.
  8736. 4) If FULL is specified, then
  8737. Case:
  8738. a) If all values in R are the null value, then the <match predi-
  8739. cate> is true.
  8740. b) If no values in R are the null value, then
  8741. Case:
  8742. i) If UNIQUE is not specified and there exists a (possibly
  8743. non-unique) row RTi of the <table subquery> such that
  8744. R = RTi
  8745. then the <match predicate> is true.
  8746. ii) If UNIQUE is specified and there exists a unique row RTi of
  8747. the <table subquery> such that
  8748. R = RTi
  8749. then the <match predicate> is true.
  8750. iii) Otherwise, the <match predicate> is false.
  8751. c) Otherwise, the <match predicate> is false.
  8752. Predicates 225
  8753. X3H2-92-154/DBL CBR-002
  8754. 8.10 <match predicate>
  8755. Leveling Rules
  8756. 1) The following restrictions apply for Intermediate SQL:
  8757. a) Conforming Intermediate SQL language shall not contain any
  8758. <match predicate>.
  8759. 2) The following restrictions apply for Entry SQL in addition to
  8760. any Intermediate SQL restrictions:
  8761. None.
  8762. 226 Database Language SQL
  8763. X3H2-92-154/DBL CBR-002
  8764. 8.11 <overlaps predicate>
  8765. 8.11 <overlaps predicate>
  8766. Function
  8767. Specify a test for an overlap between two events.
  8768. Format
  8769. <overlaps predicate> ::=
  8770. <row value constructor 1> OVERLAPS <row value constructor 2>
  8771. <row value constructor 1> ::= <row value constructor>
  8772. <row value constructor 2> ::= <row value constructor>
  8773. Syntax Rules
  8774. 1) The degree of <row value constructor 1> and <row value construc-
  8775. tor 2> shall both be 2.
  8776. 2) The data type of the first column of each <row value construc-
  8777. tor> shall be a datetime data type and the first column of each
  8778. <row value constructor> shall be comparable.
  8779. Note: Two datetimes are comparable only if they have the same
  8780. <datetime field>s; see Subclause 4.5.1, "Datetimes".
  8781. 3) The data type of the second column of each <row value construc-
  8782. tor> shall be a datetime data type or INTERVAL.
  8783. Case:
  8784. a) If the data type is INTERVAL, then the precision of the data
  8785. type shall be such that the interval can be added to the
  8786. datetime data type contained in the first column of the <row
  8787. value constructor>.
  8788. b) If the data type is a datetime data type, then it shall be
  8789. comparable with the datetime data type contained in the first
  8790. column of the <row value constructor>.
  8791. Access Rules
  8792. None.
  8793. General Rules
  8794. 1) Let D1 be the value of the first column of <row value construc-
  8795. tor 1> and D2 be the value of the first column of <row value
  8796. constructor 2>.
  8797. Predicates 227
  8798. X3H2-92-154/DBL CBR-002
  8799. 8.11 <overlaps predicate>
  8800. 2) Case:
  8801. a) If the data type of the second column of <row value construc-
  8802. tor 1> is a datetime data type, then let E1 be the value of
  8803. the second column of <row value constructor 1>.
  8804. b) If the data type of the second column of <row value construc-
  8805. tor 1> is INTERVAL, then let I1 be the value of the second
  8806. column of <row value constructor 1>. Let E1 = D1 + I1.
  8807. 3) If D1 is the null value or if E1 < D1, then let S1 = E1 and let
  8808. T1 = D1. Otherwise, let S1 = D1 and let T1 = E1.
  8809. 4) Case:
  8810. a) If the data type of the second column of <row value construc-
  8811. tor 2> is a datetime data type, then let E2 be the value of
  8812. the second column of <row value constructor 2>.
  8813. b) If the data type of the second column of <row value construc-
  8814. tor 2> is INTERVAL, then let I2 be the value of the second
  8815. column of <row value constructor 2>. Let E2 = D2 + I2.
  8816. 5) If D2 is the null value or if E2 < D2, then let S2 = E2 and let
  8817. T2 = D2. Otherwise, let S2 = D2 and let T2 = E2.
  8818. 6) The result of the <overlaps predicate> is the result of the
  8819. following expression:
  8820. ( S1 > S2 AND NOT ( S1 >= T2 AND T1 >= T2 ) )
  8821. OR
  8822. ( S2 > S1 AND NOT ( S2 >= T1 AND T2 >= T1 ) )
  8823. OR
  8824. ( S1 = S2 AND ( T1 <> T2 OR T1 = T2 ) )
  8825. Leveling Rules
  8826. 1) The following restrictions apply for Intermediate SQL:
  8827. None.
  8828. 2) The following restrictions apply for Entry SQL in addition to
  8829. any Intermediate SQL restrictions:
  8830. a) Conforming Entry SQL language shall not contain any <overlaps
  8831. predicate>.
  8832. 228 Database Language SQL
  8833. X3H2-92-154/DBL CBR-002
  8834. 8.12 <search condition>
  8835. 8.12 <search condition>
  8836. Function
  8837. Specify a condition that has the truth value true, false, or
  8838. unknown, depending on the result of applying boolean operators
  8839. to specified conditions.
  8840. Format
  8841. <search condition> ::=
  8842. <boolean term>
  8843. | <search condition> OR <boolean term>
  8844. <boolean term> ::=
  8845. <boolean factor>
  8846. | <boolean term> AND <boolean factor>
  8847. <boolean factor> ::=
  8848. [ NOT ] <boolean test>
  8849. <boolean test> ::=
  8850. <boolean primary> [ IS [ NOT ] <truth value> ]
  8851. <truth value> ::=
  8852. TRUE
  8853. | FALSE
  8854. | UNKNOWN
  8855. <boolean primary> ::=
  8856. <predicate>
  8857. | <left paren> <search condition> <right paren>
  8858. Syntax Rules
  8859. 1) If NOT is specified in a <boolean test>, then let BP be the
  8860. contained <boolean primary> and let TV be the contained <truth
  8861. value>. The <boolean test> is equivalent to:
  8862. ( NOT ( BP IS TV ) )
  8863. Access Rules
  8864. None.
  8865. General Rules
  8866. 1) The result is derived by the application of the specified
  8867. boolean operators ("AND", "OR", "IS", and "NOT") to the results
  8868. derived from each <predicate> evaluation. If boolean operators
  8869. are not specified, then the result of the <search condition> is
  8870. the result of the specified <predicate>.
  8871. Predicates 229
  8872. X3H2-92-154/DBL CBR-002
  8873. 8.12 <search condition>
  8874. 2) NOT(true) is false, NOT(false) is true, and NOT(unknown) is
  8875. unknown. Table 13, "Truth table for the AND boolean", Table 14,
  8876. "Truth table for the OR boolean", and Table 15, "Truth table
  8877. for the IS boolean" specify the semantics of AND, OR, and IS,
  8878. respectively.
  8879. ______________Table_13-Truth_table_for_the_AND_boolean_____________
  8880. ___________________________________________________________________
  8881. | true | true | false | unknown |
  8882. | | | | |
  8883. | false | false | false | false |
  8884. | | | | |
  8885. |__________|_________|__________|__________________________________|
  8886. | | | | |
  8887. ______________Table_14-Truth_table_for_the_OR_boolean______________
  8888. ___________________________________________________________________
  8889. | true | true | true | true |
  8890. | | | | |
  8891. | false | true | false | unknown |
  8892. | | | | |
  8893. |__________|_________|__________|__________________________________|
  8894. | | | | |
  8895. ______________Table_15-Truth_table_for_the_IS_boolean______________
  8896. _IS_________TRUE______FALSE______UNKNOWN___________________________
  8897. | true | true | false | false |
  8898. | | | | |
  8899. | false | false | true | false |
  8900. | | | | |
  8901. |__________|_________|__________|__________________________________|
  8902. | | | | |
  8903. 3) When a <search condition> S is evaluated against a row of a
  8904. table, each reference to a column of that table by a <column
  8905. reference> directly contained in S is a reference to the value
  8906. of that column in that row.
  8907. Leveling Rules
  8908. 1) The following restrictions apply for Intermediate SQL:
  8909. a) A <boolean test> shall not specify a <truth value>.
  8910. 2) The following restrictions apply for Entry SQL in addition to
  8911. any Intermediate SQL restrictions:
  8912. None.
  8913. 230 Database Language SQL
  8914. X3H2-92-154/DBL CBR-002
  8915. 9 Data assignment rules
  8916. 9.1 Retrieval assignment
  8917. Function
  8918. Specify rules for value assignments that retrieve SQL-data.
  8919. Syntax Rules
  8920. 1) Let T and V be a TARGET and VALUE specified in an application of
  8921. this Subclause.
  8922. 2) If the data type of T is character string, bit string, numeric,
  8923. datetime, or interval, then the data type of V shall be a mu-
  8924. tually assignable character string type, a bit string type, a
  8925. numeric type, the same datetime type, or a comparable interval
  8926. type, respectively.
  8927. General Rules
  8928. 1) If V is the null value, then
  8929. Case:
  8930. a) If an indicator is specified for T, then that indicator is
  8931. set to -1.
  8932. b) If no indicator is specified for T, then an exception con-
  8933. dition is raised: data exception-null value, no indicator
  8934. parameter.
  8935. 2) If V is not the null value and T has an indicator, then
  8936. Case:
  8937. a) If the data type of T is character string or bit string and
  8938. the length in characters or bits, respectively, M of V is
  8939. greater than the length in characters or bits, respectively,
  8940. of T, then the indicator is set to M. If M exceeds the maxi-
  8941. mum value that the indicator can contain, then an exception
  8942. condition is raised: data exception-indicator overflow.
  8943. b) Otherwise, the indicator is set to 0.
  8944. 3) If V is not the null value, then
  8945. Case:
  8946. a) If the data type of T is fixed-length character string with
  8947. length in characters L and the length in characters of V is
  8948. equal to L, then the value of T is set to V.
  8949. Data assignment rules 231
  8950. X3H2-92-154/DBL CBR-002
  8951. 9.1 Retrieval assignment
  8952. b) If the data type of T is fixed-length character string with
  8953. length in characters L, and the length in characters of V
  8954. is greater than L, then the value of T is set to the first
  8955. L characters of V and a completion condition is raised:
  8956. warning-string data, right truncation.
  8957. c) If the data type of T is fixed-length character string with
  8958. length in characters L, and the length in characters M of V
  8959. is smaller than L, then the first M characters of T are set
  8960. to V, and the last L-M characters of T are set to <space>s.
  8961. d) If the data type of T is variable-length character string
  8962. and the length in characters M of V is not greater than the
  8963. maximum length in characters of T, then the value of T is set
  8964. to V and the length in characters of T is set to M.
  8965. e) If the data type of T is variable-length character string
  8966. and the length in characters of V is greater than the maximum
  8967. length in characters L of T, then the value of T is set to
  8968. the first L characters of V, the length in characters of T
  8969. becomes L, and a completion condition is raised: warning-
  8970. string data, right truncation.
  8971. f) If the data type of T is fixed-length bit string with length
  8972. in bits L and the length in bits of V is equal to L, then the
  8973. value of T is set to V.
  8974. g) If the data type of T is fixed-length bit string with length
  8975. in bits L and the length in bits of V is greater than L,
  8976. then the value of T is set to the first L bits of V and a
  8977. completion condition is raised: warning-string data, right
  8978. truncation.
  8979. h) If the data type of T is fixed-length bit string with length
  8980. in bits L and the length in bits M of V is smaller than L,
  8981. then the first M bits of T are set to V, the remaining bits
  8982. of T are set to bits each with the value of 0, and a comple-
  8983. tion condition is raised: warning-implicit zero-bit padding.
  8984. i) If the data type of T is variable-length bit string and the
  8985. length in bits M of V is not greater than the maximum length
  8986. in bits of T, then the value of T is set to V and the length
  8987. in bits of T is set to M.
  8988. j) If the data type of T is variable-length bit string, and the
  8989. length in bits of V is greater than the maximum length in
  8990. bits L of T, then the value of T is set to the first L bits
  8991. of V, the length in bits of T is set to L, and a completion
  8992. condition is raised: warning-string data, right truncation.
  8993. 232 Database Language SQL
  8994. X3H2-92-154/DBL CBR-002
  8995. 9.1 Retrieval assignment
  8996. k) If the data type of T is numeric and there is an approxi-
  8997. mation obtained by rounding or truncation of the numerical
  8998. value of V for the data type of T, then the value of T is set
  8999. to such an approximation.
  9000. If there is no such approximation, then an exception condi-
  9001. tion is raised: data exception-numeric value out of range.
  9002. If the data type of T is exact numeric, then it is implementation-
  9003. defined whether the approximation is obtained by rounding or
  9004. by truncation.
  9005. l) If the data type of T is datetime and there is a representa-
  9006. tion of the value of V in the data type of T, then the value
  9007. of T is set to that representation.
  9008. m) If the data type of T is interval and there is a representa-
  9009. tion of the value of V in the data type of T, then the value
  9010. of T is set to that representation. Otherwise, an exception
  9011. condition is raised: data exception-interval field overflow.
  9012. Data assignment rules 233
  9013. X3H2-92-154/DBL CBR-002
  9014. 9.2 Store assignment
  9015. 9.2 Store assignment
  9016. Function
  9017. Specify rules for value assignments that store SQL-data.
  9018. Syntax Rules
  9019. 1) Let T and V be a TARGET and VALUE specified in an application of
  9020. this Subclause.
  9021. 2) If the data type of T is character string, bit string, numeric,
  9022. datetime, or interval, then the data type of V shall be char-
  9023. acter string, bit string, numeric, the same datetime type, or a
  9024. comparable interval type, respectively.
  9025. General Rules
  9026. 1) Let T be an object column.
  9027. 2) If the value of V is the null value, then the value of T is set
  9028. to the null value.
  9029. 3) Otherwise, let V denote a non-null value of T.
  9030. Case:
  9031. a) If the data type of T is fixed-length character string with
  9032. length in characters L and the length in characters of V is
  9033. equal to L, then the value of T is set to V.
  9034. b) If the data type of T is fixed-length character string with
  9035. length in characters L and the length in characters M of V is
  9036. larger than L, then
  9037. Case:
  9038. i) If the rightmost M-L characters of V are all <space>s, then
  9039. the value of T is set to the first L characters of V.
  9040. ii) If one or more of the rightmost M-L characters of V are
  9041. not <space>s, then an exception condition is raised: data
  9042. exception-string data, right truncation.
  9043. c) If the data type of T is fixed-length character string with
  9044. length in characters L and the length in characters M of V
  9045. is less than L, then the first M characters of T are set to V
  9046. and the last L-M characters of T are set to <space>s.
  9047. d) If the data type of T is variable-length character string
  9048. and the length in characters M of V is not greater than the
  9049. maximum length in characters of T, then the value of T is set
  9050. to V and the length in characters of T is set to M.
  9051. e) If the data type of T is variable-length character string and
  9052. the length in characters M of V is greater than the maximum
  9053. length in characters L of T, then,
  9054. 234 Database Language SQL
  9055. X3H2-92-154/DBL CBR-002
  9056. 9.2 Store assignment
  9057. Case:
  9058. i) If the rightmost M-L characters of V are all <space>s, then
  9059. the value of T is set to the first L characters of V and
  9060. the length in characters of T is set to L.
  9061. ii) If one or more of the rightmost M-L characters of V are
  9062. not <space>s, then an exception condition is raised: data
  9063. exception-string data, right truncation.
  9064. f) If the data type of T is fixed-length bit string with length
  9065. in bits L and the length in bits of V is equal to L, then the
  9066. value of T is set to V.
  9067. g) If the data type of T is fixed-length bit string with length
  9068. in bits L and the length in bits M of V is greater than L,
  9069. then an exception condition is raised: data exception-string
  9070. data, right truncation.
  9071. h) If the data type of T is fixed-length bit string with length
  9072. in bits L and the length in bits M of V is less than L, then
  9073. an exception condition is raised: data exception-string data,
  9074. length mismatch.
  9075. i) If the data type of T is variable-length bit string and the
  9076. length in bits M of V is not greater than the maximum length
  9077. in bits of T, then the value of T is set to V and the length
  9078. in bits of T is set to M.
  9079. j) If the data type of T is variable-length bit string, and
  9080. the length in bits M of V is greater than the maximum length
  9081. in bits L of T, then an exception condition is raised: data
  9082. exception-string data, right truncation.
  9083. k) If the data type of T is numeric and there is an approxi-
  9084. mation obtained by rounding or truncation of the numerical
  9085. value of V for the data type of T, then the value of T is set
  9086. to such an approximation.
  9087. If there is no such approximation, then an exception condi-
  9088. tion is raised: data exception-numeric value out of range.
  9089. If the data type of T is exact numeric, then it is implementation-
  9090. defined whether the approximation is obtained by rounding or
  9091. by truncation.
  9092. l) If the data type of T is datetime and there is a representa-
  9093. tion of the value of V in the data type of T, then the value
  9094. of T is set to that representation.
  9095. m) If the data type of T is interval and there is a representa-
  9096. tion of the value of V in the data type of T, then the value
  9097. of T is set to that representation. Otherwise, an exception
  9098. condition is raised: data exception-interval field overflow.
  9099. Data assignment rules 235
  9100. X3H2-92-154/DBL CBR-002
  9101. 9.2 Store assignment
  9102. 4) If the column definition of T includes the name of a domain
  9103. whose domain descriptor includes a domain constraint D, then D
  9104. is effectively checked. If D is not satisfied, then an exception
  9105. condition is raised: integrity constraint violation.
  9106. 236 Database Language SQL
  9107. X3H2-92-154/DBL CBR-002
  9108. 9.3 Set operation result data types
  9109. 9.3 Set operation result data types
  9110. Function
  9111. Specify the Syntax Rules and result data types for <case expres-
  9112. sion>s and <query expression>s having set operators.
  9113. Syntax Rules
  9114. 1) Let DTS be a set of data types specified in an application of
  9115. this Subclause.
  9116. 2) All of the data types in DTS shall be comparable.
  9117. 3) Case:
  9118. a) If any of the data types in DTS is character string, then
  9119. all data types in DTS shall be character string, and all of
  9120. them shall have the same character repertoire. That charac-
  9121. ter repertoire is the character repertoire of the result. The
  9122. character set of the result is the character set of one of
  9123. the data types in DTS. The specific character set chosen is
  9124. implementation-dependent. The collating sequence and the co-
  9125. ercibility attribute are determined as specified in Table 2,
  9126. "Collating coercibility rules for dyadic operators".
  9127. Case:
  9128. i) If any of the data types in DTS is variable-length char-
  9129. acter string, then the result data type is variable-length
  9130. character string with maximum length in characters equal
  9131. to the maximum of the lengths in characters and maximum
  9132. lengths in characters of the data types in DTS.
  9133. ii) Otherwise, the result data type is fixed-length character
  9134. string with length in characters equal to the maximum of
  9135. the lengths in characters of the data types in DTS.
  9136. b) If any of the data types in DTS is bit string, then all data
  9137. types in DTS shall be bit string.
  9138. Case:
  9139. i) If any of the data types in DTS is variable-length bit
  9140. string, then the result data type is variable-length bit
  9141. string with maximum length in bits equal to the maximum of
  9142. the lengths in bits and maximum lengths in bits of the data
  9143. types in DTS.
  9144. ii) Otherwise, the result data type is fixed-length bit string
  9145. with length in bits equal to the maximum of the lengths in
  9146. bits of the data types in DTS.
  9147. Data assignment rules 237
  9148. X3H2-92-154/DBL CBR-002
  9149. 9.3 Set operation result data types
  9150. c) If all of the data types in DTS are exact numeric, then the
  9151. result data type is exact numeric with implementation-defined
  9152. precision and with scale equal to the maximum of the scales
  9153. of the data types in DTS.
  9154. d) If any data type in DTS is approximate numeric, then each
  9155. data type in DTS shall be numeric and the result data type is
  9156. approximate numeric with implementation-defined precision.
  9157. e) If any data type in DTS is a datetime data type, then each
  9158. data type in DTS shall be the same datetime data type. The
  9159. result data type is the same datetime data type.
  9160. f) If any data type in DTS is interval, then each data type
  9161. in DTS shall be interval. If the precision of any data type
  9162. in DTS specifies YEAR or MONTH, then the precision of each
  9163. data type shall specify only YEAR or MONTH. If the preci-
  9164. sion of any data type in DTS specifies DAY, HOUR, MINUTE, or
  9165. SECOND(N), then the precision of no data type of DTS shall
  9166. specify the <datetime field>s YEAR and MONTH. The result
  9167. data type is interval with precision "S TO E", where S and E
  9168. are the most significant of the <start field>s and the least
  9169. significant of the <end field>s of the data types in DTS,
  9170. respectively.
  9171. General Rules
  9172. None.
  9173. 238 Database Language SQL
  9174. X3H2-92-154/DBL CBR-002
  9175. 10 Additional common elements
  9176. 10.1 <interval qualifier>
  9177. Function
  9178. Specify the precision of an interval data type.
  9179. Format
  9180. <interval qualifier> ::=
  9181. <start field> TO <end field>
  9182. | <single datetime field>
  9183. <start field> ::=
  9184. <non-second datetime field>
  9185. [ <left paren> <interval leading field precision> <right paren> ]
  9186. <end field> ::=
  9187. <non-second datetime field>
  9188. | SECOND [ <left paren> <interval fractional seconds precision> <right paren> ]
  9189. <single datetime field> ::=
  9190. <non-second datetime field>
  9191. [ <left paren> <interval leading field precision> <right paren> ]
  9192. | SECOND [ <left paren> <interval leading field precision>
  9193. [ <comma> <interval fractional seconds precision> ] <right paren> ]
  9194. <datetime field> ::=
  9195. <non-second datetime field>
  9196. | SECOND
  9197. <non-second datetime field> ::= YEAR | MONTH | DAY | HOUR | MINUTE
  9198. <interval fractional seconds precision> ::= <unsigned integer>
  9199. <interval leading field precision> ::= <unsigned integer>
  9200. Additional common elements 239
  9201. X3H2-92-154/DBL CBR-002
  9202. 10.1 <interval qualifier>
  9203. Syntax rules
  9204. 1) There is a significance of ordering of <datetime field>s. In
  9205. order from most significant to least significant, the ordering
  9206. is: YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. A <start field>
  9207. or <single datetime field> with an <interval leading field pre-
  9208. cision> i is more significant than a <start field> or <single
  9209. datetime field> with an <interval leading field precision> j if
  9210. i>j. An <end field> or <single datetime field> with an <interval
  9211. fractional seconds precision> i is more significant than an <end
  9212. field> or <single datetime field> with an <interval fractional
  9213. seconds precision> j if i>j.
  9214. 2) If TO is specified, then:
  9215. a) <start field> shall be more significant than <end field>,
  9216. b) <start field> shall not specify MONTH, and
  9217. c) if <start field> specified YEAR, then <end field> shall spec-
  9218. ify MONTH.
  9219. 3) The maximum value of <interval leading field precision> is
  9220. implementation-defined, but shall not be less than 2.
  9221. 4) The maximum value of <interval fractional seconds precision> is
  9222. implementation-defined, but shall not be less than 6.
  9223. 5) An <interval leading field precision>, if specified, shall be
  9224. greater than 0 and shall not be greater than the implementation-
  9225. defined maximum. If <interval leading field precision> is not
  9226. specified, then an <interval leading field precision> of 2 is
  9227. implicit.
  9228. 6) An <interval fractional seconds precision>, if specified, shall
  9229. be greater than or equal to 0 and shall not be greater than
  9230. the implementation-defined maximum. If SECOND is specified and
  9231. <interval fractional seconds precision> is not specified, then
  9232. an <interval fractional seconds precision> of 6 is implicit.
  9233. Access Rules
  9234. None.
  9235. General Rules
  9236. 1) An item qualified by an <interval qualifier> contains the date-
  9237. time fields identified by the <interval qualifier>.
  9238. Case:
  9239. a) If the <interval qualifier> specifies a <single datetime
  9240. field>, then the <interval qualifier> identifies a single
  9241. <datetime field>. Any reference to the most significant or
  9242. 240 Database Language SQL
  9243. X3H2-92-154/DBL CBR-002
  9244. 10.1 <interval qualifier>
  9245. least significant <datetime field> of the item refers to that
  9246. <datetime field>.
  9247. b) Otherwise, the <interval qualifier> identifies those datetime
  9248. fields from <start field> to <end field>, inclusive.
  9249. 2) An <interval leading field precision> specifies
  9250. Case:
  9251. a) If the <datetime field> is SECOND, then the number of decimal
  9252. digits of precision before the specified or implied decimal
  9253. point of the seconds <datetime field>.
  9254. b) Otherwise, the number of decimal digits of precision of the
  9255. first <datetime field>.
  9256. 3) An <interval fractional seconds precision> specifies the num-
  9257. ber of decimal digits of precision following the specified or
  9258. implied decimal point in the <datetime field> SECOND.
  9259. 4) If <single datetime field> is not specified and <start field>
  9260. and <end field> are the same <datetime field>, then the <inter-
  9261. val qualifier> is equivalent to a <single datetime field> that
  9262. is that <datetime field>.
  9263. 5) The length in positions of an item of type interval is computed
  9264. as follows.
  9265. Case:
  9266. a) If the item is a year-month interval, then
  9267. Case:
  9268. i) If the <interval qualifier> is a <single datetime field>,
  9269. then the length in positions of the item is the implicit or
  9270. explicit <interval leading field precision> of the <single
  9271. datetime field>.
  9272. ii) Otherwise, the length in positions of the item is the im-
  9273. plicit or explicit <interval leading field precision> of
  9274. the <start field> plus 2 (the length of the <non-second
  9275. datetime field> that is the <end field>) plus 1 (the length
  9276. of the <minus sign> between the <years value> and the
  9277. <months value> in a <year-month literal>).
  9278. b) Otherwise,
  9279. Case:
  9280. i) If the <interval qualifier> is a <single datetime field>
  9281. that does not specify SECOND, then the length in positions
  9282. of the item is the implicit or explicit <interval leading
  9283. field precision> of the <single datetime field>.
  9284. Additional common elements 241
  9285. X3H2-92-154/DBL CBR-002
  9286. 10.1 <interval qualifier>
  9287. ii) If the <interval qualifier> is a <single datetime field>
  9288. that specifies SECOND, then the length in positions of the
  9289. item is the implicit or explicit <interval leading field
  9290. precision> of the <single datetime field> plus the implicit
  9291. or explicit <interval fractional seconds precision>. If
  9292. <interval fractional seconds precision> is greater than
  9293. zero, then the length in positions of the item is increased
  9294. by 1 (the length in positions of the <period> between the
  9295. <seconds integer value> and the <seconds fraction>).
  9296. iii) Otherwise, let participating datetime fields mean the date-
  9297. time fields that are less significant than the <start
  9298. field> and more significant than the <end field> of the
  9299. <interval qualifier>. The length in positions of each par-
  9300. ticipating datetime field is 2.
  9301. Case:
  9302. 1) If <end field> is SECOND, then the length in positions
  9303. of the item is the implicit or explicit <interval lead-
  9304. ing field precision>, plus 3 times the number of par-
  9305. ticipating datetime fields (each participating datetime
  9306. field has length 2 positions , plus the <minus sign>s
  9307. or <colon>s that precede them have length 1 position),
  9308. plus the implicit or explicit <interval fractional sec-
  9309. onds precision>, plus 1 (the length in positions of the
  9310. <colon> preceding the <end field>). If <interval frac-
  9311. tional seconds precision> is greater than zero, then the
  9312. length in positions of the item is increased by 1 (the
  9313. length in positions of the <period> within the field
  9314. identified by the <end field>).
  9315. 2) Otherwise, the length in positions of the item is the
  9316. implicit or explicit <interval leading field preci-
  9317. sion>, plus 3 times the number of participating datetime
  9318. fields (each participating datetime field has length 2
  9319. positions, plus the <minus sign>s or <colon>s that pre-
  9320. cede them have length 1 position), plus 2 (the length
  9321. in positions of the <end field>), plus 1 (the length in
  9322. positions of the <colon> preceding the <end field>).
  9323. Leveling Rules
  9324. 1) The following restrictions apply for Intermediate SQL:
  9325. None.
  9326. 2) The following restrictions apply for Entry SQL in addition to
  9327. any Intermediate SQL restrictions:
  9328. a) Conforming Entry SQL language shall not contain any <interval
  9329. qualifier>.
  9330. 242 Database Language SQL
  9331. X3H2-92-154/DBL CBR-002
  9332. 10.2 <language clause>
  9333. 10.2 <language clause>
  9334. Function
  9335. Specify a standard programming language.
  9336. Format
  9337. <language clause> ::=
  9338. LANGUAGE <language name>
  9339. <language name> ::=
  9340. ADA | C | COBOL | FORTRAN | MUMPS | PASCAL | PLI
  9341. Syntax Rules
  9342. None.
  9343. Access Rules
  9344. None.
  9345. General Rules
  9346. 1) The standard programming language specified by the clause is
  9347. defined in the International Standard identified by the <lan-
  9348. guage name> keyword. Table 16, "Standard programming languages",
  9349. specifies the relationship.
  9350. ______________Table_16-Standard_programming_languages______________
  9351. Language
  9352. _keyword______Relevant_standard____________________________________
  9353. | ADA | ISO/IEC 8652 |
  9354. | | |
  9355. | C | ISO/IEC 9899 |
  9356. | | |
  9357. | COBOL | ISO 1989 |
  9358. | | |
  9359. | FORTRAN | ISO/IEC 1539 |
  9360. | | |
  9361. | MUMPS | ISO/IEC 11756 |
  9362. | | |
  9363. | PASCAL | ISO 7185 and ISO/IEC 10206 |
  9364. | | |
  9365. |_PLI________|_ISO_6160____________________________________________|
  9366. | | |
  9367. Leveling Rules
  9368. 1) The following restrictions apply for Intermediate SQL:
  9369. None.
  9370. Additional common elements 243
  9371. X3H2-92-154/DBL CBR-002
  9372. 10.2 <language clause>
  9373. 2) The following restrictions apply for Entry SQL in addition to
  9374. any Intermediate SQL restrictions:
  9375. a) A <language clause> shall not specify MUMPS.
  9376. 244 Database Language SQL
  9377. X3H2-92-154/DBL CBR-002
  9378. 10.3 <privileges>
  9379. 10.3 <privileges>
  9380. Function
  9381. Specify privileges.
  9382. Format
  9383. <privileges> ::=
  9384. ALL PRIVILEGES
  9385. | <action list>
  9386. <action list> ::= <action> [ { <comma> <action> }... ]
  9387. <action> ::=
  9388. SELECT
  9389. | DELETE
  9390. | INSERT [ <left paren> <privilege column list> <right paren> ]
  9391. | UPDATE [ <left paren> <privilege column list> <right paren> ]
  9392. | REFERENCES [ <left paren> <privilege column list> <right paren> ]
  9393. | USAGE
  9394. <privilege column list> ::= <column name list>
  9395. <grantee> ::=
  9396. PUBLIC
  9397. | <authorization identifier>
  9398. Syntax Rules
  9399. 1) If the <object name> of the <grant statement> or <revoke state-
  9400. ment> specifying <privileges> specifies <table name>, then let T
  9401. be the table identified by that <table name>. T shall not be a
  9402. declared local temporary table.
  9403. 2) If T is a temporary table, then <privileges> shall specify ALL
  9404. PRIVILEGES.
  9405. 3) Each <column name> in a <privilege column list> shall identify a
  9406. column of T.
  9407. 4) UPDATE (<privilege column list>) is equivalent to the spec-
  9408. ification of UPDATE (<column name>) for each <column name>
  9409. in <privilege column list>. INSERT (<privilege column list>)
  9410. is equivalent to the specification of INSERT (<column name>)
  9411. for each <column name> in <privilege column list>. REFERENCES
  9412. (<privilege column list>) is equivalent to the specification of
  9413. Additional common elements 245
  9414. X3H2-92-154/DBL CBR-002
  9415. 10.3 <privileges>
  9416. REFERENCES (<column name>) for each <column name> in <privilege
  9417. column list>.
  9418. 5) ALL PRIVILEGES is equivalent to the specification of all of the
  9419. privileges on <object name> for which the current <authorization
  9420. identifier> has grantable privilege descriptors.
  9421. Access Rules
  9422. None.
  9423. General Rules
  9424. 1) A <grantee> of PUBLIC denotes at all times a list of <grantee>s
  9425. containing all of the <authorization identifier>s in the SQL
  9426. environment.
  9427. 2) The set of applicable privileges for an <authorization identi-
  9428. fier> includes those privileges defined by privilege descriptors
  9429. associated with that <authorization identifier>, together with
  9430. those defined by privilege descriptors associated with PUBLIC.
  9431. 3) UPDATE (<column name>) specifies the UPDATE privilege on the in-
  9432. dicated column and implies one or more column privilege descrip-
  9433. tors. If the <privilege column list> is omitted, then UPDATE
  9434. specifies the UPDATE privilege on all columns of T including
  9435. any column subsequently added to T and implies a table privilege
  9436. descriptor and one or more column privilege descriptors.
  9437. 4) INSERT (<column name>) specifies the INSERT privilege on the in-
  9438. dicated column and implies one or more column privilege descrip-
  9439. tors. If the <privilege column list> is omitted, then INSERT
  9440. specifies the INSERT privilege on all columns of T including
  9441. any column subsequently added to T and implies a table privilege
  9442. descriptor and one or more column privilege descriptors.
  9443. 5) REFERENCES (<column name>) specifies the REFERENCES privilege
  9444. on the indicated column and implies one or more column privilege
  9445. descriptors. If the <privilege column list> is omitted, then
  9446. REFERENCES specifies the REFERENCES privilege on all columns
  9447. of T including any column subsequently added to T and implies
  9448. a table privilege descriptor and one or more column privilege
  9449. descriptors.
  9450. Leveling Rules
  9451. 1) The following restrictions apply for Intermediate SQL:
  9452. a) An <action> that specifies INSERT shall not contain a <privi-
  9453. lege column list>.
  9454. 246 Database Language SQL
  9455. X3H2-92-154/DBL CBR-002
  9456. 10.3 <privileges>
  9457. 2) The following restrictions apply for Entry SQL in addition to
  9458. any Intermediate SQL restrictions:
  9459. None.
  9460. Additional common elements 247
  9461. X3H2-92-154/DBL CBR-002
  9462. 10.4 <character set specification>
  9463. 10.4 <character set specification>
  9464. Function
  9465. Identify a character set.
  9466. Format
  9467. <character set specification> ::=
  9468. <standard character repertoire name>
  9469. | <implementation-defined character repertoire name>
  9470. | <user-defined character repertoire name>
  9471. | <standard universal character form-of-use name>
  9472. | <implementation-defined universal character form-of-
  9473. use name>
  9474. <standard character repertoire name> ::= <character set name>
  9475. <implementation-defined character repertoire name> ::= <character set name>
  9476. <user-defined character repertoire name> ::= <character set name>
  9477. <standard universal character form-of-use name> ::=
  9478. <character set name>
  9479. <implementation-defined universal character form-of-use name> ::=
  9480. <character set name>
  9481. Syntax Rules
  9482. 1) The <standard character repertoire name>s, <implementation-
  9483. defined character repertoire name>s, <standard universal char-
  9484. acter form-of-use name>s, and <implementation-defined uni-
  9485. versal character form-of-use name>s that are supported are
  9486. implementation-defined.
  9487. 2) A character set identified by a <standard character repertoire
  9488. name>, by an <implementation-defined character repertoire name>,
  9489. by a <standard universal character form-of-use name>, or by an
  9490. <implementation-defined universal character form-of-use name>
  9491. has associated with it a privilege descriptor that was effec-
  9492. tively defined by the <grant statement>
  9493. GRANT USAGE ON CHARACTER SET CS TO PUBLIC WITH GRANT OPTION
  9494. where CS is the <character set name> contained in the <character
  9495. set specification>. The grantor of the privilege descriptor is
  9496. set to the special grantor value "_SYSTEM".
  9497. 3) The <implementation-defined character repertoire name>s shall
  9498. include SQL_TEXT.
  9499. 248 Database Language SQL
  9500. X3H2-92-154/DBL CBR-002
  9501. 10.4 <character set specification>
  9502. Access Rules
  9503. 1) Let C be the <character set name> contained in the <character
  9504. set specification>. The applicable privileges shall include
  9505. USAGE on C.
  9506. General Rules
  9507. 1) A <character set specification> identifies a character set. Let
  9508. the identified character set be CS.
  9509. Note: A character set comprises the characters in the character
  9510. set's repertoire together with a form-of-use that specifies
  9511. the convention for arranging those characters into character
  9512. strings.
  9513. 2) A <standard character repertoire name> specifies the name of a
  9514. character repertoire that is defined by a national or interna-
  9515. tional standard. The character repertoire and form-of-use of CS,
  9516. implied by the <standard character repertoire name>, are defined
  9517. by the standard that defined that <standard character repertoire
  9518. name>. The default collating sequence of the character reper-
  9519. toire is defined by the order of the characters in the standard
  9520. and has the PAD SPACE attribute.
  9521. 3) An <implementation-defined character repertoire name> speci-
  9522. fies the name of a character repertoire that is implementation-
  9523. defined. The character repertoire and form-of-use of CS, implied
  9524. by the <implementation-defined character repertoire name>, are
  9525. implementation-defined. The default collating sequence of the
  9526. character repertoire and whether the collating sequence has the
  9527. NO PAD attribute or the PAD SPACE attribute is implementation-
  9528. defined.
  9529. 4) A <user-defined character repertoire name> identifies a charac-
  9530. ter set whose descriptor is in some schema whose <schema name>
  9531. is not INFORMATION_SCHEMA.
  9532. Note: The default collating sequence and form-of-use of CS are
  9533. as defined in Subclause 11.28, "<character set definition>".
  9534. 5) A <standard universal character form-of-use name> identifies
  9535. form-of-use that is defined by some national or international
  9536. standard. That form-of-use is the form-of-use of CS. The charac-
  9537. ter repertoire of CS is as defined in that standard. The default
  9538. collating sequence of the character repertoire is defined by the
  9539. order of the characters in ISO/IEC 10646 and has the PAD SPACE
  9540. attribute.
  9541. Note: Specific forms-of-use implied by this rule include ISO
  9542. 2022 code extension techniques.
  9543. 6) An <implementation-defined universal character form-of-use name>
  9544. identifies an implementation-defined form-of-use that shall
  9545. be the form-of-use of CS. The implied character repertoire and
  9546. Additional common elements 249
  9547. X3H2-92-154/DBL CBR-002
  9548. 10.4 <character set specification>
  9549. default collating sequence of CS and whether the collating se-
  9550. quence has the NO PAD attribute or the PAD SPACE attribute are
  9551. implementation-defined.
  9552. Note: Specific forms-of-use implied by this rule include
  9553. implementation-defined techniques such as mixed one-octet/two-
  9554. octet Latin/Kanji or Compound String.
  9555. 7) There is a character set descriptor for every character set that
  9556. can be specified by a <character set specification>.
  9557. Leveling Rules
  9558. 1) The following restrictions apply for Intermediate SQL:
  9559. None.
  9560. 2) The following restrictions apply for Entry SQL in addition to
  9561. any Intermediate SQL restrictions:
  9562. a) Conforming Entry SQL language shall not contain a <character
  9563. set specification>.
  9564. 250 Database Language SQL
  9565. X3H2-92-154/DBL CBR-002
  9566. 10.5 <collate clause>
  9567. 10.5 <collate clause>
  9568. Function
  9569. Specify a collating sequence.
  9570. Format
  9571. <collate clause> ::= COLLATE <collation name>
  9572. Syntax Rules
  9573. None.
  9574. Access Rules
  9575. 1) Let C be the <collation name> contained in the <collate clause>.
  9576. The applicable privileges shall include USAGE on C.
  9577. General Rules
  9578. None.
  9579. Leveling Rules
  9580. 1) The following restrictions apply for Intermediate SQL:
  9581. a) Conforming Intermediate SQL language shall not contain any
  9582. <collate clause>.
  9583. 2) The following restrictions apply for Entry SQL in addition to
  9584. any Intermediate SQL restrictions:
  9585. None.
  9586. Additional common elements 251
  9587. X3H2-92-154/DBL CBR-002
  9588. 10.6 <constraint name definition> and <constraint attributes>
  9589. 10.6 <constraint name definition> and <constraint attributes>
  9590. Function
  9591. Specify the name of a constraint and its attributes.
  9592. Format
  9593. <constraint name definition> ::= CONSTRAINT <constraint name>
  9594. <constraint attributes> ::=
  9595. <constraint check time> [ [ NOT ] DEFERRABLE ]
  9596. | [ NOT ] DEFERRABLE [ <constraint check time> ]
  9597. <constraint check time> ::= INITIALLY DEFERRED
  9598. | INITIALLY IMMEDIATE
  9599. Syntax Rules
  9600. 1) If a <constraint name definition> is contained in a <schema def-
  9601. inition>, and if the <constraint name> contains a <schema name>,
  9602. then that <schema name> shall be the same as the specified or
  9603. implicit <schema name> of the containing <schema definition>.
  9604. 2) The <qualified identifier> of <constraint name> shall be differ-
  9605. ent from the <qualified identifier> of the <constraint name> of
  9606. any other constraint defined in the same schema.
  9607. 3) If <constraint check time> is not specified, then INITIALLY
  9608. IMMEDIATE is implicit.
  9609. 4) Case:
  9610. a) If INITIALLY DEFERRED is specified, then:
  9611. i) NOT DEFERRABLE shall not be specified.
  9612. ii) If DEFERRABLE is not specified, then DEFERRABLE is im-
  9613. plicit.
  9614. b) If INITIALLY IMMEDIATE is specified or implicit and nei-
  9615. ther DEFERRABLE nor NOT DEFERRABLE is specified, then NOT
  9616. DEFERRABLE is implicit.
  9617. Access Rules
  9618. None.
  9619. 252 Database Language SQL
  9620. X3H2-92-154/DBL CBR-002
  9621. 10.6 <constraint name definition> and <constraint attributes>
  9622. General Rules
  9623. 1) If NOT DEFERRABLE is specified, then the constraint is not de-
  9624. ferrable; otherwise it is deferrable.
  9625. 2) If <constraint check time> is INITIALLY DEFERRED, then the ini-
  9626. tial constraint mode for the constraint is deferred; otherwise,
  9627. the initial constraint mode for the constraint is immediate.
  9628. 3) If, on completion of any SQL-statement, the constraint mode of
  9629. any constraint is immediate, then that constraint is effectively
  9630. checked.
  9631. Note: This includes the cases where <SQL statement> is a <set
  9632. constraints mode statement>, a <commit statement>, or the
  9633. statement that causes a constraint with a constraint mode of
  9634. initially immediate to be created.
  9635. 4) When a constraint is effectively checked, if the constraint is
  9636. not satisfied, then an exception condition is raised: integrity
  9637. constraint violation. If this exception condition is raised as a
  9638. result of executing a <commit statement>, then SQLSTATE is not
  9639. set to integrity constraint violation, but is set to transaction
  9640. rollback-integrity constraint violation (see the General Rules
  9641. of Subclause 14.3, "<commit statement>").
  9642. Leveling Rules
  9643. 1) The following restrictions apply for Intermediate SQL:
  9644. a) Conforming Intermediate SQL language shall contain no ex-
  9645. plicit <constraint attributes>.
  9646. Note: This means that INITIALLY IMMEDIATE NOT DEFERRABLE is
  9647. implicit.
  9648. 2) The following restrictions apply for Entry SQL in addition to
  9649. any Intermediate SQL restrictions:
  9650. a) Conforming Intermediate SQL language shall contain no <con-
  9651. straint name definition>.
  9652. Additional common elements 253
  9653. X3H2-92-154/DBL CBR-002
  9654. 254 Database Language SQL
  9655. X3H2-92-154/DBL CBR-002
  9656. 11 Schema definition and manipulation
  9657. 11.1 <schema definition>
  9658. Function
  9659. Define a schema.
  9660. Format
  9661. <schema definition> ::=
  9662. CREATE SCHEMA <schema name clause>
  9663. [ <schema character set specification> ]
  9664. [ <schema element>... ]
  9665. <schema name clause> ::=
  9666. <schema name>
  9667. | AUTHORIZATION <schema authorization identifier>
  9668. | <schema name> AUTHORIZATION <schema authorization identifier>
  9669. <schema authorization identifier> ::=
  9670. <authorization identifier>
  9671. <schema character set specification> ::=
  9672. DEFAULT CHARACTER SET <character set specification>
  9673. <schema element> ::=
  9674. <domain definition>
  9675. | <table definition>
  9676. | <view definition>
  9677. | <grant statement>
  9678. | <assertion definition>
  9679. | <character set definition>
  9680. | <collation definition>
  9681. | <translation definition>
  9682. Syntax Rules
  9683. 1) If <schema name> is not specified, then a <schema name> equal to
  9684. <schema authorization identifier> is implicit.
  9685. 2) If AUTHORIZATION <schema authorization identifier> is not speci-
  9686. fied, then
  9687. Schema definition and manipulation 255
  9688. X3H2-92-154/DBL CBR-002
  9689. 11.1 <schema definition>
  9690. Case:
  9691. a) If the <schema definition> is contained in a <module> that
  9692. has a <module authorization identifier> specified, then an
  9693. <authorization identifier> equal to that <module authoriza-
  9694. tion identifier> is implicit for the <schema definition>.
  9695. b) Otherwise, an <authorization identifier> equal to the SQL-
  9696. session <authorization identifier> is implicit.
  9697. 3) The <unqualified schema name> of the explicit or implicit
  9698. <schema name> shall be different from the <unqualified schema
  9699. name> of the <schema name> of any other schema in the catalog
  9700. identified by the <catalog name> of <schema name>.
  9701. 4) If a <schema definition> appears in a <procedure> in a <module>,
  9702. then the effective <schema authorization identifier> and <schema
  9703. name> during processing of the <schema definition> is the
  9704. <schema authorization identifier> and <schema name> specified
  9705. or implicit in the <schema definition>. Other SQL-statements
  9706. executed in <procedure>s in the <module> have the <module autho-
  9707. rization identifier> and <schema name> specified or implicit for
  9708. the <module>.
  9709. 5) If <schema character set specification> is not specified,
  9710. then a <schema character set specification> containing an
  9711. implementation-defined <character set specification> is im-
  9712. plicit.
  9713. Access Rules
  9714. 1) The privileges necessary to execute the <schema definition> are
  9715. implementation-defined.
  9716. General Rules
  9717. 1) A schema S is created with a name equal to the explicit or im-
  9718. plicit <schema name> and a default character set name equal to
  9719. the <character set specification> of the explicit or implicit
  9720. <default character set specification>.
  9721. 2) The <schema authorization identifier> is the current <authoriza-
  9722. tion identifier> for privilege determination for S.
  9723. 3) Those objects defined by <schema element>s (base tables, views,
  9724. constraints, domains, assertions, character sets, translations,
  9725. collations, privileges) and their associated descriptors are
  9726. effectively created.
  9727. 4) The explicit or implicit <character set specification> is used
  9728. as the default character set used for all <column definition>s
  9729. and <domain definition>s that do not specify an explicit charac-
  9730. ter set.
  9731. 256 Database Language SQL
  9732. X3H2-92-154/DBL CBR-002
  9733. 11.1 <schema definition>
  9734. Leveling Rules
  9735. 1) The following restrictions apply for Intermediate SQL:
  9736. a) Conforming Intermediate SQL language shall not contain any
  9737. <assertion definition>.
  9738. b) Conforming Intermediate SQL language shall not contain any
  9739. <collation definition>.
  9740. c) Conforming Intermediate SQL language shall not contain any
  9741. <translation definition>.
  9742. 2) The following restrictions apply for Entry SQL in addition to
  9743. any Intermediate SQL restrictions:
  9744. a) Conforming Intermediate SQL language shall not contain any
  9745. <domain definition>.
  9746. b) A <schema name clause> shall specify AUTHORIZATION and shall
  9747. not specify a <schema name>.
  9748. c) A <schema character set specification> shall not be speci-
  9749. fied.
  9750. d) Conforming Entry SQL language shall not contain any <charac-
  9751. ter set definition>.
  9752. Schema definition and manipulation 257
  9753. X3H2-92-154/DBL CBR-002
  9754. 11.2 <drop schema statement>
  9755. 11.2 <drop schema statement>
  9756. Function
  9757. Destroy a schema.
  9758. Format
  9759. <drop schema statement> ::=
  9760. DROP SCHEMA <schema name> <drop behavior>
  9761. <drop behavior> ::= CASCADE | RESTRICT
  9762. Syntax Rules
  9763. 1) Let S be the schema identified by <schema name>.
  9764. 2) S shall identify a schema in the catalog identified by the ex-
  9765. plicit or implicit <catalog name>.
  9766. 3) If RESTRICT is specified, then S shall not contain any per-
  9767. sistent base tables, global temporary tables, created local
  9768. temporary tables, views, domains, assertions, character sets,
  9769. collations, or translations.
  9770. Note: If CASCADE is specified, then such objects will be dropped
  9771. by the effective execution of the SQL schema manipulation state-
  9772. ments specified in the General Rules of this Subclause.
  9773. Access Rules
  9774. 1) The current <authorization identifier> shall be equal to the
  9775. <authorization identifier> that owns the schema identified by
  9776. the <schema name>.
  9777. General Rules
  9778. 1) Let T be the <table name> of any base table or temporary ta-
  9779. ble contained in S. The following <drop table statement> is
  9780. effectively executed:
  9781. DROP TABLE T CASCADE
  9782. 2) Let V be the <table name> of any view contained in S. The fol-
  9783. lowing <drop view statement> is effectively executed:
  9784. DROP VIEW V CASCADE
  9785. 3) Let D be the <domain name> of any domain contained in S. The
  9786. following <drop domain statement> is effectively executed:
  9787. DROP DOMAIN D CASCADE
  9788. 258 Database Language SQL
  9789. X3H2-92-154/DBL CBR-002
  9790. 11.2 <drop schema statement>
  9791. 4) Let A be the <constraint name> of any assertion contained in
  9792. S. The following <drop assertion statement> is effectively exe-
  9793. cuted:
  9794. DROP ASSERTION A
  9795. 5) Let CD be the <collation name> of any collation definition
  9796. contained in S. The following <drop collation statement> is
  9797. effectively executed:
  9798. DROP COLLATION CD
  9799. 6) Let TD be the <translation name> of any translation contained
  9800. in S. The following <drop translation statement> is effectively
  9801. executed:
  9802. DROP TRANSLATION TD
  9803. 7) Let RD be the <character set name> of any character set con-
  9804. tained in S. The following <drop character set statement> is
  9805. effectively executed:
  9806. DROP CHARACTER SET RD
  9807. 8) The identified schema and its description are destroyed.
  9808. Leveling Rules
  9809. 1) The following restrictions apply for Intermediate SQL:
  9810. None.
  9811. 2) The following restrictions apply for Entry SQL in addition to
  9812. any Intermediate SQL restrictions:
  9813. a) Conforming Entry SQL language shall not contain a <drop
  9814. schema statement>.
  9815. Schema definition and manipulation 259
  9816. X3H2-92-154/DBL CBR-002
  9817. 11.3 <table definition>
  9818. 11.3 <table definition>
  9819. Function
  9820. Define a persistent base table, a created local temporary table, or
  9821. a global temporary table.
  9822. Format
  9823. <table definition> ::=
  9824. CREATE [ { GLOBAL | LOCAL } TEMPORARY ] TABLE <table name>
  9825. <table element list>
  9826. [ ON COMMIT { DELETE | PRESERVE } ROWS ]
  9827. <table element list> ::=
  9828. <left paren> <table element> [ { <comma> <table element> }... ] <right paren>
  9829. <table element> ::=
  9830. <column definition>
  9831. | <table constraint definition>
  9832. Syntax Rules
  9833. 1) If a <table definition> is contained in a <schema definition>,
  9834. and if the <table name> contains a <schema name>, then that
  9835. <schema name> shall be the same as the specified or implicit
  9836. <schema name> of the containing <schema definition>.
  9837. 2) The schema identified by the explicit or implicit schema name
  9838. of the <table name> shall not include a table descriptor whose
  9839. table name is <table name>.
  9840. 3) If ON COMMIT is specified, then TEMPORARY shall be specified.
  9841. 4) If TEMPORARY is specified and ON COMMIT is not specified, then
  9842. ON COMMIT DELETE ROWS is implicit.
  9843. 5) A <table definition> shall contain at least one <column defini-
  9844. tion>.
  9845. 6) The scope of the <table name> is the <table definition>.
  9846. Access Rules
  9847. 1) If a <table definition> is contained in a <module>, then the
  9848. current <authorization identifier> shall be equal to the <au-
  9849. thorization identifier> that owns the schema identified by the
  9850. implicit or explicit <schema name> of the <table name>.
  9851. 260 Database Language SQL
  9852. X3H2-92-154/DBL CBR-002
  9853. 11.3 <table definition>
  9854. General Rules
  9855. 1) A <table definition> defines either a persistent base table, a
  9856. global temporary table or a created local temporary table. If
  9857. GLOBAL is specified, then a global temporary table is defined.
  9858. If LOCAL is specified, then a created local temporary table is
  9859. defined. Otherwise, a persistent base table is defined.
  9860. 2) The degree of the table being created is initially set to 0; the
  9861. General Rules of Subclause 11.4, "<column definition>" specify
  9862. the degree of the table being created during the definition of
  9863. columns in that table.
  9864. 3) A table descriptor is created that describes the table being
  9865. defined.
  9866. a) The name included in the table descriptor is <table name>.
  9867. b) The table descriptor includes the degree of the table, which
  9868. is the number of <table element>s in the <table definition>
  9869. that are <column definition>s.
  9870. 4) A set of privilege descriptors is created that define the priv-
  9871. ileges INSERT, SELECT, UPDATE, DELETE, and REFERENCES on this
  9872. table and INSERT, SELECT, UPDATE, and REFERENCES for every <col-
  9873. umn definition> in the table definition to the <authorization
  9874. identifier> of the <schema definition> or <module> in which the
  9875. <table definition> appears. These privileges are grantable. The
  9876. grantor for each of these privilege descriptors is set to the
  9877. special grantor value "_SYSTEM".
  9878. Leveling Rules
  9879. 1) The following restrictions apply for Intermediate SQL:
  9880. a) Conforming Intermediate SQL language shall not specify
  9881. TEMPORARY and shall not reference any global or local tem-
  9882. porary table.
  9883. 2) The following restrictions apply for Entry SQL in addition to
  9884. any Intermediate SQL restrictions:
  9885. None.
  9886. Schema definition and manipulation 261
  9887. X3H2-92-154/DBL CBR-002
  9888. 11.4 <column definition>
  9889. 11.4 <column definition>
  9890. Function
  9891. Define a column of a table.
  9892. Format
  9893. <column definition> ::=
  9894. <column name> { <data type> | <domain name> }
  9895. [ <default clause> ]
  9896. [ <column constraint definition>... ]
  9897. [ <collate clause> ]
  9898. <column constraint definition> ::=
  9899. [ <constraint name definition> ]
  9900. <column constraint>
  9901. [ <constraint attributes> ]
  9902. <column constraint> ::=
  9903. NOT NULL
  9904. | <unique specification>
  9905. | <references specification>
  9906. | <check constraint definition>
  9907. Syntax Rules
  9908. 1) Case:
  9909. a) If the <column definition> is contained in a <table def-
  9910. inition>, then let T be the table defined by that <table
  9911. definition>.
  9912. b) If the <column definition> is contained in a <temporary ta-
  9913. ble declaration>, then let T be the table declared by that
  9914. <temporary table declaration>.
  9915. c) If the <column definition> is contained in an <alter ta-
  9916. ble statement>, then let T be the table identified in the
  9917. containing <alter table statement>.
  9918. The <column name> in the <column definition> shall be different
  9919. from the <column name> of any column of T.
  9920. 2) The i-th column of the table is described by the i-th <column
  9921. definition> in the <table definition>. The name and the data
  9922. type or domain of the column are specified by the <column name>
  9923. and <data type> or <domain name>, respectively.
  9924. 3) Let C be the <column name> of a <column definition>.
  9925. 4) If <domain name> is specified, then let D be the domain identi-
  9926. fied by the <domain name>.
  9927. 262 Database Language SQL
  9928. X3H2-92-154/DBL CBR-002
  9929. 11.4 <column definition>
  9930. 5) The data type of the column is
  9931. Case:
  9932. a) If <data type> is specified, then that data type.
  9933. b) Otherwise, the data type of D.
  9934. 6) If the data type of the column is character string, then the
  9935. collation of the column is
  9936. Case:
  9937. a) If <collate clause> is specified, then the collation speci-
  9938. fied by that <collate clause>.
  9939. b) If <domain name> is specified, then the collation of D, if
  9940. any.
  9941. c) Otherwise, the default collation of the character set of the
  9942. column.
  9943. Note: The character set of a column is determined by its data
  9944. type.
  9945. 7) If a <data type> is specified, then:
  9946. a) Let DT be the <data type>.
  9947. b) The data type of the column is DT.
  9948. c) If DT is CHARACTER or CHARACTER VARYING and does not spec-
  9949. ify a <character set specification>, then the <character set
  9950. specification> specified or implicit in the <schema char-
  9951. acter set specification> of the <schema definition> that
  9952. created the schema identified by the <schema name> immedi-
  9953. ately contained in the <table name> of the containing <table
  9954. definition> or <alter table statement> is implicit.
  9955. d) If DT is a <character string type> that identifies a char-
  9956. acter set that specifies a <collate clause> and the <column
  9957. definition> does not contain a <collate clause>, then the
  9958. <collate clause> of the <character string type> is implicit
  9959. in the <column definition>.
  9960. 8) If <collate clause> is specified, then data type shall be a
  9961. character string type.
  9962. 9) If a <column constraint definition> is specified, then let CND
  9963. be the <constraint name definition> if one is specified and let
  9964. CND be a zero-length string otherwise; let CA be the <constraint
  9965. attributes> if specified and let CA be a zero-length string
  9966. otherwise. The <column constraint definition> is equivalent to a
  9967. <table constraint definition> as follows:
  9968. Schema definition and manipulation 263
  9969. X3H2-92-154/DBL CBR-002
  9970. 11.4 <column definition>
  9971. Case:
  9972. a) If a <column constraint definition> is specified that con-
  9973. tains the <column constraint> NOT NULL, then it is equivalent
  9974. to a <table constraint definition> that contains the follow-
  9975. ing <table constraint>:
  9976. CND CHECK ( C IS NOT NULL ) CA
  9977. b) If a <column constraint definition> is specified that con-
  9978. tains a <unique specification>, then it is equivalent to a
  9979. <table constraint definition> that contains the following
  9980. <table constraint>:
  9981. CND <unique specification> (C) CA
  9982. Note: The <unique specification> is defined in Subclause 11.7,
  9983. "<unique constraint definition>".
  9984. c) If a <column constraint definition> is specified that con-
  9985. tains a <references specification>, then it is equivalent to
  9986. a <table constraint definition> that contains the following
  9987. <table constraint>:
  9988. CND FOREIGN KEY (C) <references specification> CA
  9989. Note: The <references specification> is defined in Subclause 11.8,
  9990. "<referential constraint definition>".
  9991. d) If a <column constraint definition> is specified that con-
  9992. tains a <check constraint definition>, then it is equivalent
  9993. to a <table constraint definition> that contains the follow-
  9994. ing <table constraint>:
  9995. CND CHECK ( <search condition> ) CA
  9996. Each <column reference> directly contained in the <search
  9997. condition> shall reference column C.
  9998. Access Rules
  9999. 1) If <domain name> is specified, then the applicable privileges
  10000. shall include USAGE on D..
  10001. General Rules
  10002. 1) A <column definition> defines a column in a table.
  10003. 2) The <collate clause> specifies the default collating sequence
  10004. for the column. If <collate clause> is not specified, then
  10005. the default collating sequence is that used for comparisons of
  10006. Coercible coercibility attribute, as defined in Subclause 8.2,
  10007. "<comparison predicate>".
  10008. 3) If the <column definition> specifies <data type>, then a data
  10009. type descriptor is created that describes the data type of the
  10010. column being defined.
  10011. 264 Database Language SQL
  10012. X3H2-92-154/DBL CBR-002
  10013. 11.4 <column definition>
  10014. 4) The degree of the table T being defined in the containing <table
  10015. definition> or <temporary table declaration> or altered by the
  10016. containing <alter table statement> is increased by 1.
  10017. 5) A column descriptor is created that describes the column being
  10018. defined. The name included in the column descriptor is <col-
  10019. umn name>. If the <column definition> specifies <data type>,
  10020. then the column descriptor includes the data type descriptor
  10021. of the column; otherwise, the column descriptor includes the
  10022. name of the domain of the column. The ordinal position included
  10023. in the column descriptor is equal to the degree of T. If the
  10024. <column definition> contains a <collate clause>, then the <col-
  10025. lation name> of the <collate clause> is included in the column
  10026. descriptor. The column descriptor includes the nullability char-
  10027. acteristic of the column, determined according to the rules in
  10028. Subclause 4.8, "Columns". The column descriptor is included in
  10029. the table descriptor for T.
  10030. Leveling Rules
  10031. 1) The following restrictions apply for Intermediate SQL:
  10032. a) Conforming Intermediate SQL language shall not contain any
  10033. <collate clause>.
  10034. 2) The following restrictions apply for Entry SQL in addition to
  10035. any Intermediate SQL restrictions:
  10036. a) A <column definition> shall not contain a <domain name>.
  10037. b) A <column constraint> shall not contain a <referential trig-
  10038. gered action>.
  10039. c) Conforming Intermediate SQL language shall contain no <con-
  10040. straint name definition>.
  10041. Schema definition and manipulation 265
  10042. X3H2-92-154/DBL CBR-002
  10043. 11.5 <default clause>
  10044. 11.5 <default clause>
  10045. Function
  10046. Specify the default for a column or domain.
  10047. Format
  10048. <default clause> ::=
  10049. DEFAULT <default option>
  10050. <default option> ::=
  10051. <literal>
  10052. | <datetime value function>
  10053. | USER
  10054. | CURRENT_USER
  10055. | SESSION_USER
  10056. | SYSTEM_USER
  10057. | NULL
  10058. Syntax Rules
  10059. 1) The subject data type of a <default clause> is the data type
  10060. specified in the descriptor identified by the containing <column
  10061. definition>, <domain definition>, <alter column definition>, or
  10062. <alter domain definition>.
  10063. 2) If USER is specified, then CURRENT_USER is implicit.
  10064. 3) Case:
  10065. a) If a <literal> is specified, then:
  10066. Case:
  10067. i) If the subject data type is character string, then the
  10068. <literal> shall be a <character string literal>. If the
  10069. length of the subject data type is fixed, then the length
  10070. in characters of the <character string literal> shall not
  10071. be greater than the length of the subject data type. If
  10072. the length of the subject data type is variable, then the
  10073. length in characters of the <character string literal>
  10074. shall not be greater than the maximum length of the subject
  10075. data type. The <literal> shall have the same character
  10076. repertoire as the subject data type.
  10077. ii) If the subject data type is bit string, then the <literal>
  10078. shall be a <bit string literal> or a <hex string literal>.
  10079. If the length of the subject data type is fixed, then the
  10080. length in bits of the <bit string literal> or <hex string
  10081. literal> shall not be greater than the length of the sub-
  10082. ject data type. If the length of the subject data type is
  10083. 266 Database Language SQL
  10084. X3H2-92-154/DBL CBR-002
  10085. 11.5 <default clause>
  10086. variable, then the length in bits of the <bit string lit-
  10087. eral> or <hex string literal> shall not be greater than the
  10088. maximum length of the subject data type.
  10089. iii) If the subject data type is exact numeric, then the <lit-
  10090. eral> shall be a <signed numeric literal> that simply
  10091. contains an <exact numeric literal>. There shall be a rep-
  10092. resentation of the value of the <literal> in the subject
  10093. data type that does not lose any significant digits.
  10094. iv) If the subject data type is approximate numeric, then the
  10095. <literal> shall be a <signed numeric literal>.
  10096. v) If the subject data type is datetime, then the <literal>
  10097. shall be a <datetime literal> and shall contain the same
  10098. <datetime field>s as the subject data type.
  10099. vi) If the subject data type is interval, then the <literal>
  10100. shall be an <interval literal> and shall contain the same
  10101. <interval qualifier> as the subject data type.
  10102. b) If CURRENT_USER, SESSION_USER, or SYSTEM_USER is specified,
  10103. then the subject data type shall be character string with
  10104. character set SQL_TEXT. If the length of the subject data
  10105. type is fixed, then its length shall not be less than 128
  10106. characters. If the length of the subject data type is vari-
  10107. able, then its maximum length shall not be less than 128
  10108. characters.
  10109. c) If <datetime value function> is specified, then the subject
  10110. data type shall be datetime with the same datetime type as
  10111. the datetime data type of the <datetime value function>.
  10112. Access Rules
  10113. None.
  10114. General Rules
  10115. 1) The default value inserted in the column descriptor, if the
  10116. <default clause> is to apply to a column, or in the domain de-
  10117. scriptor, if the <default clause> is to apply to a domain, is as
  10118. follows:
  10119. Case:
  10120. a) If the <default clause> contains NULL, then the null value.
  10121. b) If the <default clause> contains a <literal>, then
  10122. Case:
  10123. i) If the subject data type is numeric, then the numeric value
  10124. of the <literal>.
  10125. Schema definition and manipulation 267
  10126. X3H2-92-154/DBL CBR-002
  10127. 11.5 <default clause>
  10128. ii) If the subject data type is character string with variable
  10129. length, then the value of the <literal>.
  10130. iii) If the subject data type is character string with fixed
  10131. length, then the value of the <literal>, extended as neces-
  10132. sary on the right with <space>s to the length in characters
  10133. of the subject data type.
  10134. iv) If the subject data type is bit string with variable
  10135. length, then the value of the <literal>.
  10136. v) If the subject data type is bit string with fixed length,
  10137. then the value of the <literal> extended as necessary on
  10138. the right with 0-valued bits to the length of the subject
  10139. data type and a completion condition is raised: warning-
  10140. implicit zero-bit padding.
  10141. vi) If the subject data type is datetime or interval, then the
  10142. value of the <literal>.
  10143. c) If the <default clause> specifies CURRENT_USER, SESSION_USER,
  10144. or SYSTEM_USER, then
  10145. Case:
  10146. i) If the subject data type is character string with variable
  10147. length, then the value specified by CURRENT_USER, SESSION_
  10148. USER, or SYSTEM_USER.
  10149. ii) If the subject data type is character string with fixed
  10150. length, then the value specified by CURRENT_USER, SESSION_
  10151. USER, or SYSTEM_USER, extended as necessary on the right
  10152. with <space>s to the length in characters of the subject
  10153. data type.
  10154. d) If the <default clause> contains a <datetime value function>,
  10155. then the value of an implicit reference to the <datetime
  10156. value function>.
  10157. 2) The default value of a column is
  10158. Case:
  10159. a) If the column descriptor of a column includes a default value
  10160. derived from a <default option>, then the value of that <de-
  10161. fault option>.
  10162. b) If the column descriptor includes a domain name that iden-
  10163. tifies a domain descriptor that includes a default value
  10164. derived from a <default option>, then the value of that <de-
  10165. fault option>.
  10166. c) Otherwise, the null value.
  10167. 268 Database Language SQL
  10168. X3H2-92-154/DBL CBR-002
  10169. 11.5 <default clause>
  10170. Leveling Rules
  10171. 1) The following restrictions apply for Intermediate SQL:
  10172. None.
  10173. 2) The following restrictions apply for Entry SQL in addition to
  10174. any Intermediate SQL restrictions:
  10175. a) A <default option> shall not specify a <datetime value func-
  10176. tion>, SYSTEM_USER, SESSION_USER, or CURRENT_USER.
  10177. Schema definition and manipulation 269
  10178. X3H2-92-154/DBL CBR-002
  10179. 11.6 <table constraint definition>
  10180. 11.6 <table constraint definition>
  10181. Function
  10182. Specify an integrity constraint.
  10183. Format
  10184. <table constraint definition> ::=
  10185. [ <constraint name definition> ]
  10186. <table constraint> [ <constraint attributes> ]
  10187. <table constraint> ::=
  10188. <unique constraint definition>
  10189. | <referential constraint definition>
  10190. | <check constraint definition>
  10191. Syntax Rules
  10192. 1) If <constraint attributes> is not specified, then INITIALLY
  10193. IMMEDIATE NOT DEFERRABLE is implicit.
  10194. 2) If <constraint name definition> is not specified, then a <con-
  10195. straint name definition> that contains an implementation-
  10196. dependent <constraint name> is implicit. The assigned <con-
  10197. straint name> shall obey the Syntax Rules of an explicit <con-
  10198. straint name>.
  10199. Access Rules
  10200. None.
  10201. General Rules
  10202. 1) A <table constraint definition> defines a table constraint.
  10203. 2) A table constraint descriptor is created that describes the
  10204. table constraint being defined. The table constraint descriptor
  10205. includes the <constraint name> contained in the explicit or
  10206. implicit <constraint name definition>.
  10207. The table constraint descriptor includes an indication of
  10208. whether the constraint is deferrable or not deferrable and
  10209. whether the initial constraint mode of the constraint is de-
  10210. ferred or immediate.
  10211. Case:
  10212. a) If <unique constraint definition> is specified, then the
  10213. table constraint descriptor is a unique constraint descriptor
  10214. that includes an indication of whether it was defined with
  10215. PRIMARY KEY or UNIQUE, and the names of the unique columns
  10216. specified in the <unique column list>.
  10217. 270 Database Language SQL
  10218. X3H2-92-154/DBL CBR-002
  10219. 11.6 <table constraint definition>
  10220. b) If <referential constraint definition> is specified, then the
  10221. table constraint descriptor is a referential constraint de-
  10222. scriptor that includes the names of the referencing columns
  10223. specified in the <referencing columns> and the names of
  10224. the referenced columns and referenced table specified in
  10225. the <referenced table and columns>, the value of the <match
  10226. type>, if specified, and the <referential triggered actions>,
  10227. if specified.
  10228. c) If <check constraint definition> is specified, then the table
  10229. constraint descriptor is a table check constraint descriptor
  10230. that includes the <search condition>.
  10231. 3) If the <table constraint> is a <check constraint definition>,
  10232. then let SC be the <search condition> immediately contained in
  10233. the <check constraint definition> and let T be the table name
  10234. included in the corresponding table constraint descriptor; the
  10235. table constraint is not satisfied if and only if
  10236. EXISTS ( SELECT * FROM T WHERE NOT ( SC ) )
  10237. is true.
  10238. Leveling Rules
  10239. 1) The following restrictions apply for Intermediate SQL:
  10240. None.
  10241. 2) The following restrictions apply for Entry SQL in addition to
  10242. any Intermediate SQL restrictions:
  10243. a) Conforming Intermediate SQL language shall contain no <con-
  10244. straint name definition>.
  10245. Schema definition and manipulation 271
  10246. X3H2-92-154/DBL CBR-002
  10247. 11.7 <unique constraint definition>
  10248. 11.7 <unique constraint definition>
  10249. Function
  10250. Specify a uniqueness constraint for a table.
  10251. Format
  10252. <unique constraint definition> ::=
  10253. <unique specification>
  10254. <left paren> <unique column list> <right paren>
  10255. <unique specification> ::=
  10256. UNIQUE | PRIMARY KEY
  10257. <unique column list> ::= <column name list>
  10258. Syntax Rules
  10259. 1) Let T be the table identified by the containing <table defini-
  10260. tion> or <alter table statement>. Let TN be the <table name> of
  10261. T.
  10262. 2) Let UCL be the <unique column list> of the <unique constraint
  10263. definition>.
  10264. 3) Case:
  10265. a) If the <unique specification> specifies PRIMARY KEY, then let
  10266. SC be the <search condition>:
  10267. UNIQUE ( SELECT UCL FROM TN )
  10268. AND
  10269. ( UCL ) IS NOT NULL
  10270. b) Otherwise, let SC be the <search condition>:
  10271. UNIQUE ( SELECT UCL FROM TN )
  10272. 4) Each <column name> in the <unique column list> shall identify
  10273. a column of T, and the same column shall not be identified more
  10274. than once.
  10275. 5) A <table definition> shall specify at most one implicit or ex-
  10276. plicit <unique constraint definition> that specifies PRIMARY
  10277. KEY.
  10278. 6) If a <unique constraint definition> that specifies PRIMARY KEY
  10279. is contained in an <add table constraint definition>, then the
  10280. table identified by the <table name> immediately contained in
  10281. the containing <alter table statement> shall not have a unique
  10282. constraint that was defined by a <unique constraint definition>
  10283. that specified PRIMARY KEY.
  10284. 272 Database Language SQL
  10285. X3H2-92-154/DBL CBR-002
  10286. 11.7 <unique constraint definition>
  10287. 7) The set of columns in the <unique column list> shall be dis-
  10288. tinct from the unique columns of any other unique constraint
  10289. descriptor that is included in the base table descriptor of T.
  10290. Access Rules
  10291. None.
  10292. General Rules
  10293. 1) A <unique constraint definition> defines a unique constraint.
  10294. Note: Subclause 10.6, "<constraint name definition> and <con-
  10295. straint attributes>", specifies when a constraint is effectively
  10296. checked.
  10297. 2) The unique constraint is not satisfied if and only if
  10298. EXISTS ( SELECT * FROM TN WHERE NOT ( SC ) )
  10299. is true.
  10300. Leveling Rules
  10301. 1) The following restrictions apply for Intermediate SQL:
  10302. None.
  10303. 2) The following restrictions apply for Entry SQL in addition to
  10304. any Intermediate SQL restrictions:
  10305. a) If PRIMARY KEY or UNIQUE is specified, then the <column defi-
  10306. nition> for each column whose <column name> is in the <unique
  10307. column list> shall specify NOT NULL.
  10308. Schema definition and manipulation 273
  10309. X3H2-92-154/DBL CBR-002
  10310. 11.8 <referential constraint definition>
  10311. 11.8 <referential constraint definition>
  10312. Function
  10313. Specify a referential constraint.
  10314. Format
  10315. <referential constraint definition> ::=
  10316. FOREIGN KEY <left paren> <referencing columns> <right paren>
  10317. <references specification>
  10318. <references specification> ::=
  10319. REFERENCES <referenced table and columns>
  10320. [ MATCH <match type> ]
  10321. [ <referential triggered action> ]
  10322. <match type> ::=
  10323. FULL
  10324. | PARTIAL
  10325. <referencing columns> ::=
  10326. <reference column list>
  10327. <referenced table and columns> ::=
  10328. <table name> [ <left paren> <reference column list> <right paren> ]
  10329. <reference column list> ::= <column name list>
  10330. <referential triggered action> ::=
  10331. <update rule> [ <delete rule> ]
  10332. | <delete rule> [ <update rule> ]
  10333. <update rule> ::= ON UPDATE <referential action>
  10334. <delete rule> ::= ON DELETE <referential action>
  10335. <referential action> ::=
  10336. CASCADE
  10337. | SET NULL
  10338. | SET DEFAULT
  10339. | NO ACTION
  10340. Syntax Rules
  10341. 1) Let referencing table be the table identified by the containing
  10342. <table definition> or <alter table statement>. Let referenced
  10343. table be the table identified by the <table name> in the <refer-
  10344. enced table and columns>. Let referencing columns be the column
  10345. or columns identified by the <reference column list> in the
  10346. 274 Database Language SQL
  10347. X3H2-92-154/DBL CBR-002
  10348. 11.8 <referential constraint definition>
  10349. <referencing columns> and let referencing column be one such
  10350. column.
  10351. 2) Case:
  10352. a) If the <referenced table and columns> specifies a <reference
  10353. column list>, then the set of column names of that <refer-
  10354. ence column list> shall be equal to the set of column names
  10355. in the unique columns of a unique constraint of the refer-
  10356. enced table. Let referenced columns be the column or columns
  10357. identified by that <reference column list> and let refer-
  10358. enced column be one such column. Each referenced column shall
  10359. identify a column of the referenced table and the same column
  10360. shall not be identified more than once.
  10361. b) If the <referenced table and columns> does not specify a
  10362. <reference column list>, then the table descriptor of the
  10363. referenced table shall include a unique constraint that spec-
  10364. ifies PRIMARY KEY. Let referenced columns be the column or
  10365. columns identified by the unique columns in that unique con-
  10366. straint and let referenced column be one such column. The
  10367. <referenced table and columns> shall be considered to implic-
  10368. itly specify a <reference column list> that is identical to
  10369. that <unique column list>.
  10370. 3) The table constraint descriptor describing the <unique con-
  10371. straint definition> whose <unique column list> identifies the
  10372. referenced columns shall indicate that the unique constraint is
  10373. not deferrable.
  10374. 4) The referenced table shall be a base table.
  10375. Case:
  10376. a) If the referencing table is a persistent base table, then the
  10377. referenced table shall be a persistent base table.
  10378. b) If the referencing table is a global temporary table, then
  10379. the referenced table shall be a global temporary table.
  10380. c) If the referencing table is a created local temporary table,
  10381. then the referenced table shall be either a global temporary
  10382. table or a created local temporary table.
  10383. d) If the referencing table is a declared local temporary table,
  10384. then the referenced table shall be either a global temporary
  10385. table, a created local temporary table or a declared local
  10386. temporary table.
  10387. 5) If the referenced table is a temporary table with ON COMMIT
  10388. DELETE ROWS specified, then the referencing table shall specify
  10389. ON COMMIT DELETE ROWS.
  10390. Schema definition and manipulation 275
  10391. X3H2-92-154/DBL CBR-002
  10392. 11.8 <referential constraint definition>
  10393. 6) Each referencing column shall identify a column of the referenc-
  10394. ing table, and the same column shall not be identified more than
  10395. once.
  10396. 7) The <referencing columns> shall contain the same number of <col-
  10397. umn name>s as the <referenced table and columns>. The i-th col-
  10398. umn identified in the <referencing columns> corresponds to the
  10399. i-th column identified in the <referenced table and columns>.
  10400. The data type of each referencing column shall be the same as
  10401. the data type of the corresponding referenced column.
  10402. 8) If a <referential constraint definition> does not specify any
  10403. <update rule>, then an <update rule> with a <referential action>
  10404. of NO ACTION is implicit.
  10405. 9) If a <referential constraint definition> does not specify any
  10406. <delete rule>, then a <delete rule> with a <referential action>
  10407. of NO ACTION is implicit.
  10408. Access Rules
  10409. 1) The applicable privileges shall include REFERENCES for each
  10410. referenced column.
  10411. General Rules
  10412. 1) A <referential constraint definition> defines a referential
  10413. constraint.
  10414. Note: Subclause 10.6, "<constraint name definition> and <con-
  10415. straint attributes>", specifies when a constraint is effectively
  10416. checked.
  10417. 2) Let Rf be the referencing columns and let Rt be the referenced
  10418. columns in the referenced table T. The referencing table and the
  10419. referenced table satisfy the referential constraint if and only
  10420. if:
  10421. Case:
  10422. a) A <match type> is not specified and for each row of the ref-
  10423. erencing table, the <match predicate>
  10424. Rf MATCH (SELECT Rt FROM T)
  10425. is true.
  10426. b) PARTIAL is specified and for each row of the referencing
  10427. table, the <match predicate>
  10428. Rf MATCH PARTIAL (SELECT Rt FROM T)
  10429. is true.
  10430. c) FULL is specified and for each row of the referencing table,
  10431. the <match predicate>
  10432. Rf MATCH FULL (SELECT Rt FROM T)
  10433. 276 Database Language SQL
  10434. X3H2-92-154/DBL CBR-002
  10435. 11.8 <referential constraint definition>
  10436. is true.
  10437. 3) Case:
  10438. a) If <match type> is not specified or if FULL is specified,
  10439. then for a given row in the referenced table, let matching
  10440. rows be all rows in the referencing table whose referenc-
  10441. ing column values equal the corresponding referenced column
  10442. values for the referential constraint.
  10443. b) If PARTIAL is specified, then:
  10444. i) For a given row in the referenced table, let matching rows
  10445. be all rows in the referencing table that have at least one
  10446. non-null referencing column value and whose non-null ref-
  10447. erencing column values equal the corresponding referenced
  10448. column values for the referential constraint.
  10449. ii) For a given row in the referenced table, let unique match-
  10450. ing rows be all matching rows for that given row that are
  10451. matching rows only to the given row in the referenced table
  10452. for the referential constraint. For a given row in the ref-
  10453. erenced table, let non-unique matching rows be all matching
  10454. rows for that given row that are not unique matching rows
  10455. for that given row for the referential constraint.
  10456. 4) For every row of the referenced table, its matching rows, unique
  10457. matching rows, and non-unique matching rows are determined imme-
  10458. diately before the execution of any SQL-statement. No new match-
  10459. ing rows are added during the execution of that SQL-statement.
  10460. The association between a referenced row and a non-unique match-
  10461. ing row is dropped during the execution of that SQL-statement
  10462. if the referenced row is either marked for deletion or updated
  10463. to a distinct value on any referenced column that corresponds
  10464. to a non-null referencing column. This occurs immediately after
  10465. such a mark for deletion or update of the referenced row. Unique
  10466. matching rows and non-unique matching rows for a referenced row
  10467. are evaluated immediately after dropping the association between
  10468. that referenced row and a non-unique matching row.
  10469. 5) If a <delete rule> is specified and a row of the referenced
  10470. table that has not previously been marked for deletion is marked
  10471. for deletion, then
  10472. Case:
  10473. a) If <match type> is not specified or if FULL is specified,
  10474. then
  10475. Case:
  10476. i) If the <delete rule> specifies CASCADE, then all matching
  10477. rows are marked for deletion.
  10478. Schema definition and manipulation 277
  10479. X3H2-92-154/DBL CBR-002
  10480. 11.8 <referential constraint definition>
  10481. ii) If the <delete rule> specifies SET NULL, then in all match-
  10482. ing rows each referencing column is set to the null value.
  10483. iii) If the <delete rule> specifies SET DEFAULT, then in all
  10484. matching rows each referencing column is set to the default
  10485. value specified in the General Rules of Subclause 11.5,
  10486. "<default clause>".
  10487. b) If PARTIAL is specified, then
  10488. Case:
  10489. i) If the <delete rule> specifies CASCADE, then all unique
  10490. matching rows are marked for deletion.
  10491. ii) If the <delete rule> specifies SET NULL, then in all unique
  10492. matching rows each referencing column is set to the null
  10493. value.
  10494. iii) If the <delete rule> specifies SET DEFAULT, then in all
  10495. unique matching rows each referencing column is set
  10496. to the default value specified in the General Rules of
  10497. Subclause 11.5, "<default clause>".
  10498. Note: Otherwise, the <referential action> is not performed.
  10499. 6) If an <update rule> is specified and a non-null value of a ref-
  10500. erenced column in the referenced table is updated to a value
  10501. that is distinct from the current value of that column, then
  10502. Case:
  10503. a) If <match type> is not specified or if FULL is specified,
  10504. then
  10505. Case:
  10506. i) If the <update rule> specifies CASCADE, then in all match-
  10507. ing rows the referencing column that corresponds with the
  10508. referenced column is updated to the new value of the refer-
  10509. enced column.
  10510. ii) If the <update rule> specifies SET NULL, then
  10511. Case:
  10512. 1) If <match type> is not specified, then in all matching
  10513. rows the referencing column that corresponds with the
  10514. referenced column is set to the null value.
  10515. 2) If <match type> specifies FULL, then in all matching
  10516. rows each referencing column is set to the null value.
  10517. iii) If the <update rule> specifies SET DEFAULT, then in all
  10518. matching rows the referencing column that corresponds with
  10519. the referenced column is set to the default value specified
  10520. 278 Database Language SQL
  10521. X3H2-92-154/DBL CBR-002
  10522. 11.8 <referential constraint definition>
  10523. in the General Rules of Subclause 11.5, "<default clause>".
  10524. b) If PARTIAL is specified, then
  10525. Case:
  10526. i) If the <update rule> specifies CASCADE, then for each
  10527. unique matching row that contains a non-null value in the
  10528. referencing column C1 that corresponds with the updated
  10529. referenced column C2, C1 is updated to the new value V of
  10530. C2, provided that, in all updated rows in the referenced
  10531. table that formerly had, in the same SQL-statement, that
  10532. unique matching row as a matching row, the values in C2
  10533. have all been updated to a value that is not distinct from
  10534. V. Otherwise, an exception condition is raised: triggered
  10535. data change violation.
  10536. Note: Because of the Rules of Subclause 8.2, "<comparison
  10537. predicate>", on which the definition of "distinct" re-
  10538. lies, the values in C2 may have been updated to values that
  10539. are not distinct, yet are not identical. Which of these
  10540. non-distinct values is used for the cascade operation is
  10541. implementation-dependent.
  10542. ii) If the <update rule> specifies SET NULL, then in all unique
  10543. matching rows that contain a non-null value in the ref-
  10544. erencing column that corresponds with the updated column,
  10545. that referencing column is set to the null value.
  10546. iii) If the <update rule> specifies SET DEFAULT, then in all
  10547. unique matching rows that contain a non-null value in the
  10548. referencing column that corresponds with the updated col-
  10549. umn, that referencing column is set to the default value
  10550. specified in the General Rules of Subclause 11.5, "<default
  10551. clause>".
  10552. Note: Otherwise, the <referential action> is not performed.
  10553. 7) If any attempt is made within an SQL-statement to update some
  10554. data item to a value that is distinct from the value to which
  10555. that data item was previously updated within the same SQL-
  10556. statement, then an exception condition is raised: triggered
  10557. data change violation.
  10558. 8) If an <update rule> attempts to update a row that has been
  10559. deleted by any <delete statement: positioned> that identifies
  10560. some cursor CR that is still open or updated by any <update
  10561. statement: positioned> that identifies some cursor CR that is
  10562. still open or if a <delete rule> attempts to mark for deletion
  10563. such a row, then a completion condition is raised: warning-
  10564. cursor operation conflict.
  10565. Schema definition and manipulation 279
  10566. X3H2-92-154/DBL CBR-002
  10567. 11.8 <referential constraint definition>
  10568. 9) All rows that are marked for deletion are effectively deleted
  10569. at the end of the SQL-statement, prior to the checking of any
  10570. integrity constraints.
  10571. Leveling Rules
  10572. 1) The following restrictions apply for Intermediate SQL:
  10573. a) A <references specification> shall not specify MATCH.
  10574. b) A <referential triggered action> shall not contain an <update
  10575. rule>.
  10576. c) The order of the column names in a <reference column list>
  10577. shall be the same as the order of column names of the corre-
  10578. sponding unique constraint of the referenced table.
  10579. 2) The following restrictions apply for Entry SQL in addition to
  10580. any Intermediate SQL restrictions:
  10581. a) A <referential constraint definition> shall not contain a
  10582. <referential triggered action>.
  10583. 280 Database Language SQL
  10584. X3H2-92-154/DBL CBR-002
  10585. 11.9 <check constraint definition>
  10586. 11.9 <check constraint definition>
  10587. Function
  10588. Specify a condition for the SQL-data.
  10589. Format
  10590. <check constraint definition> ::=
  10591. CHECK <left paren> <search condition> <right paren>
  10592. Syntax Rules
  10593. 1) The <search condition> shall not contain a <target specifica-
  10594. tion> or a <dynamic parameter specification>.
  10595. 2) The <search condition> shall not contain a <set function speci-
  10596. fication> that is not contained in a <subquery>.
  10597. 3) If <check constraint definition> is contained in a <table def-
  10598. inition> or <alter table statement>, then let T be the table
  10599. identified by the containing <table definition> or <alter table
  10600. statement>.
  10601. Case:
  10602. a) If T is a persistent base table, or if the <check constraint
  10603. definition> is contained in a <domain definition> or <alter
  10604. domain statement>, then no <table reference> generally con-
  10605. tained in the <search condition> shall reference a temporary
  10606. table.
  10607. b) If T is a global temporary table, then no <table reference>
  10608. generally contained in the <search condition> shall reference
  10609. a table other than a global temporary table.
  10610. c) If T is a created local temporary table, then no <table ref-
  10611. erence> generally contained in the <search condition> shall
  10612. reference a table other than either a global temporary table
  10613. or a created local temporary table.
  10614. d) If T is a declared local temporary table, then no <table
  10615. reference> generally contained in the <search condition>
  10616. shall reference a persistent base table.
  10617. 4) If the <check constraint definition> is contained in a <table
  10618. definition> that defines a temporary table and specifies ON
  10619. COMMIT PRESERVE ROWS or a <temporary table declaration> that
  10620. specifies ON COMMIT PRESERVE ROWS, then no <subquery> in the
  10621. <search condition> shall reference a temporary table defined
  10622. by a <table definition> or a <temporary table declaration> that
  10623. specifies ON COMMIT DELETE ROWS.
  10624. Schema definition and manipulation 281
  10625. X3H2-92-154/DBL CBR-002
  10626. 11.9 <check constraint definition>
  10627. 5) The <search condition> shall not generally contain a <datetime
  10628. value function> or a <value specification> that is CURRENT_USER,
  10629. SESSION_USER, or SYSTEM_USER.
  10630. 6) The <search condition> shall not generally contain a <query
  10631. specification> or a <query expression> that is possibly non-
  10632. deterministic.
  10633. Access Rules
  10634. 1) Let TN be any <table name> referenced in the <search condition>.
  10635. Case:
  10636. a) If a <column name> is contained in the <search condition>,
  10637. then the applicable privileges shall include REFERENCES for
  10638. each <column name> of the table identified by TN contained in
  10639. the <search condition>.
  10640. b) Otherwise, the applicable privileges shall include REFERENCES
  10641. for at least one column of the table identified by TN.
  10642. General Rules
  10643. 1) A <check constraint definition> defines a check constraint.
  10644. Note: Subclause 10.6, "<constraint name definition> and <con-
  10645. straint attributes>", specifies when a constraint is effectively
  10646. checked. The General Rules that control the evaluation of a
  10647. check constraint can be found in either Subclause 11.6, "<table
  10648. constraint definition>", or Subclause 11.21, "<domain defini-
  10649. tion>", depending on whether it forms part of a table constraint
  10650. or a domain constraint.
  10651. 2) If the character representation of the <search condition> cannot
  10652. be represented in the Information Schema without truncation,
  10653. then a completion condition is raised: warning-search condition
  10654. too long for information schema.
  10655. Leveling Rules
  10656. 1) The following restrictions apply for Intermediate SQL:
  10657. a) The <search condition> contained in a <check constraint defi-
  10658. nition> shall not contain a <subquery>.
  10659. b) The REFERENCES privilege is not required for <check con-
  10660. straint definition> access.
  10661. 2) The following restrictions apply for Entry SQL in addition to
  10662. any Intermediate SQL restrictions:
  10663. None.
  10664. 282 Database Language SQL
  10665. X3H2-92-154/DBL CBR-002
  10666. 11.10 <alter table statement>
  10667. 11.10 <alter table statement>
  10668. Function
  10669. Change the definition of a table.
  10670. Format
  10671. <alter table statement> ::=
  10672. ALTER TABLE <table name> <alter table action>
  10673. <alter table action> ::=
  10674. <add column definition>
  10675. | <alter column definition>
  10676. | <drop column definition>
  10677. | <add table constraint definition>
  10678. | <drop table constraint definition>
  10679. Syntax Rules
  10680. 1) Let T be the table identified by the <table name>.
  10681. 2) The schema identified by the explicit or implicit schema name of
  10682. the <table name> shall include the descriptor of T.
  10683. 3) The scope of the <table name> is the entire <alter table state-
  10684. ment>.
  10685. 4) T shall be a base table.
  10686. 5) T shall not be a declared local temporary table.
  10687. Access Rules
  10688. 1) The current <authorization identifier> shall be equal to the
  10689. <authorization identifier> that owns the schema identified by
  10690. the <schema name> of the table identified by <table name>.
  10691. General Rules
  10692. 1) The base table descriptor of T is modified as specified by <al-
  10693. ter table action>.
  10694. Leveling Rules
  10695. 1) The following restrictions apply for Intermediate SQL:
  10696. None.
  10697. 2) The following restrictions apply for Entry SQL in addition to
  10698. any Intermediate SQL restrictions:
  10699. a) Conforming Entry SQL language shall not contain an <alter
  10700. table statement>.
  10701. Schema definition and manipulation 283
  10702. X3H2-92-154/DBL CBR-002
  10703. 11.11 <add column definition>
  10704. 11.11 <add column definition>
  10705. Function
  10706. Add a column to a table.
  10707. Format
  10708. <add column definition> ::=
  10709. ADD [ COLUMN ] <column definition>
  10710. Syntax Rules
  10711. None.
  10712. Access Rules
  10713. None.
  10714. General Rules
  10715. 1) The column defined by the <column definition> is added to T.
  10716. 2) Let C be the column added to T. Every value in C is the default
  10717. value for C.
  10718. Note: The default value of a column is defined in Subclause 11.5,
  10719. "<default clause>".
  10720. Note: The addition of a column to a table has no effect on any
  10721. existing <query expression> included in a view descriptor or
  10722. <search condition> included in constraint descriptor because
  10723. any implicit <column reference>s in these clauses are replaced
  10724. by explicit <column reference>s when the clause is originally
  10725. evaluated. See the Syntax Rules of Subclause 7.10, "<query ex-
  10726. pression>".
  10727. 3) For every table privilege descriptor that specifies T and a
  10728. privilege of SELECT, UPDATE, INSERT or REFERENCES, a new col-
  10729. umn privilege descriptor is created that specifies T, the same
  10730. action, grantor, and grantee, and the same grantability, and
  10731. specifies the <column name> of the <column definition>.
  10732. 4) In all other respects, the specification of a <column defi-
  10733. nition> in an <alter table statement> has the same effect as
  10734. specification of the <column definition> in the <table defi-
  10735. nition> for T would have had. In particular, the degree of T
  10736. is increased by 1 and the ordinal position of that column is
  10737. equal to the new degree of T as specified in the General Rules
  10738. of Subclause 11.4, "<column definition>".
  10739. 284 Database Language SQL
  10740. X3H2-92-154/DBL CBR-002
  10741. 11.11 <add column definition>
  10742. Leveling Rules
  10743. 1) The following restrictions apply for Intermediate SQL:
  10744. None.
  10745. 2) The following restrictions apply for Entry SQL in addition to
  10746. any Intermediate SQL restrictions:
  10747. a) Conforming Entry SQL language shall not contain an <add col-
  10748. umn definition>.
  10749. Schema definition and manipulation 285
  10750. X3H2-92-154/DBL CBR-002
  10751. 11.12 <alter column definition>
  10752. 11.12 <alter column definition>
  10753. Function
  10754. Change a column and its definition.
  10755. Format
  10756. <alter column definition> ::=
  10757. ALTER [ COLUMN ] <column name> <alter column action>
  10758. <alter column action> ::=
  10759. <set column default clause>
  10760. | <drop column default clause>
  10761. Syntax Rules
  10762. 1) Let T be the table identified in the containing <alter table
  10763. statement>.
  10764. 2) Let C be the column identified by the <column name>.
  10765. 3) C shall be a column of T.
  10766. Access Rules
  10767. None.
  10768. General Rules
  10769. 1) The column descriptor of C is modified as specified by <alter
  10770. column action>.
  10771. Leveling Rules
  10772. 1) The following restrictions apply for Intermediate SQL:
  10773. None.
  10774. 2) The following restrictions apply for Entry SQL in addition to
  10775. any Intermediate SQL restrictions:
  10776. a) Conforming Entry SQL language shall not contain an <alter
  10777. column definition>.
  10778. 286 Database Language SQL
  10779. X3H2-92-154/DBL CBR-002
  10780. 11.13 <set column default clause>
  10781. 11.13 <set column default clause>
  10782. Function
  10783. Set the default clause for a column.
  10784. Format
  10785. <set column default clause> ::=
  10786. SET <default clause>
  10787. Syntax Rules
  10788. None.
  10789. Access Rules
  10790. None.
  10791. General Rules
  10792. 1) Let C be the column identified by the <column name> in the con-
  10793. taining <alter column definition>.
  10794. 2) The default value specified by the <default clause> is placed in
  10795. the column descriptor of C.
  10796. Leveling Rules
  10797. 1) The following restrictions apply for Intermediate SQL:
  10798. None.
  10799. 2) The following restrictions apply for Entry SQL in addition to
  10800. any Intermediate SQL restrictions:
  10801. a) Conforming Entry SQL language shall not contain a <set column
  10802. default clause>.
  10803. Schema definition and manipulation 287
  10804. X3H2-92-154/DBL CBR-002
  10805. 11.14 <drop column default clause>
  10806. 11.14 <drop column default clause>
  10807. Function
  10808. Drop the default clause from a column.
  10809. Format
  10810. <drop column default clause> ::=
  10811. DROP DEFAULT
  10812. Syntax Rules
  10813. 1) Let C be the column identified by the <column name> in the con-
  10814. taining <alter column definition>.
  10815. 2) The descriptor of C shall include a default value.
  10816. Access Rules
  10817. None.
  10818. General Rules
  10819. 1) The default value is removed from the column descriptor of C.
  10820. Leveling Rules
  10821. 1) The following restrictions apply for Intermediate SQL:
  10822. None.
  10823. 2) The following restrictions apply for Entry SQL in addition to
  10824. any Intermediate SQL restrictions:
  10825. a) Conforming Entry SQL language shall not contain a <drop col-
  10826. umn default clause>.
  10827. 288 Database Language SQL
  10828. X3H2-92-154/DBL CBR-002
  10829. 11.15 <drop column definition>
  10830. 11.15 <drop column definition>
  10831. Function
  10832. Destroy a column.
  10833. Format
  10834. <drop column definition> ::=
  10835. DROP [ COLUMN ] <column name> <drop behavior>
  10836. Syntax Rules
  10837. 1) Let T be the table identified by the <table name> in the con-
  10838. taining <alter table statement> and let TN be the name of T.
  10839. 2) Let C be the column identified by the <column name> CN.
  10840. 3) C shall be a column of T and C shall not be the only column of
  10841. T.
  10842. 4) If RESTRICT is specified, then C shall not be referenced in
  10843. the <query expression> of any view descriptor or in the <search
  10844. condition> of any constraint descriptor other than a table con-
  10845. straint descriptor that contains references to no other column
  10846. and that is included in the table descriptor of T.
  10847. Note: A <drop column definition> that does not specify CASCADE
  10848. will fail if there are any references to that column resulting
  10849. from the use of CORRESPONDING, NATURAL, SELECT * (except where
  10850. contained in an exists predicate>), or REFERENCES without a
  10851. <reference column list> in its <referenced table and columns>.
  10852. Note: If CASCADE is specified, then any such dependent object
  10853. will be dropped by the execution of the <revoke statement> spec-
  10854. ified in the General Rules of this Subclause.
  10855. Access Rules
  10856. None.
  10857. General Rules
  10858. 1) Let A be the current <authorization identifier>. The following
  10859. <revoke statement> is effectively executed with a current <au-
  10860. thorization identifier> of "_SYSTEM" and without further Access
  10861. Rule checking:
  10862. REVOKE INSERT(CN), UPDATE(CN), REFERENCES(CN) ON TABLE TN
  10863. FROM A CASCADE
  10864. Schema definition and manipulation 289
  10865. X3H2-92-154/DBL CBR-002
  10866. 11.15 <drop column definition>
  10867. 2) Let VN be the name of any view that contains a reference to
  10868. column C of table T. The following <drop view statement> is
  10869. effectively executed with a current <authorization identifier>
  10870. of "_SYSTEM" and without further Access Rule checking:
  10871. DROP VIEW VN CASCADE
  10872. 3) If the column is not based on a domain, then its data type de-
  10873. scriptor is destroyed.
  10874. 4) The data associated with C is destroyed and the descriptor of C
  10875. is removed from the descriptor of T.
  10876. 5) The identified column and its descriptor are destroyed.
  10877. 6) The degree of T is reduced by 1. The ordinal position of all
  10878. columns having an ordinal position greater than the ordinal
  10879. position of C is reduced by 1.
  10880. Leveling Rules
  10881. 1) The following restrictions apply for Intermediate SQL:
  10882. None.
  10883. 2) The following restrictions apply for Entry SQL in addition to
  10884. any Intermediate SQL restrictions:
  10885. a) Conforming Entry SQL language shall not contain a <drop col-
  10886. umn definition>.
  10887. 290 Database Language SQL
  10888. X3H2-92-154/DBL CBR-002
  10889. 11.16 <add table constraint definition>
  10890. 11.16 <add table constraint definition>
  10891. Function
  10892. Add a constraint to a table.
  10893. Format
  10894. <add table constraint definition> ::=
  10895. ADD <table constraint definition>
  10896. Syntax Rules
  10897. None.
  10898. Access Rules
  10899. None.
  10900. General Rules
  10901. 1) Let T be the table identified by the <table name> in the con-
  10902. taining <alter table statement>.
  10903. 2) The table constraint descriptor for the <table constraint defi-
  10904. nition> is included in the table descriptor for T.
  10905. Leveling Rules
  10906. 1) The following restrictions apply for Intermediate SQL:
  10907. None.
  10908. 2) The following restrictions apply for Entry SQL in addition to
  10909. any Intermediate SQL restrictions:
  10910. a) Conforming Entry SQL language shall not contain an <add table
  10911. constraint definition>.
  10912. Schema definition and manipulation 291
  10913. X3H2-92-154/DBL CBR-002
  10914. 11.17 <drop table constraint definition>
  10915. 11.17 <drop table constraint definition>
  10916. Function
  10917. Destroy a constraint on a table.
  10918. Format
  10919. <drop table constraint definition> ::=
  10920. DROP CONSTRAINT <constraint name> <drop behavior>
  10921. Syntax Rules
  10922. 1) Let T be the table identified by the <table name> in the con-
  10923. taining <alter table statement>. The schema identified by the
  10924. explicit or implicit schema name of the <table name> shall in-
  10925. clude the descriptor of T.
  10926. 2) The <constraint name> shall identify a table constraint TC of T.
  10927. 3) If TC is a unique constraint and there exists a referential
  10928. constraint RC whose referenced table is T and whose referenced
  10929. columns are the unique columns of TC, then RC is said to be
  10930. dependent on TC.
  10931. 4) If RESTRICT is specified, then no table constraint shall be
  10932. dependent on TC.
  10933. Note: If CASCADE is specified, then any such dependent object
  10934. will be dropped by the effective execution of the <alter table
  10935. statement> specified in the General Rules of this Subclause.
  10936. Access Rules
  10937. None.
  10938. General Rules
  10939. 1) Let TCN2 be the <constraint name> of any table constraint that
  10940. is dependent on TC and let T2 be the <table name> of the ta-
  10941. ble descriptor that includes TCN2. The following <alter table
  10942. statement> is effectively executed without further Access Rule
  10943. checking:
  10944. ALTER TABLE T2 DROP CONSTRAINT TCN2 CASCADE
  10945. 2) The descriptor of TC is removed from the descriptor of T.
  10946. 3) The identified table constraint and its descriptor are de-
  10947. stroyed.
  10948. 292 Database Language SQL
  10949. X3H2-92-154/DBL CBR-002
  10950. 11.17 <drop table constraint definition>
  10951. Leveling Rules
  10952. 1) The following restrictions apply for Intermediate SQL:
  10953. None.
  10954. 2) The following restrictions apply for Entry SQL in addition to
  10955. any Intermediate SQL restrictions:
  10956. a) Conforming Entry SQL language shall not contain a <drop table
  10957. constraint definition>.
  10958. Schema definition and manipulation 293
  10959. X3H2-92-154/DBL CBR-002
  10960. 11.18 <drop table statement>
  10961. 11.18 <drop table statement>
  10962. Function
  10963. Destroy a table.
  10964. Format
  10965. <drop table statement> ::=
  10966. DROP TABLE <table name> <drop behavior>
  10967. Syntax Rules
  10968. 1) Let T be the table identified by the <table name> and let TN
  10969. be that <table name>. The schema identified by the explicit or
  10970. implicit schema name of TN shall include the descriptor of T.
  10971. 2) T shall be a base table.
  10972. 3) T shall not be a declared local temporary table.
  10973. 4) If RESTRICT is specified, then T shall not be referenced in
  10974. the <query expression> of any view descriptor or the <search
  10975. condition> of any constraint descriptor.
  10976. Note: If CASCADE is specified, then such referencing objects
  10977. will be dropped by the execution of the <revoke statement> spec-
  10978. ified in the General Rules of this Subclause.
  10979. Access Rules
  10980. 1) The current <authorization identifier> shall be equal to the
  10981. <authorization identifier> that owns the schema identified by
  10982. the <schema name> of the table identified by TN.
  10983. General Rules
  10984. 1) Let A be the current <authorization identifier>. The following
  10985. <revoke statement> is effectively executed with a current <au-
  10986. thorization identifier> of "_SYSTEM" and without further Access
  10987. Rule checking:
  10988. REVOKE ALL PRIVILEGES ON TN FROM A CASCADE
  10989. 2) The identified base table and its descriptor are destroyed.
  10990. Leveling Rules
  10991. 1) The following restrictions apply for Intermediate SQL:
  10992. None.
  10993. 294 Database Language SQL
  10994. X3H2-92-154/DBL CBR-002
  10995. 11.18 <drop table statement>
  10996. 2) The following restrictions apply for Entry SQL in addition to
  10997. any Intermediate SQL restrictions:
  10998. a) Conforming Entry SQL language shall not contain any <drop
  10999. table statement>.
  11000. Schema definition and manipulation 295
  11001. X3H2-92-154/DBL CBR-002
  11002. 11.19 <view definition>
  11003. 11.19 <view definition>
  11004. Function
  11005. Define a viewed table.
  11006. Format
  11007. <view definition> ::=
  11008. CREATE VIEW <table name> [ <left paren> <view column list>
  11009. <right paren> ]
  11010. AS <query expression>
  11011. [ WITH [ <levels clause> ] CHECK OPTION ]
  11012. <levels clause> ::=
  11013. CASCADED | LOCAL
  11014. <view column list> ::= <column name list>
  11015. Syntax Rules
  11016. 1) The <query expression> shall not contain a <target specifica-
  11017. tion> or a <dynamic parameter specification>.
  11018. 2) If a <view definition> is contained in a <schema definition>
  11019. and the <table name> contains a <schema name>, then that <schema
  11020. name> shall be the same as the specified or implicit <schema
  11021. name> of the containing <schema definition>.
  11022. 3) The schema identified by the explicit or implicit schema name
  11023. of the <table name> shall not include a table descriptor whose
  11024. table name is <table name>.
  11025. 4) The viewed table defined by <view definition> shall not be
  11026. identified by any <table reference> generally contained in the
  11027. <query expression>.
  11028. 5) Any <table name> that is specified in the <query expression>
  11029. shall be different from the <table name> of any <temporary table
  11030. declaration>.
  11031. 6) If the <query expression> is updatable, then the viewed table is
  11032. an updatable table. Otherwise, it is a read-only table.
  11033. 7) If the <query expression> is a <query specification> that con-
  11034. tains a <group by clause> or a <having clause> that is not con-
  11035. tained in a <subquery>, then the viewed table defined by the
  11036. <view definition> is a grouped view.
  11037. 8) If any two columns in the table specified by the <query ex-
  11038. pression> have the same <column name>, or if any column of that
  11039. table has an implementation-dependent name, then a <view column
  11040. list> shall be specified.
  11041. 296 Database Language SQL
  11042. X3H2-92-154/DBL CBR-002
  11043. 11.19 <view definition>
  11044. 9) The same <column name> shall not be specified more than once in
  11045. the <view column list>.
  11046. 10)The number of <column name>s in the <view column list> shall
  11047. be the same as the degree of the table specified by the <query
  11048. expression>.
  11049. 11)No column in the table specified by <query expression> shall
  11050. have a coercibility attribute of No collating sequence.
  11051. Note: The coercibility attribute is described in Subclause 4.2.3,
  11052. "Rules determining collating sequence usage".
  11053. Note: The coercibility attribute for references to the column is
  11054. defined in Subclause 6.4, "<column reference>".
  11055. 12)If WITH CHECK OPTION is specified, then the viewed table shall
  11056. be updatable.
  11057. 13)If WITH CHECK OPTION is specified with no <levels clause>, then
  11058. a <levels clause> of CASCADED is implicit.
  11059. 14)Let V be the view defined by the <view definition>. The un-
  11060. derlying columns of every i-th column of V are the underlying
  11061. columns of the i-th column of the <query expression> and the
  11062. underlying columns of V are the underlying columns of the <query
  11063. expression>.
  11064. Access Rules
  11065. 1) If a <view definition> is contained in a <module>, then the
  11066. current <authorization identifier> shall be equal to the <au-
  11067. thorization identifier> that owns the schema identified by the
  11068. implicit or explicit <schema name> of the <table name>.
  11069. General Rules
  11070. 1) A view descriptor VD is created that describes V. The view de-
  11071. scriptor includes the <table name>, the <query expression>,
  11072. column descriptors taken from the table specified by the <query
  11073. expression>, and an indication of whether WITH CHECK OPTION was
  11074. specified. If a <view column list> is specified, then the <col-
  11075. umn name> of the i-th column of the view is the i-th <column
  11076. name> in that <view column list>. Otherwise, the <column name>s
  11077. of the view are the <column name>s of the table specified by the
  11078. <query expression>.
  11079. 2) Let VN be the <table name>. Let QE be the <query expression>.
  11080. If a <view column list> is specified, then let VCL be the <view
  11081. column list> preceded by a <left paren> and followed by a <right
  11082. paren>; otherwise, let VCL be the empty string.
  11083. Case:
  11084. a) When VN is immediately contained in some SQL-schema state-
  11085. ment, it identifies the view descriptor VD.
  11086. Schema definition and manipulation 297
  11087. X3H2-92-154/DBL CBR-002
  11088. 11.19 <view definition>
  11089. b) Otherwise, VN references the same table as the <table refer-
  11090. ence>:
  11091. ( QE ) AS VN VCL
  11092. 3) Let A be the <authorization identifier> that owns V.
  11093. 4) A set of privilege descriptors is created that defines the priv-
  11094. ilege SELECT on this table to A and SELECT for each column of
  11095. V to A. This privilege is grantable if and only if the appli-
  11096. cable SELECT privileges on all <table name>s contained in the
  11097. <query expression> are grantable. The grantor of this privilege
  11098. descriptor is set to the special grantor value "_SYSTEM".
  11099. 5) If V is updatable, then let T be the leaf underlying table of
  11100. the <query expression>.
  11101. 6) For i ranging from 1 to the number of distinct leaf underlying
  11102. tables of the <query expression> of V, let RTi be the <table
  11103. name>s of those tables. For every column CV of V:
  11104. a) Let CRij, for j ranging from 1 to the number of columns of
  11105. RTi that are underlying columns of CV, be the <column name>s
  11106. of those columns.
  11107. b) If A has REFERENCES(CRij) for all i and for all j, and A has
  11108. REFERENCES on some column of RTi for all i, then a privilege
  11109. descriptor is created that defines the privilege REFERENCES
  11110. (CV) on V to A. That privilege is grantable if and only if
  11111. the REFERENCES privileges on all of the columns CRTij are
  11112. grantable. The grantor of that privilege descriptor is set to
  11113. the special grantor value "_SYSTEM".
  11114. 7) If V is updatable, then:
  11115. a) A set of privilege descriptors is created that defines the
  11116. privileges INSERT, UPDATE, and DELETE on V that are appli-
  11117. cable privileges on T to A. A privilege on V is grantable if
  11118. and only if the corresponding privilege on T is grantable.
  11119. b) For every column in V:
  11120. i) There is a corresponding column in T from which the column
  11121. of V is derived. Let CV and CT be the <column name>s of the
  11122. corresponding columns of V and T respectively.
  11123. ii) A set of privilege descriptors is created that defines
  11124. the privileges INSERT(CV) and UPDATE(CV) on V, where the
  11125. privileges INSERT(CT) and UPDATE(CT) on T are the appli-
  11126. cable privileges to A, respectively. A privilege on V is
  11127. grantable if and only if the corresponding privilege on T
  11128. is grantable.
  11129. The grantor of these privilege descriptors is set to the
  11130. special grantor value "_SYSTEM".
  11131. 298 Database Language SQL
  11132. X3H2-92-154/DBL CBR-002
  11133. 11.19 <view definition>
  11134. 8) If V is updatable, then let TLEAF be the leaf generally under-
  11135. lying table of V. For every row in V there is a corresponding
  11136. row in TLEAF from which the row of V is derived and for each
  11137. column in V there is a corresponding column in TLEAF from which
  11138. the column of V is derived. The insertion of a row into V is
  11139. an insertion of a corresponding row into TLEAF. The deletion of
  11140. a row from V is a deletion of the corresponding row in TLEAF.
  11141. The updating of a column of a row in V is an updating of the
  11142. corresponding column of the corresponding row in TLEAF.
  11143. 9) Let V1 be a view. V1 spans V1. V1 spans a view V2 if V2 is a
  11144. generally underlying table of V1.
  11145. 10)An update operation is an <insert statement>, <update state-
  11146. ment: positioned>, <update statement: searched>, <dynamic update
  11147. statement: positioned>, or <preparable dynamic update state-
  11148. ment: positioned>. An update operation on a view V is an update
  11149. operation whose <table name> identifies V.
  11150. 11)If a view V1 spans a view VA described by a view descriptor that
  11151. includes WITH CHECK OPTION and an update operation on V1 would
  11152. result in a row that would not appear in the result of VA, then
  11153. a) If the view descriptor of VA includes CASCADED, then an ex-
  11154. ception condition is raised: with check option violation.
  11155. b) If the view descriptor of VA includes LOCAL and the update
  11156. operation would result in a row that would appear in the
  11157. simply underlying table of the simply underlying table of
  11158. the <query expression> contained in VA, then an exception
  11159. condition is raised: with check option violation.
  11160. 12)Validation of a WITH CHECK OPTION constraint is effectively
  11161. performed at the end of each update operation.
  11162. 13)If the character representation of the <query expression> cannot
  11163. be represented in the Information Schema without truncation,
  11164. then a completion condition is raised: warning-query expression
  11165. too long for information schema.
  11166. Leveling Rules
  11167. 1) The following restrictions apply for Intermediate SQL:
  11168. a) Conforming Intermediate SQL language shall not contain any
  11169. <levels clause>, but the effect shall be that defined for a
  11170. <levels clause> of CASCADED.
  11171. 2) The following restrictions apply for Entry SQL in addition to
  11172. any Intermediate SQL restrictions:
  11173. a) The <query expression> in a <view definition> shall be a
  11174. <query specification>.
  11175. Schema definition and manipulation 299
  11176. X3H2-92-154/DBL CBR-002
  11177. 11.20 <drop view statement>
  11178. 11.20 <drop view statement>
  11179. Function
  11180. Destroy a view.
  11181. Format
  11182. <drop view statement> ::=
  11183. DROP VIEW <table name> <drop behavior>
  11184. Syntax Rules
  11185. 1) Let V be the table identified by the <table name> and let VN
  11186. be that <table name>. The schema identified by the explicit or
  11187. implicit schema name of VN shall include the descriptor of V.
  11188. 2) V shall be a viewed table.
  11189. 3) If RESTRICT is specified, then V shall not be referenced in
  11190. the <query expression> of any view descriptor or the <search
  11191. condition> of any assertion descriptor or constraint descriptor.
  11192. Note: If CASCADE is specified, then any such dependent object
  11193. will be dropped by the execution of the <revoke statement> spec-
  11194. ified in the General Rules of this Subclause.
  11195. Access Rules
  11196. 1) The current <authorization identifier> shall be equal to the
  11197. <authorization identifier> that owns the schema identified by
  11198. the <schema name> of the table identified by VN.
  11199. General Rules
  11200. 1) Let A be the current <authorization identifier>. The following
  11201. <revoke statement> is effectively executed with a current <au-
  11202. thorization identifier> of "_SYSTEM" and without further Access
  11203. Rule checking:
  11204. REVOKE ALL PRIVILEGES ON VN FROM A CASCADE
  11205. 2) The identified view and its descriptor are destroyed.
  11206. Leveling Rules
  11207. 1) The following restrictions apply for Intermediate SQL:
  11208. None.
  11209. 2) The following restrictions apply for Entry SQL in addition to
  11210. any Intermediate SQL restrictions:
  11211. a) Conforming Entry SQL language shall not contain a <drop view
  11212. statement>.
  11213. 300 Database Language SQL
  11214. X3H2-92-154/DBL CBR-002
  11215. 11.21 <domain definition>
  11216. 11.21 <domain definition>
  11217. Function
  11218. Define a domain.
  11219. Format
  11220. <domain definition> ::=
  11221. CREATE DOMAIN <domain name> [ AS ] <data type>
  11222. [ <default clause> ]
  11223. [ <domain constraint>... ]
  11224. [ <collate clause> ]
  11225. <domain constraint> ::=
  11226. [ <constraint name definition> ]
  11227. <check constraint definition> [ <constraint attributes> ]
  11228. Syntax Rules
  11229. 1) If a <domain definition> is contained in a <schema definition>,
  11230. and if the <domain name> contains a <schema name>, then that
  11231. <schema name> shall be the same as the specified or implicit
  11232. <schema name> of the containing <schema definition>. The schema
  11233. identified by the explicit or implicit schema name of the <do-
  11234. main name> shall not include a domain descriptor whose domain
  11235. name is <domain name>.
  11236. 2) If <data type> specifies CHARACTER or CHARACTER VARYING and does
  11237. not specify <character set specification>, then the character
  11238. set name of the default character set of the schema identified
  11239. by the implicit or explicit <schema name> of <domain name> is
  11240. implicit.
  11241. 3) If <data type> specifies a <character string type> that identi-
  11242. fies a character set that has a default collation and the <do-
  11243. main definition> does not directly contain a <collate clause>,
  11244. then the collation of the <character string type> is the im-
  11245. plicit collation of the domain.
  11246. 4) Let D1 be some domain. D1 is in usage by a domain constraint DC
  11247. if and only if the <search condition> of DC generally contains
  11248. the <domain name> either of D1 or of some domain D2 such that D1
  11249. is in usage by some domain constraint of D2. No domain shall be
  11250. in usage by any of its own constraints.
  11251. 5) If <collate clause> is specified, then <data type> shall be a
  11252. character string type.
  11253. 6) for every <domain constraint> is specified:
  11254. a) If <constraint attributes> is not specified, then INITIALLY
  11255. IMMEDIATE NOT DEFERRABLE is implicit.
  11256. Schema definition and manipulation 301
  11257. X3H2-92-154/DBL CBR-002
  11258. 11.21 <domain definition>
  11259. b) If <constraint name definition> is not specified, then a
  11260. <constraint name definition> that contains an implementation-
  11261. dependent <constraint name> is implicit. The assigned <con-
  11262. straint name> shall obey the Syntax Rules of an explicit
  11263. <constraint name>.
  11264. Access Rules
  11265. 1) If a <domain definition> is contained in a <module>, then the
  11266. current <authorization identifier> shall be equal to the <au-
  11267. thorization identifier> that owns the schema identified by the
  11268. implicit or explicit <schema name> of the <domain name>.
  11269. General Rules
  11270. 1) A <domain definition> defines a domain.
  11271. Note: Subclause 10.6, "<constraint name definition> and <con-
  11272. straint attributes>", specifies when a constraint is effectively
  11273. checked.
  11274. 2) A data type descriptor is created that describes the data type
  11275. of the domain being created.
  11276. 3) A domain descriptor is created that describes the domain being
  11277. created. The domain descriptor contains the name of the domain,
  11278. the data type descriptor of the data type, the <collation name>
  11279. of the <collate clause> if the <domain definition> contains
  11280. a <collate clause>, the value of the <default clause> if the
  11281. <domain definition> immediately contains <default clause>, and
  11282. a domain constraint descriptor for every immediately contained
  11283. <domain constraint>.
  11284. 4) A privilege descriptor is created that defines the USAGE priv-
  11285. ilege on this domain to the <authorization identifier> of the
  11286. <schema> or <module> in which the <domain definition> appears.
  11287. This privilege is grantable if and only if the applicable privi-
  11288. leges include a grantable REFERENCES privilege for each <column
  11289. reference> included in the domain descriptor and a grantable
  11290. USAGE privilege for each <domain name>, <collation name>, <char-
  11291. acter set name>, and <translation name> contained in the <search
  11292. condition> of any domain constraint descriptor included in the
  11293. domain descriptor, and a grantable USAGE privilege for the <col-
  11294. lation name> contained in the <collate clause> included in the
  11295. domain descriptor. The grantor of the privilege descriptor is
  11296. set to the special grantor value "_SYSTEM".
  11297. 5) Let DSC be the <search condition> included in some domain con-
  11298. straint descriptor DCD. Let D be the name of the domain whose
  11299. descriptor includes DCD. Let T be the name of some table whose
  11300. descriptor includes some column descriptor with column name C
  11301. whose domain name is D. Let CSC be a copy of DSC in which every
  11302. instance of the <general value specification> VALUE is replaced
  11303. by C.
  11304. 302 Database Language SQL
  11305. X3H2-92-154/DBL CBR-002
  11306. 11.21 <domain definition>
  11307. 6) The domain constraint specified by DCD for C is not satisfied if
  11308. and only if
  11309. EXISTS ( SELECT * FROM T WHERE NOT ( CSC ) )
  11310. is true.
  11311. Leveling Rules
  11312. 1) The following restrictions apply for Intermediate SQL:
  11313. a) Conforming Intermediate SQL language shall not contain any
  11314. <collate clause>.
  11315. 2) The following restrictions apply for Entry SQL in addition to
  11316. any Intermediate SQL restrictions:
  11317. a) Conforming Entry SQL language shall not contain any <domain
  11318. definition>.
  11319. Schema definition and manipulation 303
  11320. X3H2-92-154/DBL CBR-002
  11321. 11.22 <alter domain statement>
  11322. 11.22 <alter domain statement>
  11323. Function
  11324. Change a domain and its definition.
  11325. Format
  11326. <alter domain statement> ::=
  11327. ALTER DOMAIN <domain name> <alter domain action>
  11328. <alter domain action> ::=
  11329. <set domain default clause>
  11330. | <drop domain default clause>
  11331. | <add domain constraint definition>
  11332. | <drop domain constraint definition>
  11333. Syntax Rules
  11334. 1) Let D be the domain identified by <domain name>. The schema
  11335. identified by the explicit or implicit schema name of the <do-
  11336. main name> shall include the descriptor of D.
  11337. Access Rules
  11338. 1) The current <authorization identifier> shall be equal to the
  11339. <authorization identifier> that owns the schema identified by
  11340. the implicit or explicit <schema name> of <domain name>.
  11341. General Rules
  11342. 1) The domain descriptor of D is modified as specified by <alter
  11343. domain action>.
  11344. Note: The changed domain descriptor of D is applicable to every
  11345. column that is dependent on D.
  11346. Leveling Rules
  11347. 1) The following restrictions apply for Intermediate SQL:
  11348. a) Conforming Intermediate SQL language shall contain no <alter
  11349. domain statement>.
  11350. 2) The following restrictions apply for Entry SQL in addition to
  11351. any Intermediate SQL restrictions:
  11352. None.
  11353. 304 Database Language SQL
  11354. X3H2-92-154/DBL CBR-002
  11355. 11.23 <set domain default clause>
  11356. 11.23 <set domain default clause>
  11357. Function
  11358. Set the default value in a domain.
  11359. Format
  11360. <set domain default clause> ::= SET <default clause>
  11361. Syntax Rules
  11362. None.
  11363. Access Rules
  11364. None.
  11365. General Rules
  11366. 1) Let D be the domain identified by the <domain name> in the con-
  11367. taining <alter domain statement>.
  11368. 2) The default value specified by the <default clause> is placed in
  11369. the domain descriptor of D.
  11370. Leveling Rules
  11371. 1) The following restrictions apply for Intermediate SQL:
  11372. a) Conforming Intermediate SQL language shall contain no <set
  11373. domain default clause>.
  11374. 2) The following restrictions apply for Entry SQL in addition to
  11375. any Intermediate SQL restrictions:
  11376. None.
  11377. Schema definition and manipulation 305
  11378. X3H2-92-154/DBL CBR-002
  11379. 11.24 <drop domain default clause>
  11380. 11.24 <drop domain default clause>
  11381. Function
  11382. Remove the default clause of a domain.
  11383. Format
  11384. <drop domain default clause> ::= DROP DEFAULT
  11385. Syntax Rules
  11386. 1) Let D be the domain identified by the <domain name> in the con-
  11387. taining <alter domain statement>.
  11388. 2) The descriptor of D shall contain a default value.
  11389. Access Rules
  11390. None.
  11391. General Rules
  11392. 1) Let C be the set of columns whose column descriptors contain the
  11393. domain descriptor of D.
  11394. 2) For every column belonging to C, if the column descriptor does
  11395. not already contain a default value, then the default value from
  11396. the domain descriptor of D is placed in that column descriptor.
  11397. 3) The default value is removed from the domain descriptor of D.
  11398. Leveling Rules
  11399. 1) The following restrictions apply for Intermediate SQL:
  11400. a) Conforming Intermediate SQL language shall contain no <drop
  11401. domain default clause>.
  11402. 2) The following restrictions apply for Entry SQL in addition to
  11403. any Intermediate SQL restrictions:
  11404. None.
  11405. 306 Database Language SQL
  11406. X3H2-92-154/DBL CBR-002
  11407. 11.25 <add domain constraint definition>
  11408. 11.25 <add domain constraint definition>
  11409. Function
  11410. Add a constraint to a domain.
  11411. Format
  11412. <add domain constraint definition> ::=
  11413. ADD <domain constraint>
  11414. Syntax Rules
  11415. 1) Let D be the domain identified by the <domain name> in the con-
  11416. taining <alter domain statement>.
  11417. 2) Let D1 be some domain. D1 is in usage by a domain constraint DC
  11418. if and only if the <search condition> of DC generally contains
  11419. the <domain name> either of D1 or of some domain D2 such that D1
  11420. is in usage by some domain constraint of D2. No domain shall be
  11421. in usage by any of its own constraints.
  11422. Access Rules
  11423. None.
  11424. General Rules
  11425. 1) The constraint descriptor of the <domain constraint> is added to
  11426. the domain descriptor of D.
  11427. Leveling Rules
  11428. 1) The following restrictions apply for Intermediate SQL:
  11429. a) Conforming Intermediate SQL language shall contain no <add
  11430. domain constraint definition>.
  11431. 2) The following restrictions apply for Entry SQL in addition to
  11432. any Intermediate SQL restrictions:
  11433. None.
  11434. Schema definition and manipulation 307
  11435. X3H2-92-154/DBL CBR-002
  11436. 11.26 <drop domain constraint definition>
  11437. 11.26 <drop domain constraint definition>
  11438. Function
  11439. Destroy a constraint on a domain.
  11440. Format
  11441. <drop domain constraint definition> ::=
  11442. DROP CONSTRAINT <constraint name>
  11443. Syntax Rules
  11444. 1) Let D be the domain identified by the <domain name> in the con-
  11445. taining <alter domain statement>.
  11446. 2) Let DC be the descriptor of the constraint identified by <con-
  11447. straint name>.
  11448. 3) DC shall be included in the domain descriptor of D.
  11449. Access Rules
  11450. None.
  11451. General Rules
  11452. 1) The constraint descriptor of DC is removed from the domain de-
  11453. scriptor of D.
  11454. 2) The constraint DC and its descriptor are destroyed.
  11455. Leveling Rules
  11456. 1) The following restrictions apply for Intermediate SQL:
  11457. a) Conforming Intermediate SQL language shall contain no <drop
  11458. domain constraint definition>.
  11459. 2) The following restrictions apply for Entry SQL in addition to
  11460. any Intermediate SQL restrictions:
  11461. None.
  11462. 308 Database Language SQL
  11463. X3H2-92-154/DBL CBR-002
  11464. 11.27 <drop domain statement>
  11465. 11.27 <drop domain statement>
  11466. Function
  11467. Destroy a domain.
  11468. Format
  11469. <drop domain statement> ::=
  11470. DROP DOMAIN <domain name> <drop behavior>
  11471. Syntax Rules
  11472. 1) Let D be the domain identified by <domain name> and let DN be
  11473. that <domain name>. The schema identified by the explicit or
  11474. implicit schema name of DN shall include the descriptor of D.
  11475. 2) If RESTRICT is specified, then D shall not be referenced by
  11476. any column descriptor, in the <query expression> of any view
  11477. descriptor, or in the <search condition> of any constraint de-
  11478. scriptor.
  11479. Access Rules
  11480. 1) The current <authorization identifier> shall be equal to the
  11481. <authorization identifier> that owns the schema identified by
  11482. the <schema name> of the domain identified by DN. Let UA be the
  11483. <authorization identifier> of the current SQL-session.
  11484. General Rules
  11485. 1) Let C be any column descriptor that includes DN, let T be the
  11486. table described by the table descriptor that includes C, and let
  11487. TN be the column name of T. C is modified as follows:
  11488. a) DN is removed from C. A copy of the data type descriptor of D
  11489. is included in C.
  11490. b) If C does not include a <default clause> and the domain de-
  11491. scriptor of D includes a <default clause>, then a copy of the
  11492. <default clause> of D is included in C.
  11493. c) For every domain constraint descriptor included in the domain
  11494. descriptor of D:
  11495. i) Let TCD be a <table constraint definition> consisting of
  11496. a <constraint name definition> whose <constraint name>
  11497. is implementation-dependent, whose <table constraint> is
  11498. derived from the <check constraint definition> of the do-
  11499. main constraint descriptor by replacing every instance of
  11500. VALUE by the <column name> of C, and whose <constraint at-
  11501. tributes> are the <constraint attributes> of the domain
  11502. constraint descriptor.
  11503. Schema definition and manipulation 309
  11504. X3H2-92-154/DBL CBR-002
  11505. 11.27 <drop domain statement>
  11506. ii) If the applicable privileges of UA include all of the priv-
  11507. ileges necessary for UA to successfully execute the <add
  11508. table constraint definition>
  11509. ALTER TABLE TN ADD TCD
  11510. then the following <table constraint definition> is effec-
  11511. tively executed with a current <authorization identifier>
  11512. of UA:
  11513. ALTER TABLE TN ADD TCD
  11514. d) If C does not include a collation and the <domain definition>
  11515. of D includes a collation, then
  11516. i) Let CCN be the <collation name> of the collation.
  11517. ii) If the applicable privileges for UA contain USAGE on CCN,
  11518. then CCN is added to C as the <collation name>.
  11519. 2) Let A be the current <authorization identifier>. The following
  11520. <revoke statement> is effectively executed with a current <au-
  11521. thorization identifier> of "_SYSTEM" and without further Access
  11522. Rule checking:
  11523. REVOKE USAGE ON DOMAIN DN FROM A CASCADE
  11524. 3) The identified domain is destroyed by destroying its descriptor
  11525. and its data type descriptor.
  11526. Leveling Rules
  11527. 1) The following restrictions apply for Intermediate SQL:
  11528. None.
  11529. 2) The following restrictions apply for Entry SQL in addition to
  11530. any Intermediate SQL restrictions:
  11531. a) Conforming Entry SQL language shall not contain a <drop do-
  11532. main statement>.
  11533. 310 Database Language SQL
  11534. X3H2-92-154/DBL CBR-002
  11535. 11.28 <character set definition>
  11536. 11.28 <character set definition>
  11537. Function
  11538. Define a character set.
  11539. Format
  11540. <character set definition> ::=
  11541. CREATE CHARACTER SET <character set name> [ AS ]
  11542. <character set source>
  11543. [ <collate clause> | <limited collation definition> ]
  11544. <character set source> ::=
  11545. GET <existing character set name>
  11546. <existing character set name> ::=
  11547. <standard character repertoire name>
  11548. | <implementation-defined character repertoire name>
  11549. | <schema character set name>
  11550. <schema character set name> ::= <character set name>
  11551. <limited collation definition> ::=
  11552. COLLATION FROM <collation source>
  11553. Syntax Rules
  11554. 1) If a <character set definition> is contained in a <schema def-
  11555. inition> and if the <character set name> immediately contained
  11556. in the <character set definition> contains a <schema name>,
  11557. then that <schema name> shall be the same as the specified or
  11558. implicit <schema name> of the <schema definition>.
  11559. 2) The schema identified by the explicit or implicit schema name
  11560. of the <character set name> shall not include a character set
  11561. descriptor whose character set name is <character set name>.
  11562. 3) A <schema character set name> shall identify some character set
  11563. descriptor.
  11564. 4) If neither <collate clause> nor <limited collation definition>
  11565. is specified, then the following <limited collation definition>
  11566. is implicit:
  11567. COLLATION FROM DEFAULT
  11568. Schema definition and manipulation 311
  11569. X3H2-92-154/DBL CBR-002
  11570. 11.28 <character set definition>
  11571. Access Rules
  11572. 1) If a <character set definition> is contained in a <module>, then
  11573. the current <authorization identifier> shall be equal to the
  11574. <authorization identifier> that owns the schema identified by
  11575. the implicit or explicit <schema name> of the <character set
  11576. name>.
  11577. 2) The applicable privileges for the <existing character set name>
  11578. shall include USAGE.
  11579. General Rules
  11580. 1) A <character set definition> defines a character set.
  11581. 2) A character set descriptor is created for the defined character
  11582. set.
  11583. 3) The character set has the same character repertoire as the char-
  11584. acter set identified by the <existing character set name>.
  11585. 4) A privilege descriptor is created that defines the USAGE privi-
  11586. lege on this character set to the <authorization identifier> of
  11587. the schema or <module> in which the <character set definition>
  11588. appears. The grantor of the privilege descriptor is set to the
  11589. special grantor value "_SYSTEM". This privilege is grantable.
  11590. Leveling Rules
  11591. 1) The following restrictions apply for Intermediate SQL:
  11592. a) In conforming Intermediate SQL language, <collation source>
  11593. shall specify DEFAULT.
  11594. 2) The following restrictions apply for Entry SQL in addition to
  11595. any Intermediate SQL restrictions:
  11596. a) Conforming Entry SQL language shall not specify a <character
  11597. set definition>.
  11598. 312 Database Language SQL
  11599. X3H2-92-154/DBL CBR-002
  11600. 11.29 <drop character set statement>
  11601. 11.29 <drop character set statement>
  11602. Function
  11603. Destroy a character set.
  11604. Format
  11605. <drop character set statement> ::=
  11606. DROP CHARACTER SET <character set name>
  11607. Syntax Rules
  11608. 1) Let C be the character set identified by the <character set
  11609. name> and let CN be the name of C.
  11610. 2) The schema identified by the explicit or implicit schema name of
  11611. CN shall include the descriptor of C.
  11612. 3) C shall not be referenced in the <query expression> of any view
  11613. descriptor or in the <search condition> of any constraint de-
  11614. scriptor, or be included in any collation descriptor or transla-
  11615. tion descriptor.
  11616. Access Rules
  11617. 1) The current <authorization identifier> shall be equal to the
  11618. <authorization identifier> that owns the schema identified by
  11619. the <schema name> of the character set identified by C.
  11620. General Rules
  11621. 1) Let A be the current <authorization identifier>. The following
  11622. <revoke statement> is effectively executed with a current <au-
  11623. thorization identifier> of "_SYSTEM" and without further Access
  11624. Rule checking:
  11625. REVOKE USAGE ON CHARACTER SET CN FROM A CASCADE
  11626. 2) The descriptor of C is destroyed.
  11627. Leveling Rules
  11628. 1) The following restrictions apply for Intermediate SQL:
  11629. None.
  11630. 2) The following restrictions apply for Entry SQL in addition to
  11631. any Intermediate SQL restrictions:
  11632. a) Conforming Entry SQL language shall contain no <drop charac-
  11633. ter set statement>.
  11634. Schema definition and manipulation 313
  11635. X3H2-92-154/DBL CBR-002
  11636. 11.30 <collation definition>
  11637. 11.30 <collation definition>
  11638. Function
  11639. Define a collating sequence.
  11640. Format
  11641. <collation definition> ::=
  11642. CREATE COLLATION <collation name> FOR <character set specification>
  11643. FROM <collation source>
  11644. [ <pad attribute> ]
  11645. <pad attribute> ::=
  11646. NO PAD
  11647. | PAD SPACE
  11648. <collation source> ::=
  11649. <collating sequence definition>
  11650. | <translation collation>
  11651. <collating sequence definition> ::=
  11652. <external collation>
  11653. | <schema collation name>
  11654. | DESC <left paren> <collation name> <right paren>
  11655. | DEFAULT
  11656. <translation collation> ::=
  11657. TRANSLATION <translation name>
  11658. [ THEN COLLATION <collation name> ]
  11659. <external collation> ::=
  11660. EXTERNAL <left paren> <quote> <external collation name> <quote> <right paren>
  11661. <schema collation name> ::= <collation name>
  11662. <external collation name> ::=
  11663. <standard collation name>
  11664. | <implementation-defined collation name>
  11665. <standard collation name> ::= <collation name>
  11666. <implementation-defined collation name> ::= <collation name>
  11667. 314 Database Language SQL
  11668. X3H2-92-154/DBL CBR-002
  11669. 11.30 <collation definition>
  11670. Syntax Rules
  11671. 1) If a <collation definition> is contained in a <schema defi-
  11672. nition> and if the <collation name> immediately contained in
  11673. the <collation definition> contains a <schema name>, then that
  11674. <schema name> shall be the same as the specified or implicit
  11675. <schema name> of the <schema definition>.
  11676. 2) The schema identified by the explicit or implicit schema name
  11677. of the <collation name> shall not include a collation descriptor
  11678. whose collation name is <collation name>.
  11679. 3) A <standard collation name> shall be the name of a colla-
  11680. tion defined by a national or international standard. An
  11681. <implementation-defined collation name> shall be the name of
  11682. a collation that is implementation-defined.
  11683. 4) The <standard collation name>s and <implementation-defined col-
  11684. lation name>s that are supported are implementation-defined.
  11685. Each collation identified by a <standard collation name> or by
  11686. a <implementation-defined collation name> shall have associated
  11687. with it a privilege descriptor that was effectively defined by
  11688. the <grant statement>
  11689. GRANT USAGE ON COLLATION COLL TO PUBLIC
  11690. where COLL is the <standard collation name> or <implementation-
  11691. defined collation name>.
  11692. 5) A collating sequence specified by <external collation name> or
  11693. <schema collation name> shall be a collating sequence that is
  11694. defined for the character repertoire of the character set with
  11695. which the <collation source> is associated.
  11696. 6) A <schema collation name> shall be the name of a collating se-
  11697. quence that is defined in the schema identified by the explicit
  11698. or implicit <schema name>.
  11699. 7) If a <collation definition> does not specify <pad attribute>,
  11700. then
  11701. Case:
  11702. a) If a <collating sequence definition> is specified that con-
  11703. tains a <collation name> that identifies a collation for
  11704. which the <collation definition> specifies NO PAD, then NO
  11705. PAD is implicit.
  11706. b) Otherwise, PAD SPACE is implicit.
  11707. 8) If NO PAD is specified, then the collation is said to have the
  11708. NO PAD attribute. If PAD SPACE is specified, then the collation
  11709. is said to have the PAD SPACE attribute.
  11710. Schema definition and manipulation 315
  11711. X3H2-92-154/DBL CBR-002
  11712. 11.30 <collation definition>
  11713. 9) If <translation collation> is specified, then let T be the
  11714. translation named by <translation name>. Let C1 be the colla-
  11715. tion being defined by the <collation definition>. The source
  11716. character set of T shall be the same as the character set of C1.
  11717. 10)If THEN COLLATION <collation name> is specified, then let C2 be
  11718. the collation named by <collation name> in THEN COLLATION <col-
  11719. lation name>. The target character set of T shall be identical
  11720. to the character set of C2.
  11721. Access Rules
  11722. 1) If a <collation definition> is contained in a <module>, then
  11723. the current <authorization identifier> shall be equal to the
  11724. <authorization identifier> that owns the schema identified by
  11725. the implicit or explicit <schema name> of the <collation name>.
  11726. 2) Let C be a collation identified by any <collation name> con-
  11727. tained in <collation source>. The applicable privileges shall
  11728. include USAGE on C.
  11729. 3) If <translation name> is specified, then the applicable privi-
  11730. leges shall include USAGE.
  11731. General Rules
  11732. 1) A <collation definition> defines a collating sequence.
  11733. 2) DEFAULT specifies that the collation is to be performed us-
  11734. ing the order of characters as they appear in the character
  11735. repertoire.
  11736. 3) If DESC is specified, then the collation is the reverse of that
  11737. specified by <collation name>.
  11738. 4) A privilege descriptor is created that defines the USAGE priv-
  11739. ilege on this collation to the current <authorization identi-
  11740. fier>. The grantor of the privilege descriptor is set to the
  11741. special grantor value "_SYSTEM".
  11742. 5) This privilege descriptor is grantable if and only if the USAGE
  11743. privilege for the current <authorization identifier> on the
  11744. <character set name> contained in the <collation definition>
  11745. is also grantable and if the USAGE privilege for the current
  11746. <authorization identifier> on the <translation name> contained
  11747. in the <translation collation>, if present, is also grantable.
  11748. 6) If <translation collation> is specified, then
  11749. Case:
  11750. a) If THEN COLLATION <collation name> is specified, then let
  11751. C2 be the collating sequence named by the <collation name>
  11752. in THEN COLLATION <collation name>. The collating sequence
  11753. defined is obtained by effectively translating a character
  11754. 316 Database Language SQL
  11755. X3H2-92-154/DBL CBR-002
  11756. 11.30 <collation definition>
  11757. string using T, then applying the collating sequence of C2 to
  11758. the result.
  11759. b) Otherwise, the collating sequence defined is obtained by ef-
  11760. fectively translating a character string using T, then apply-
  11761. ing the default collating sequence for the target character
  11762. set of T.
  11763. 7) If <external collation> is specified, then the collating se-
  11764. quence defined is that given by:
  11765. a) If <standard collation name> is specified, then the national
  11766. or international standard collation.
  11767. b) Otherwise, the implementation-defined collation.
  11768. 8) A collation descriptor is created for the defined collation.
  11769. Leveling Rules
  11770. 1) The following restrictions apply for Intermediate SQL:
  11771. a) Conforming Intermediate SQL language shall not contain any
  11772. <collation definition>.
  11773. 2) The following restrictions apply for Entry SQL in addition to
  11774. any Intermediate SQL restrictions:
  11775. None.
  11776. Schema definition and manipulation 317
  11777. X3H2-92-154/DBL CBR-002
  11778. 11.31 <drop collation statement>
  11779. 11.31 <drop collation statement>
  11780. Function
  11781. Destroy a collating sequence.
  11782. Format
  11783. <drop collation statement> ::=
  11784. DROP COLLATION <collation name>
  11785. Syntax Rules
  11786. 1) Let C be the collating sequence identified by the <collation
  11787. name> and let CN be the name of C.
  11788. 2) The schema identified by the explicit or implicit schema name of
  11789. CN shall include the descriptor of C.
  11790. Access Rules
  11791. 1) The current <authorization identifier> shall be equal to the
  11792. <authorization identifier> that owns the schema identified by
  11793. the <schema name> of the collating sequence identified by C.
  11794. General Rules
  11795. 1) Let A be the current <authorization identifier>. The following
  11796. <revoke statement> is effectively executed with a current <au-
  11797. thorization identifier> of "_SYSTEM" and without further Access
  11798. Rule checking:
  11799. REVOKE USAGE ON COLLATION CN FROM A CASCADE
  11800. 2) Let CD be any collation descriptor that includes CN. CD is modi-
  11801. fied by deleting any occurrences of "THEN COLLATION CN" or "DESC
  11802. (CN)"
  11803. 3) Let CSD be any character set descriptor that includes CN. CSD is
  11804. modified by deleting any occurrences of "COLLATION FROM CN" or
  11805. "DESC (CN)".
  11806. 4) Let DD be any column descriptor or domain descriptor that
  11807. includes CN. DD is modified by deleting any occurrences of
  11808. "COLLATE CN".
  11809. 5) Let VD be any view descriptor whose <query expression> includes
  11810. "COLLATE CN" or any constraint descriptor whose <search con-
  11811. dition> includes "COLLATE CN". VD is modified by deleting any
  11812. occurrences of "COLLATE CN".
  11813. 6) The descriptor of C is destroyed.
  11814. 318 Database Language SQL
  11815. X3H2-92-154/DBL CBR-002
  11816. 11.31 <drop collation statement>
  11817. Leveling Rules
  11818. 1) The following restrictions apply for Intermediate SQL:
  11819. a) Conforming Intermediate SQL language shall not contain any
  11820. <drop collation statement>.
  11821. 2) The following restrictions apply for Entry SQL in addition to
  11822. any Intermediate SQL restrictions:
  11823. None.
  11824. Schema definition and manipulation 319
  11825. X3H2-92-154/DBL CBR-002
  11826. 11.32 <translation definition>
  11827. 11.32 <translation definition>
  11828. Function
  11829. Define a character translation.
  11830. Format
  11831. <translation definition> ::=
  11832. CREATE TRANSLATION <translation name>
  11833. FOR <source character set specification>
  11834. TO <target character set specification>
  11835. FROM <translation source>
  11836. <source character set specification> ::= <character set specification>
  11837. <target character set specification> ::= <character set specification>
  11838. <translation source> ::=
  11839. <translation specification>
  11840. <translation specification> ::=
  11841. <external translation>
  11842. | IDENTITY
  11843. | <schema translation name>
  11844. <external translation> ::=
  11845. EXTERNAL <left paren> <quote> <external translation name> <quote> <right paren>
  11846. <external translation name> ::=
  11847. <standard translation name>
  11848. | <implementation-defined translation name>
  11849. <standard translation name> ::= <translation name>
  11850. <implementation-defined translation name> ::= <translation name>
  11851. <schema translation name> ::= <translation name>
  11852. Syntax Rules
  11853. 1) If a <translation definition> is contained in a <schema defi-
  11854. nition> and if the <translation name> immediately contained in
  11855. the <translation definition> contains a <schema name>, then that
  11856. <schema name> shall be the same as the specified or implicit
  11857. <schema name> of the <schema definition>.
  11858. 320 Database Language SQL
  11859. X3H2-92-154/DBL CBR-002
  11860. 11.32 <translation definition>
  11861. 2) The schema identified by the explicit or implicit schema name of
  11862. the <translation name> shall not include a translation descrip-
  11863. tor whose translation name is <translation name>.
  11864. 3) A <standard translation name> shall be the name of a trans-
  11865. lation defined by a national or international standard. An
  11866. <implementation-defined translation name> shall be the name
  11867. of a translation that is implementation-defined.
  11868. 4) The <standard translation name>s and <implementation-defined
  11869. translation name>s that are supported are implementation-
  11870. defined. Each translation identified by a <standard transla-
  11871. tion name> or by a <implementation-defined translation name>
  11872. shall have associated with it a privilege descriptor that was
  11873. effectively defined by the <grant statement>
  11874. GRANT USAGE ON TRANSLATION TRANS TO PUBLIC
  11875. where TRANS is the <standard translation name> or <implementation-
  11876. defined translation name>.
  11877. 5) A <schema translation name> shall identify a translation de-
  11878. scriptor.
  11879. Access Rules
  11880. 1) If a <translation definition> is contained in a <module>, then
  11881. the current <authorization identifier> shall be equal to the
  11882. <authorization identifier> that owns the schema identified
  11883. by the implicit or explicit <schema name> of the <translation
  11884. name>.
  11885. 2) If <external translation name> is specified, then the applicable
  11886. privileges shall include USAGE.
  11887. General Rules
  11888. 1) A <translation definition> defines a translation.
  11889. 2) IDENTITY specifies a translation that makes no changes to the
  11890. characters.
  11891. 3) A translation descriptor is created for the defined translation.
  11892. 4) A privilege descriptor PD is created that defines the USAGE
  11893. privilege on this translation to the <authorization identifier>
  11894. of the schema or <module> in which the <translation definition>
  11895. appears. The grantor of the privilege descriptor is set to the
  11896. special grantor value "_SYSTEM".
  11897. 5) PD is grantable if and only if the USAGE privilege for the <au-
  11898. thorization identifier> of the schema or <module> in which the
  11899. <translation definition> appears is also grantable on every
  11900. <character set name> contained in the <translation definition>.
  11901. Schema definition and manipulation 321
  11902. X3H2-92-154/DBL CBR-002
  11903. 11.32 <translation definition>
  11904. Leveling Rules
  11905. 1) The following restrictions apply for Intermediate SQL:
  11906. a) Conforming Intermediate SQL language shall contain no <trans-
  11907. lation definition>.
  11908. 2) The following restrictions apply for Entry SQL in addition to
  11909. any Intermediate SQL restrictions:
  11910. None.
  11911. 322 Database Language SQL
  11912. X3H2-92-154/DBL CBR-002
  11913. 11.33 <drop translation statement>
  11914. 11.33 <drop translation statement>
  11915. Function
  11916. Destroy a character translation.
  11917. Format
  11918. <drop translation statement> ::=
  11919. DROP TRANSLATION <translation name>
  11920. Syntax Rules
  11921. 1) Let T be the translation identified by the <translation name>
  11922. and let TN be the name of T.
  11923. 2) The schema identified by the explicit or implicit schema name of
  11924. TN shall include the descriptor of T.
  11925. 3) T shall not be referenced in the <query expression> included
  11926. in any view descriptor or in the <search condition> included
  11927. in any constraint descriptor or be included in any collation
  11928. descriptor.
  11929. Access Rules
  11930. 1) The current <authorization identifier> shall be equal to the
  11931. <authorization identifier> that owns the schema identified by
  11932. the <schema name> of the translation identified by T.
  11933. General Rules
  11934. 1) Let CD be any collation descriptor that includes a <transla-
  11935. tion collation> TRANSLATION TN. CD is modified by deleting that
  11936. <translation collation>.
  11937. 2) Let CSD be any <character set definition> that references T.
  11938. CSD is modified by deleting any occurrences of a <translation
  11939. collation> that contains TN.
  11940. 3) Let A be the current <authorization identifier>. The following
  11941. <revoke statement> is effectively executed with a current <au-
  11942. thorization identifier> of "_SYSTEM" and without further Access
  11943. Rule checking:
  11944. REVOKE USAGE ON TRANSLATION TN FROM A CASCADE
  11945. 4) The descriptor of T is destroyed.
  11946. Schema definition and manipulation 323
  11947. X3H2-92-154/DBL CBR-002
  11948. 11.33 <drop translation statement>
  11949. Leveling Rules
  11950. 1) The following restrictions apply for Intermediate SQL:
  11951. a) Conforming Intermediate SQL language shall contain no <drop
  11952. translation statement>.
  11953. 2) The following restrictions apply for Entry SQL in addition to
  11954. any Intermediate SQL restrictions:
  11955. None.
  11956. 324 Database Language SQL
  11957. X3H2-92-154/DBL CBR-002
  11958. 11.34 <assertion definition>
  11959. 11.34 <assertion definition>
  11960. Function
  11961. Specify an integrity constraint by means of an assertion and spec-
  11962. ify the initial default time for checking the assertion.
  11963. Format
  11964. <assertion definition> ::=
  11965. CREATE ASSERTION <constraint name> <assertion check>
  11966. [ <constraint attributes> ]
  11967. <assertion check> ::=
  11968. CHECK <left paren> <search condition> <right paren>
  11969. Syntax Rules
  11970. 1) If an <assertion definition> is contained in a <schema defi-
  11971. nition> and if the <constraint name> contains a <schema name>,
  11972. then that <schema name> shall be the same as the explicit or
  11973. implicit <schema name> of the containing <schema definition>.
  11974. 2) The schema identified by the explicit or implicit schema name of
  11975. the <constraint name> shall not include a constraint descriptor
  11976. whose constraint name is <constraint name>.
  11977. 3) If <constraint attributes> is not specified, then INITIALLY
  11978. IMMEDIATE NOT DEFERRABLE is implicit.
  11979. 4) The <search condition> shall not contain a <target specifica-
  11980. tion> or a <dynamic parameter specification>.
  11981. 5) No <query expression> in the <search condition> shall reference
  11982. a temporary table.
  11983. 6) The <search condition> shall not generally contain a <datetime
  11984. value function> or a <value specification> that is CURRENT_USER,
  11985. SESSION_USER, or SYSTEM_USER.
  11986. 7) The <qualified identifier> of <constraint name> shall be differ-
  11987. ent from the <qualified identifier> of the <constraint name> of
  11988. any other constraint defined in the same schema.
  11989. 8) The <search condition> shall not generally contain a <query
  11990. specification> or a <query expression> that is possibly non-
  11991. deterministic.
  11992. Schema definition and manipulation 325
  11993. X3H2-92-154/DBL CBR-002
  11994. 11.34 <assertion definition>
  11995. Access Rules
  11996. 1) If an <assertion definition> is contained in a <module>, then
  11997. the current <authorization identifier> shall be equal to the
  11998. <authorization identifier> that owns the schema identified by
  11999. the implicit or explicit <schema name> of the <constraint name>
  12000. of the <assertion definition>.
  12001. 2) Let TN be any <table name> referenced in the <search condi-
  12002. tion> of the <assertion definition>. If TN identifies a table
  12003. described by a base table descriptor or a view descriptor, then
  12004. Case:
  12005. a) If a <column name> is contained in the <search condition>,
  12006. then the applicable privileges shall include REFERENCES for
  12007. each <column name> CN of the table identified by TN, where CN
  12008. is contained in the <search condition>.
  12009. b) Otherwise, the applicable privileges shall include REFERENCES
  12010. for at least one column of the table identified by TN.
  12011. General Rules
  12012. 1) An <assertion definition> defines an assertion.
  12013. Note: Subclause 10.6, "<constraint name definition> and <con-
  12014. straint attributes>", specifies when a constraint is effectively
  12015. checked.
  12016. 2) The assertion is not satisfied if and only if the result of
  12017. evaluating the <search condition> is false.
  12018. 3) An assertion descriptor is created that describes the assertion
  12019. being defined. The name included in the assertion descriptor is
  12020. <constraint name>.
  12021. The assertion descriptor includes an indication of whether the
  12022. constraint is deferrable or not deferrable and whether the ini-
  12023. tial constraint mode is deferred or immediate.
  12024. The assertion descriptor includes the <search condition> of the
  12025. <assertion definition>.
  12026. 4) If the character representation of the <search condition> cannot
  12027. be represented in the Information Schema without truncation,
  12028. then a completion condition is raised: warning-search condition
  12029. too long for information schema.
  12030. Leveling Rules
  12031. 1) The following restrictions apply for Intermediate SQL:
  12032. a) Conforming Intermediate SQL language shall not contain any
  12033. <assertion definition>.
  12034. 326 Database Language SQL
  12035. X3H2-92-154/DBL CBR-002
  12036. 11.34 <assertion definition>
  12037. 2) The following restrictions apply for Entry SQL in addition to
  12038. any Intermediate SQL restrictions:
  12039. None.
  12040. Schema definition and manipulation 327
  12041. X3H2-92-154/DBL CBR-002
  12042. 11.35 <drop assertion statement>
  12043. 11.35 <drop assertion statement>
  12044. Function
  12045. Destroy an assertion.
  12046. Format
  12047. <drop assertion statement> ::=
  12048. DROP ASSERTION <constraint name>
  12049. Syntax Rules
  12050. 1) Let A be the assertion identified by <constraint name> and let
  12051. AN be the name of A.
  12052. 2) The schema identified by the explicit or implicit schema name of
  12053. AN shall include the descriptor of A.
  12054. Access Rules
  12055. 1) The current <authorization identifier> shall be equal to the
  12056. <authorization identifier> that owns the schema identified by
  12057. the <schema name> of the assertion identified by AN.
  12058. General Rules
  12059. 1) The descriptor of A is destroyed.
  12060. Leveling Rules
  12061. 1) The following restrictions apply for Intermediate SQL:
  12062. a) Conforming Intermediate SQL language shall not contain any
  12063. <drop assertion statement>.
  12064. 2) The following restrictions apply for Entry SQL in addition to
  12065. any Intermediate SQL restrictions:
  12066. None.
  12067. 328 Database Language SQL
  12068. X3H2-92-154/DBL CBR-002
  12069. 11.36 <grant statement>
  12070. 11.36 <grant statement>
  12071. Function
  12072. Define privileges.
  12073. Format
  12074. <grant statement> ::=
  12075. GRANT <privileges> ON <object name>
  12076. TO <grantee> [ { <comma> <grantee> }... ]
  12077. [ WITH GRANT OPTION ]
  12078. <object name> ::=
  12079. [ TABLE ] <table name>
  12080. | DOMAIN <domain name>
  12081. | COLLATION <collation name>
  12082. | CHARACTER SET <character set name>
  12083. | TRANSLATION <translation name>
  12084. Syntax Rules
  12085. 1) If <object name> specifies a <domain name>, <collation name>,
  12086. <character set name>, or <translation name>, then <privileges>
  12087. shall specify USAGE; otherwise, USAGE shall not be specified.
  12088. 2) Let O be the object identified by the <object name>.
  12089. 3) Let A be the current <authorization identifier>. For each
  12090. <grantee> specified, a set of privilege descriptors is iden-
  12091. tified. The privilege descriptors identified are those defining,
  12092. for each <action> explicitly or implicitly in <privileges>, that
  12093. <action> on O held by A with grant option.
  12094. Access Rules
  12095. 1) The applicable privileges shall include a privilege identifying
  12096. O.
  12097. General Rules
  12098. 1) The <privileges> specify one or more privileges on the object
  12099. identified by the <object name>.
  12100. 2) For every identified privilege descriptor, a privilege descrip-
  12101. tor is created that specifies the identical <grantee>, <action>,
  12102. object O, and grantor A. Let CPD be the set of privilege de-
  12103. scriptors created.
  12104. 3) For every identified privilege descriptor whose action is
  12105. SELECT, INSERT, UPDATE, or REFERENCES without a column name,
  12106. privilege descriptors are also created for each column C in O
  12107. Schema definition and manipulation 329
  12108. X3H2-92-154/DBL CBR-002
  12109. 11.36 <grant statement>
  12110. for which A holds the corresponding privilege with grant op-
  12111. tion. For each such column, a privilege descriptor is created
  12112. that specifies the identical <grantee>, the identical <action>,
  12113. object C, and grantor A.
  12114. 4) If WITH GRANT OPTION was specified, each privilege descriptor
  12115. also indicates that the privilege is grantable.
  12116. 5) If <table name> is specified, then let T be the table identified
  12117. by the <table name>.
  12118. 6) For every updatable view V owned by some grantee G such that T
  12119. is some leaf underlying table of the <query expression> of V:
  12120. a) Let VN be the <table name> of V.
  12121. b) If WITH GRANT OPTION is specified, then let WGO be "WITH
  12122. GRANT OPTION"; otherwise, let WGO be a zero-length string.
  12123. c) For every privilege descriptor PD in CPD, let PA be the ac-
  12124. tion included in PD.
  12125. i) If PA is INSERT, UPDATE, or DELETE, then the following
  12126. <grant statement> is effectively executed as though the
  12127. current <authorization identifier> were "_SYSTEM" and with-
  12128. out further Access Rule checking:
  12129. GRANT PA ON VN TO G WGO
  12130. ii) If PA is A(CT), where A is INSERT or UPDATE and CT is the
  12131. name of some column of T such that there is a correspond-
  12132. ing column in V, named CVN, that is derived from CT, then
  12133. the following <grant statement> is effectively executed
  12134. as though the current <authorization identifier> were "_
  12135. SYSTEM" and without further Access Rule checking:
  12136. GRANT A(CVN) ON VN TO G WGO
  12137. 7) For every <grantee> G and for every view V1 owned by G, if G has
  12138. been granted SELECT privilege WITH GRANT OPTION on all tables
  12139. identified by a <table name> contained in the <query expression>
  12140. of V1, then for every privilege descriptor with a <privileges>
  12141. P that contains SELECT, a <grantor> of "_SYSTEM", <object> of
  12142. V1, and <grantee> G that is not grantable, the following <grant
  12143. statement> is effectively executed with a current <authoriza-
  12144. tion identifier> of "_SYSTEM" and without further Access Rule
  12145. checking:
  12146. GRANT P ON V1 TO G WITH GRANT OPTION
  12147. 8) For every <grantee> G and for every domain D1 owned by G, if G
  12148. has been granted REFERENCES privilege WITH GRANT OPTION on every
  12149. column referenced in the <search condition> included in a domain
  12150. constraint descriptor included in the domain descriptor of D1
  12151. and a grantable USAGE privilege on all domains, character sets,
  12152. collations, and translations whose <domain name>s, <character
  12153. 330 Database Language SQL
  12154. X3H2-92-154/DBL CBR-002
  12155. 11.36 <grant statement>
  12156. set name>s, <collation name>s, and <translation name>s, respec-
  12157. tively, are included in the domain descriptor, and a grantable
  12158. USAGE privilege for the <collation name> contained in the <col-
  12159. late clause> included in the domain descriptor, then for every
  12160. privilege descriptor with <privileges> USAGE, a <grantor> of "_
  12161. SYSTEM", <object> D1, and <grantee> G that is not grantable, the
  12162. following <grant statement> is effectively executed with a cur-
  12163. rent <authorization identifier> of "_SYSTEM" and without further
  12164. Access Rule checking:
  12165. GRANT USAGE ON DOMAIN D1 TO G WITH GRANT OPTION
  12166. 9) For every <grantee> G and for every collation C1 owned by G, if
  12167. the USAGE privilege of G for the character set identified by a
  12168. <character set specification> contained in the <collation defi-
  12169. nition> of C1 is grantable, then for every privilege descriptor
  12170. with a <privileges> P, a <grantor> of "_SYSTEM", <object> of
  12171. C1, and <grantee> G that is not grantable, the following <grant
  12172. statement> is effectively executed with a current <authoriza-
  12173. tion identifier> of "_SYSTEM" and without further Access Rule
  12174. checking:
  12175. GRANT P ON COLLATION C1 TO G WITH GRANT OPTION
  12176. 10)For every <grantee> G and for every translation T1 owned by G,
  12177. if the USAGE privilege of G for every character set identified
  12178. by a <character set specification> contained in the <transla-
  12179. tion definition> of T1 is grantable, then for every privilege
  12180. descriptor with a <privileges> P, a <grantor> of "_SYSTEM",
  12181. <object> of T1, and <grantee> G that is not grantable, the fol-
  12182. lowing <grant statement> is effectively executed as though the
  12183. current <authorization identifier> were "_SYSTEM" and without
  12184. further Access Rule checking:
  12185. GRANT P ON TRANSLATION T1 TO G WITH GRANT OPTION
  12186. 11)If <table name> is specified, then for each view V owned by some
  12187. <grantee> G such that T or some column CT of T, let RTi, for i
  12188. ranging from 1 to the number of tables identified by the <table
  12189. reference>s contained in the <query expression> of V, be the
  12190. <table name>s of those tables. For every column CV of V:
  12191. a) Let CRij, for j ranging from 1 to the number of columns of
  12192. RTi that are underlying columns of CV, be the <column name>s
  12193. of those columns.
  12194. b) If WITH GRANT OPTION was specified, then let WGO be "WITH
  12195. GRANT OPTION"; otherwise, let WGO be a zero-length string.
  12196. c) If, following successful execution of the <grant statement>,
  12197. G will have REFERENCES(CRTij) for all i and for all j, and
  12198. A has REFERENCES on some column of RTi for all i, the the
  12199. following <grant statement> is effectively executed as though
  12200. Schema definition and manipulation 331
  12201. X3H2-92-154/DBL CBR-002
  12202. 11.36 <grant statement>
  12203. the current <authorization identifier> were "_SYSTEM" and
  12204. without further Access Rule checking:
  12205. GRANT REFERENCES CV ON V TO G WGO
  12206. 12)If two privilege descriptors are identical except that one in-
  12207. dicates that the privilege is grantable and the other indicates
  12208. that the privilege is not grantable, then both privilege de-
  12209. scriptors are set to indicate that the privilege is grantable.
  12210. 13)Redundant duplicate privilege descriptors are removed from the
  12211. multiset of all privilege descriptors.
  12212. 14)For every combination of <grantee> and <action> on O specified
  12213. in <privileges>, if there is no corresponding privilege de-
  12214. scriptor in the set of identified privilege descriptors, then a
  12215. completion condition is raised: warning-privilege not granted.
  12216. 15)If ALL PRIVILEGES was specified, then for each grantee, if no
  12217. privilege descriptors were identified, then a completion condi-
  12218. tion is raised: warning-privilege not granted.
  12219. Leveling Rules
  12220. 1) The following restrictions apply for Intermediate SQL:
  12221. a) In Conforming Intermediate SQL language, an <object name>
  12222. shall not specify COLLATION or TRANSLATION.
  12223. 2) The following restrictions apply for Entry SQL in addition to
  12224. any Intermediate SQL restrictions:
  12225. a) In Conforming Entry SQL language, an <object name> shall not
  12226. specify TABLE.
  12227. b) In Conforming Entry SQL language, an <object name> shall not
  12228. specify CHARACTER SET or DOMAIN.
  12229. 332 Database Language SQL
  12230. X3H2-92-154/DBL CBR-002
  12231. 11.37 <revoke statement>
  12232. 11.37 <revoke statement>
  12233. Function
  12234. Destroy privileges.
  12235. Format
  12236. <revoke statement> ::=
  12237. REVOKE [ GRANT OPTION FOR ] <privileges>
  12238. ON <object name>
  12239. FROM <grantee> [ { <comma> <grantee> }... ] <drop behavior>
  12240. Syntax Rules
  12241. 1) If <object name> specifies a <domain name>, <collation name>,
  12242. <character set name>, or <translation name>, then <privileges>
  12243. shall specify USAGE; otherwise, USAGE shall not be specified.
  12244. 2) INSERT is equivalent to specifying both the INSERT table priv-
  12245. ilege and INSERT (<privilege column list>) for all columns of
  12246. <table name>.
  12247. 3) UPDATE is equivalent to specifying both the UPDATE table priv-
  12248. ilege and UPDATE (<privilege column list>) for all columns of
  12249. <table name>.
  12250. 4) REFERENCES is equivalent to specifying both the REFERENCES ta-
  12251. ble privilege and REFERENCES (<privilege column list>) for all
  12252. columns of <table name>.
  12253. 5) Let O be the object identified by the <object name>.
  12254. 6) Let A be the current <authorization identifier>. For every
  12255. <grantee> specified, a set of privilege descriptors is iden-
  12256. tified. A privilege descriptor is said to be identified if it
  12257. belongs to the set of privilege descriptors that define, for any
  12258. <action> explicitly or implicitly in <privileges>, that <action>
  12259. on O granted by A to <grantee>.
  12260. Note: Column privilege descriptors become identified when <ac-
  12261. tion> explicitly or implicitly contains a <privilege column
  12262. list>.
  12263. 7) A privilege descriptor D is allowed to be created by a grant
  12264. permitted by P if either:
  12265. a) The following conditions hold:
  12266. i) P indicates that the privilege that it represents is
  12267. grantable, and
  12268. Schema definition and manipulation 333
  12269. X3H2-92-154/DBL CBR-002
  12270. 11.37 <revoke statement>
  12271. ii) The grantee of P is the same as the grantor of D or the
  12272. grantee of P is PUBLIC, and
  12273. iii) Case:
  12274. 1) P and D are both column privilege descriptors. The ac-
  12275. tion and the identified column of P are the same as the
  12276. action and identified column of D, respectively.
  12277. 2) P is a table privilege descriptor and D is a column
  12278. privilege descriptor. The identified table of P is the
  12279. same as the identified table of D and the action of P
  12280. is the same as the action of D and the action of P is
  12281. SELECT.
  12282. 3) Neither P nor D are column privilege descriptors. The
  12283. action and the identified table, domain, character set,
  12284. collation, or translation of P are the same as the ac-
  12285. tion and the identified table, domain, character set,
  12286. collation, or translation of D, respectively.
  12287. b) The following conditions hold:
  12288. i) The privilege descriptor for D indicates that its grantor
  12289. is the special grantor value "_SYSTEM", and
  12290. ii) The action of P is the same as the action of D, and
  12291. iii) The grantee of P is the owner of the table, collation, or
  12292. translation identified by D, or the grantee of P is PUBLIC,
  12293. and
  12294. iv) One of the following conditions hold:
  12295. 1) P and D are both table privilege descriptors, the priv-
  12296. ilege descriptor for D identifies the <table name> of a
  12297. <view definition> V and either:
  12298. A) The action of P is SELECT and the identified table of
  12299. P is contained in the <query expression> of V, or
  12300. B) V is an updatable view and the identified table of P
  12301. is the underlying table of the <query expression>.
  12302. 2) P and D are both column privilege descriptors, the priv-
  12303. ilege descriptor D identifies a <column name> CVN ex-
  12304. plicitly or implicitly contained in the <view column
  12305. list> of a <view definition> V and V is an updatable
  12306. view. For every column CV identified by a <column name>
  12307. CVN, there is a corresponding column in the underly-
  12308. ing table of the <query expression> TN. Let CTN be the
  12309. <column name> of the column of the <query expression>
  12310. from which CV is derived. The action for P is UPDATE or
  12311. INSERT and the identified column of P is TN.CTN.
  12312. 334 Database Language SQL
  12313. X3H2-92-154/DBL CBR-002
  12314. 11.37 <revoke statement>
  12315. 3) P is a table privilege descriptor and the column privi-
  12316. lege descriptor D identifies a <column name> CV explic-
  12317. itly or implicitly contained in the <view column list>
  12318. of a <view definition> V. Let TN be a <table name> con-
  12319. tained in the <query expression> of the view. The action
  12320. for P is SELECT and the identified table of P is TN.
  12321. 4) The privilege descriptor D identifies the <collation
  12322. name> of a <collation definition> CO and the identified
  12323. character set name of P is contained in the <character
  12324. set specification> immediately contained in CO.
  12325. 5) The privilege descriptor D identifies the <translation
  12326. name> of a <translation definition> TD and the identi-
  12327. fied character set name of P is contained in the <source
  12328. character set specification> or the <target character
  12329. set specification> immediately contained in TD.
  12330. 8) A privilege descriptor D is said to be directly dependent on an-
  12331. other privilege descriptor P if D represents a privilege allowed
  12332. to be created by a grant permitted by P.
  12333. 9) The privilege dependency graph is a directed graph such that:
  12334. a) Each node represents a privilege descriptor, and
  12335. b) Each arc from node P1 to node P2 represents the fact that P2
  12336. directly depends on P1.
  12337. An independent node is one that has no incoming arcs.
  12338. 10)A privilege descriptor P is said to be modified if either P is a
  12339. SELECT column privilege descriptor and a SELECT table privilege
  12340. descriptor with the same grantee, grantor, catalog name, schema
  12341. name, and table name is a modified privilege descriptor, or:
  12342. a) P indicates that the privilege that it represents is
  12343. grantable, and
  12344. b) P directly depends on an identified privilege descriptor or a
  12345. modified privilege descriptor, and
  12346. c) Let XO and XA respectively be the identifier of the object
  12347. identified by a privilege descriptor X and the action of X.
  12348. Within the set of privilege descriptors upon which P directly
  12349. depends, there exists some XO and XA for which the set of
  12350. identified privilege descriptors unioned with the set of mod-
  12351. ified privilege descriptors include all privilege descriptors
  12352. specifying the grant of XA on XO with grant option, and
  12353. d) At least one of the following is true:
  12354. i) GRANT OPTION FOR is specified and the grantor of P is the
  12355. special grantor value "_SYSTEM".
  12356. Schema definition and manipulation 335
  12357. X3H2-92-154/DBL CBR-002
  12358. 11.37 <revoke statement>
  12359. ii) There exists a path to P from an independent node that
  12360. includes no identified or modified privilege descriptors. P
  12361. is said to be a marked modified privilege descriptor.
  12362. iii) P directly depends on a marked modified privilege descrip-
  12363. tor, and the grantor of P is the special grantor value
  12364. "_SYSTEM". P is said to be a marked modified privilege
  12365. descriptor.
  12366. 11)A privilege descriptor P is abandoned if:
  12367. a) It is not an independent node, and
  12368. Case:
  12369. i) GRANT OPTION FOR is not specified, P is not itself a mod-
  12370. ified privilege descriptor, and there exists no path to
  12371. P from any independent node other than paths that include
  12372. an identified privilege descriptor or a modified privilege
  12373. descriptor.
  12374. ii) GRANT OPTION FOR is specified, P is not itself a modi-
  12375. fied privilege descriptor, and there exists no path to P
  12376. from any independent node other than paths that include a
  12377. modified privilege descriptor.
  12378. b) P is a SELECT column privilege descriptor and there exists
  12379. a SELECT table privilege descriptor X with the same grantee,
  12380. grantor, catalog name, schema name, and table name and
  12381. Case:
  12382. i) GRANT OPTION FOR is not specified and X is an identified
  12383. privilege descriptor or an abandoned privilege descriptor.
  12384. ii) GRANT OPTION FOR is specified and X is an abandoned privi-
  12385. lege descriptor.
  12386. 12)Let S1 be the name of any schema and let A1 be the <authoriza-
  12387. tion identifier> that owns the schema identified by S1.
  12388. 13)Let V be any view descriptor included in S1. V is said to be
  12389. abandoned if the destruction of all abandoned privilege descrip-
  12390. tors and, if GRANT OPTION FOR is not specified, all identified
  12391. privilege descriptors would result in A1 no longer having SELECT
  12392. privilege on one or more tables or USAGE privilege on one or
  12393. more domains, collations, character sets, or translations whose
  12394. names are contained in the <query expression> of V.
  12395. 14)Let TC be any table constraint descriptor included in S1. TC is
  12396. said to be abandoned if the destruction of all abandoned privi-
  12397. lege descriptors and, if GRANT OPTION FOR is not specified, all
  12398. identified privilege descriptors would result in A1 no longer
  12399. having REFERENCES privilege on one or more referenced columns
  12400. of TC or USAGE privilege on one or more domains, collations,
  12401. 336 Database Language SQL
  12402. X3H2-92-154/DBL CBR-002
  12403. 11.37 <revoke statement>
  12404. character sets, or translations whose names are contained in any
  12405. <search condition> of TC.
  12406. 15)Let AX be any assertion descriptor included in S1. AX is said
  12407. to be abandoned if the destruction of all abandoned privilege
  12408. descriptors and, if GRANT OPTION FOR is not specified, all iden-
  12409. tified privilege descriptors would result in A1 no longer having
  12410. REFERENCES privilege on one or more referenced columns of AX or
  12411. USAGE privilege on one or more domains, collations, character
  12412. sets, or translations whose names are contained in any <search
  12413. condition> of AX.
  12414. 16)Let DC be any domain constraint descriptor included in S1. DC is
  12415. said to be abandoned if the destruction of all abandoned privi-
  12416. lege descriptors and, if GRANT OPTION FOR is not specified, all
  12417. identified privilege descriptors would result in A1 no longer
  12418. having REFERENCES privilege on one or more referenced columns
  12419. of DC or USAGE privilege on one or more domains, collations,
  12420. character sets, or translations whose names are contained in any
  12421. <search condition> of DC.
  12422. 17)Let DO be any domain descriptor included in S1. DO is said to be
  12423. abandoned if the destruction of all abandoned privilege descrip-
  12424. tors and, if GRANT OPTION FOR is not specified, all identified
  12425. privilege descriptors would result in A1 no longer having USAGE
  12426. privilege on the collation whose name is contained in the <col-
  12427. late clause> of DO, if any.
  12428. 18)If RESTRICT is specified, then there shall be no abandoned priv-
  12429. ilege descriptors, abandoned views, abandoned table constraints,
  12430. abandoned assertions, abandoned domain constraints, or abandoned
  12431. domains.
  12432. Access Rules
  12433. 1) The applicable privileges shall include a privilege identifying
  12434. O.
  12435. General Rules
  12436. 1) If GRANT OPTION FOR is not specified, then:
  12437. a) All abandoned privilege descriptors are destroyed, and
  12438. b) The identified privilege descriptors are destroyed, and
  12439. c) The modified privilege descriptors are set to indicate that
  12440. they are not grantable.
  12441. 2) If GRANT OPTION FOR is specified, then
  12442. Case:
  12443. a) If CASCADE is specified, then all abandoned privilege de-
  12444. scriptors are destroyed.
  12445. Schema definition and manipulation 337
  12446. X3H2-92-154/DBL CBR-002
  12447. 11.37 <revoke statement>
  12448. b) Otherwise, if there are any privilege descriptors directly
  12449. dependent on an identified privilege descriptor that are not
  12450. modified privilege descriptors, then an exception condition
  12451. is raised: dependent privilege descriptors still exist.
  12452. The identified privilege descriptors and the modified privilege
  12453. descriptors are set to indicate that they are not grantable.
  12454. 3) For every abandoned view descriptor V, let S1.VN be the <table
  12455. name> of V. The following <drop view statement> is effectively
  12456. executed without further Access Rule checking:
  12457. DROP VIEW S1.VN CASCADE
  12458. 4) For every abandoned table constraint descriptor TC, let S1.TCN
  12459. be the <constraint name> of TC and let S2.T2 be the <table name>
  12460. of the table that contains TC (S1 and S2 not necessarily dif-
  12461. ferent). The following <alter table statement> is effectively
  12462. executed without further Access Rule checking:
  12463. ALTER TABLE S2.T2 DROP CONSTRAINT S1.TCN CASCADE
  12464. 5) For every abandoned assertion descriptor AX, let S1.AXN be the
  12465. <constraint name> of AX. The following <drop assertion state-
  12466. ment> is effectively executed without further Access Rule check-
  12467. ing:
  12468. DROP ASSERTION S1.AXN
  12469. 6) For every abandoned domain constraint descriptor DC, let S1.DCN
  12470. be the <constraint name> of DC and let S2.DN be the <domain
  12471. name> of the domain that contains DC. The following <alter do-
  12472. main statement> is effectively executed without further Access
  12473. Rule checking:
  12474. ALTER DOMAIN S2.DN DROP CONSTRAINT S1.DCN
  12475. 7) For every abandoned domain descriptor DO, let S1.DN be the
  12476. <domain name> of DO. The following <drop domain statement> is
  12477. effectively executed without further Access Rule checking:
  12478. DROP DOMAIN S1.DN CASCADE
  12479. 8) For every combination of <grantee> and <action> on O specified
  12480. in <privileges>, if there is no corresponding privilege de-
  12481. scriptor in the set of identified privilege descriptors, then a
  12482. completion condition is raised: warning-privilege not revoked.
  12483. 9) If ALL PRIVILEGES was specified, then for each <grantee>, if
  12484. no privilege descriptors were identified, then a completion
  12485. condition is raised: warning-privilege not revoked.
  12486. 338 Database Language SQL
  12487. X3H2-92-154/DBL CBR-002
  12488. 11.37 <revoke statement>
  12489. Leveling Rules
  12490. 1) The following restrictions apply for Intermediate SQL:
  12491. None.
  12492. 2) The following restrictions apply for Entry SQL in addition to
  12493. any Intermediate SQL restrictions:
  12494. a) Conforming Entry SQL language shall not contain a <revoke
  12495. statement>.
  12496. Schema definition and manipulation 339
  12497. X3H2-92-154/DBL CBR-002
  12498. 340 Database Language SQL
  12499. X3H2-92-154/DBL CBR-002
  12500. 12 Module
  12501. 12.1 <module>
  12502. Function
  12503. Define a module.
  12504. Format
  12505. <module> ::=
  12506. <module name clause>
  12507. <language clause>
  12508. <module authorization clause>
  12509. [ <temporary table declaration>... ]
  12510. <module contents>...
  12511. <module authorization clause> ::=
  12512. SCHEMA <schema name>
  12513. | AUTHORIZATION <module authorization identifier>
  12514. | SCHEMA <schema name> AUTHORIZATION <module authorization identifier>
  12515. <module authorization identifier> ::=
  12516. <authorization identifier>
  12517. <module contents> ::=
  12518. <declare cursor>
  12519. | <dynamic declare cursor>
  12520. | <procedure>
  12521. Syntax Rules
  12522. 1) If SCHEMA <schema name> is not specified, then a <schema name>
  12523. equal to <module authorization identifier> is implicit.
  12524. 2) If the explicit or implicit <schema name> does not specify a
  12525. <catalog name>, then an implementation-defined <catalog name> is
  12526. implicit.
  12527. 3) The implicit or explicit <catalog name> is the implicit <catalog
  12528. name> for all unqualified <schema name>s in the <module>.
  12529. 4) A <declare cursor> or <dynamic declare cursor> shall precede
  12530. in the text of the <module> any <procedure> that references
  12531. the <cursor name> of the <declare cursor> or <dynamic declare
  12532. cursor>.
  12533. Module 341
  12534. X3H2-92-154/DBL CBR-002
  12535. 12.1 <module>
  12536. 5) For every <declare cursor> in a <module>, there shall be exactly
  12537. one <procedure> in that <module> that contains an <open state-
  12538. ment> that specifies the <cursor name> declared in the <declare
  12539. cursor>.
  12540. Note: See the Syntax Rules of Subclause 13.1, "<declare cur-
  12541. sor>".
  12542. Access Rules
  12543. None.
  12544. General Rules
  12545. 1) If the SQL-agent that performs a call of a <procedure> in a
  12546. <module> is not a program that conforms to the programming
  12547. language standard specified by the <language clause> of that
  12548. <module>, then the effect is implementation-dependent.
  12549. 2) If the SQL-agent performs calls of <procedure>s from more than
  12550. one Ada task, then the results are implementation-dependent.
  12551. 3) Case:
  12552. a) If a <module authorization identifier> is specified, then
  12553. it is the current <authorization identifier> for privilege
  12554. determination for the execution of each <procedure> in the
  12555. <module>.
  12556. b) Otherwise, the current <authorization identifier> for privi-
  12557. lege determination for the execution of each <procedure> in
  12558. the <module> is the SQL-session <authorization identifier>.
  12559. 4) After the last time that an SQL-agent performs a call of a <pro-
  12560. cedure>:
  12561. a) A <rollback statement> or a <commit statement> is effec-
  12562. tively executed. If an unrecoverable error has occurred,
  12563. or if the SQL-agent terminated unexpectedly, or if any con-
  12564. straint is not satisfied, then a <rollback statement> is
  12565. performed. Otherwise, the choice of which of these SQL-
  12566. statements to perform is implementation-dependent. The deter-
  12567. mination of whether an SQL-agent has terminated unexpectedly
  12568. is implementation-dependent.
  12569. b) Let D be the <descriptor name> of any system descriptor area
  12570. that is currently allocated within an SQL-session associated
  12571. with the SQL-agent. A <deallocate descriptor statement> that
  12572. specifies
  12573. DEALLOCATE DESCRIPTOR D
  12574. is effectively executed.
  12575. 342 Database Language SQL
  12576. X3H2-92-154/DBL CBR-002
  12577. 12.1 <module>
  12578. c) All SQL-sessions associated with the SQL-agent are termi-
  12579. nated.
  12580. Leveling Rules
  12581. 1) The following restrictions apply for Intermediate SQL:
  12582. a) A <module> shall not contain a <temporary table declaration>.
  12583. 2) The following restrictions apply for Entry SQL in addition to
  12584. any Intermediate SQL restrictions:
  12585. a) A <module> shall be associated with an SQL-agent during its
  12586. execution. An SQL-agent shall be associated with at most one
  12587. <module>.
  12588. b) A <module contents> shall not be a <dynamic declare cursor>.
  12589. c) A <module authorization clause> shall specify AUTHORIZATION
  12590. and shall not specify SCHEMA.
  12591. Module 343
  12592. X3H2-92-154/DBL CBR-002
  12593. 12.2 <module name clause>
  12594. 12.2 <module name clause>
  12595. Function
  12596. Name a <module>.
  12597. Format
  12598. <module name clause> ::=
  12599. MODULE [ <module name> ]
  12600. [ <module character set specification> ]
  12601. <module character set specification> ::=
  12602. NAMES ARE <character set specification>
  12603. Syntax Rules
  12604. 1) If a <module name clause> does not specify a <module name>, then
  12605. the <module> is unnamed.
  12606. 2) The <module name> shall be different from the <module name> of
  12607. any other <module> in the same SQL-environment.
  12608. Note: An SQL-environment may have multiple <module>s that are
  12609. unnamed.
  12610. 3) If the <language clause> of the containing <module> specifies
  12611. ADA, then a <module name> shall be specified, and that <module
  12612. name> shall be a valid Ada library unit name.
  12613. 4) If a <module character set specification> is not specified,
  12614. then a <module character set specification> that specifies an
  12615. implementation-defined character set that contains at least
  12616. every character that is in <SQL language character> is implicit.
  12617. Access Rules
  12618. None.
  12619. General Rules
  12620. 1) If a <module name> is specified, then in the SQL-environment the
  12621. containing <module> has the name given by <module name>.
  12622. Leveling Rules
  12623. 1) The following restrictions apply for Intermediate SQL:
  12624. None.
  12625. 344 Database Language SQL
  12626. X3H2-92-154/DBL CBR-002
  12627. 12.2 <module name clause>
  12628. 2) The following restrictions apply for Entry SQL in addition to
  12629. any Intermediate SQL restrictions:
  12630. a) A <module character set specification> shall not be speci-
  12631. fied.
  12632. Module 345
  12633. X3H2-92-154/DBL CBR-002
  12634. 12.3 <procedure>
  12635. 12.3 <procedure>
  12636. Function
  12637. Define a procedure.
  12638. Format
  12639. <procedure> ::=
  12640. PROCEDURE <procedure name> <parameter declaration list> <semicolon>
  12641. <SQL procedure statement> <semicolon>
  12642. <parameter declaration list> ::=
  12643. <left paren> <parameter declaration>
  12644. [ { <comma> <parameter declaration> }... ] <right paren>
  12645. | <parameter declaration>...
  12646. <parameter declaration> ::=
  12647. <parameter name> <data type>
  12648. | <status parameter>
  12649. <status parameter> ::=
  12650. SQLCODE | SQLSTATE
  12651. Syntax Rules
  12652. 1) The <procedure name> shall be different from the <procedure
  12653. name> of any other <procedure> in the containing <module>.
  12654. Note: The <procedure name> should be a standard-conforming pro-
  12655. cedure, function, or routine name of the language specified by
  12656. the subject <language clause>. Failure to observe this recommen-
  12657. dation will have implementation-dependent effects.
  12658. 2) The <parameter name> of each <parameter declaration> in a <pro-
  12659. cedure> shall be different from the <parameter name> of any
  12660. other <parameter declaration> in that <procedure>.
  12661. 3) Any <parameter name> contained in the <SQL procedure statement>
  12662. of a <procedure> shall be specified in a <parameter declaration>
  12663. in that <procedure>.
  12664. Note: <parameter declaration>s in a <procedure> without enclos-
  12665. ing parentheses and without commas separating multiple <param-
  12666. eter declaration>s is a deprecated feature that is supported
  12667. for compatibility with earlier versions of this International
  12668. Standard. See Annex D, "Deprecated features".
  12669. 4) A call of a <procedure> shall supply n parameters, where n is
  12670. the number of <parameter declaration>s in the <procedure>.
  12671. 346 Database Language SQL
  12672. X3H2-92-154/DBL CBR-002
  12673. 12.3 <procedure>
  12674. 5) A <procedure> shall contain at least one <status parameter>, at
  12675. most one <status parameter> that specifies SQLCODE, and at most
  12676. one <status parameter> that specifies SQLSTATE. A parameter that
  12677. corresponds with SQLCODE is referred to as an SQLCODE parameter.
  12678. A parameter that corresponds with SQLSTATE is referred to as
  12679. an SQLSTATE parameter. The SQLCODE and SQLSTATE parameters are
  12680. referred to as status parameters.
  12681. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  12682. status parameter is a deprecated feature that is supported
  12683. for compatibility with earlier versions of this International
  12684. Standard. See Annex D, "Deprecated features".
  12685. 6) Whether a <parameter declaration> is for an input parameter, an
  12686. output parameter, or both is determined as follows:
  12687. Case:
  12688. a) A <status parameter> is an output parameter.
  12689. b) For every <parameter declaration> that is not a <status pa-
  12690. rameter>,
  12691. Case:
  12692. i) If the <parameter name> of a parameter is contained in a
  12693. <value specification> or a <simple value specification>
  12694. that is contained in <SQL procedure statement>, but it
  12695. is not contained in a <target specification> or a <simple
  12696. target specification> that is contained in <SQL procedure
  12697. statement>, then the parameter is an input parameter.
  12698. ii) If the <parameter name> of a parameter is contained in a
  12699. <target specification> or a <simple target specification>
  12700. that is contained in <SQL procedure statement>, but it
  12701. is not contained in a <value specification> or a <simple
  12702. value specification> that is contained in <SQL procedure
  12703. statement>, then the parameter is an output parameter.
  12704. iii) If the <parameter name> of a parameter is contained in a
  12705. <value specification> or a <simple value specification>
  12706. that is contained in <SQL procedure statement> and it is
  12707. contained in a <target specification> or a <simple target
  12708. specification> that is contained in <SQL procedure state-
  12709. ment>, then the parameter is both an input parameter and an
  12710. output parameter.
  12711. iv) Otherwise, the parameter is neither an input parameter nor
  12712. an output parameter.
  12713. 7) The Syntax Rules of Subclause 12.4, "Calls to a <procedure>",
  12714. shall be true.
  12715. Module 347
  12716. X3H2-92-154/DBL CBR-002
  12717. 12.3 <procedure>
  12718. Access Rules
  12719. None.
  12720. General Rules
  12721. 1) A <procedure> defines a procedure that may be called by an SQL-
  12722. agent.
  12723. 2) If the <module> that contains the <procedure> is associated
  12724. with an SQL-agent that is associated with another <module> that
  12725. contains a <procedure> with the same <procedure name>, then the
  12726. effect is implementation-defined.
  12727. 3) If the <module> that contains the <procedure> has an explicit
  12728. <module authorization identifier> MAI that is different from the
  12729. SQL-session <authorization identifier> SAI, then:
  12730. a) Whether or not SAI can invoke <procedure>s in a <module>
  12731. with explicit <module authorization identifier> MAI is
  12732. implementation-defined, as are any restrictions pertaining
  12733. to such invocation.
  12734. b) If SAI is restricted from invoking a <procedure> in a <mod-
  12735. ule> with explicit <module authorization identifier> MAI,
  12736. then an exception condition is raised: invalid authorization
  12737. specification.
  12738. 4) If the value of any input parameter provided by the SQL-agent
  12739. falls outside the set of allowed values of the data type of the
  12740. parameter, or if the value of any output parameter resulting
  12741. from the execution of the <procedure> falls outside the set
  12742. of values supported by the SQL-agent for that parameter, then
  12743. the effect is implementation-defined. If the implementation-
  12744. defined effect is the raising of an exception condition, then an
  12745. exception condition is raised: data exception-invalid parameter
  12746. value.
  12747. 5) Let S be the <SQL procedure statement> of the <procedure>.
  12748. 6) When the <procedure> is called by an SQL-agent:
  12749. Case:
  12750. a) If S is an <SQL connection statement>, then:
  12751. i) The <module> that contains S is associated with the SQL-
  12752. agent.
  12753. ii) The diagnostics area is emptied.
  12754. iii) S is executed.
  12755. 348 Database Language SQL
  12756. X3H2-92-154/DBL CBR-002
  12757. 12.3 <procedure>
  12758. iv) If S successfully initiated or resumed an SQL-session,
  12759. then subsequent calls to a <procedure> by the SQL-agent
  12760. are associated with that SQL-session until the SQL-agent
  12761. terminates the SQL-session or makes it dormant.
  12762. b) If S is an <SQL diagnostics statement>, then:
  12763. i) The <module> that contains S is associated with the SQL-
  12764. agent.
  12765. ii) S is executed.
  12766. c) Otherwise:
  12767. i) If no SQL-session is current for the SQL-agent, then
  12768. Case:
  12769. 1) If the SQL-agent has not executed an <SQL connection
  12770. statement> and there is no default SQL-session asso-
  12771. ciated with the SQL-agent, then the following <connect
  12772. statement> is effectively executed:
  12773. CONNECT TO DEFAULT
  12774. 2) If the SQL-agent has not executed an <SQL connection
  12775. statement> and there is a default SQL-session associated
  12776. with the SQL-agent, then the following <set connection
  12777. statement> is effectively executed:
  12778. SET CONNECTION DEFAULT
  12779. 3) Otherwise, an exception condition is raised: connection
  12780. exception-connection does not exist.
  12781. Subsequent calls to a <procedure> or invocations of <direct
  12782. SQL statement>s by the SQL-agent are associated with the
  12783. SQL-session until the SQL-agent terminates the SQL-session
  12784. or makes it dormant.
  12785. ii) If an SQL-transaction is active for the SQL-agent, then S
  12786. is associated with that SQL-transaction.
  12787. iii) If no SQL-transaction is active for the SQL-agent and S is
  12788. a transaction-initiating SQL-statement, then
  12789. 1) An SQL-transaction is effectively initiated and asso-
  12790. ciated with this call and with subsequent calls of any
  12791. <procedure> or invocations of <direct SQL statement>s
  12792. by that SQL-agent until the SQL-agent terminates that
  12793. SQL-transaction.
  12794. 2) Case:
  12795. A) If a <set transaction statement> has been executed
  12796. since the termination of the last SQL-transaction
  12797. in the SQL-session, then the access mode, constraint
  12798. Module 349
  12799. X3H2-92-154/DBL CBR-002
  12800. 12.3 <procedure>
  12801. mode, and isolation level of the SQL-transaction are
  12802. set as specified by the <set transaction statement>.
  12803. B) Otherwise, the access mode of that SQL-transaction is
  12804. read-write, the constraint mode for all constraints in
  12805. that SQL-transaction is immediate, and the isolation
  12806. level of that SQL-transaction is SERIALIZABLE.
  12807. 3) The SQL-transaction is associated with the SQL-session.
  12808. 4) The <module> that contains S is associated with the
  12809. SQL-transaction.
  12810. iv) The <module> that contains S is associated with the SQL-
  12811. agent.
  12812. v) If S contains an <SQL schema statement> and the access
  12813. mode of the current SQL-transaction is read-only, then an
  12814. exception condition is raised: invalid transaction state.
  12815. vi) The diagnostics area is emptied.
  12816. vii) The values of all input parameters to the <procedure> are
  12817. established.
  12818. viii)S is executed.
  12819. 7) If the non-dynamic or dynamic execution of an <SQL data state-
  12820. ment> or the execution of an <SQL dynamic data statement>,
  12821. <dynamic select statement>, or <dynamic single row select state-
  12822. ment> occurs within the same SQL-transaction as the non-dynamic
  12823. or dynamic execution of an SQL-schema statement and this is not
  12824. allowed by the SQL-implementation, then an exception condition
  12825. is raised: invalid transaction state.
  12826. 8) When a <procedure> is called by an SQL-agent, let PDi be the
  12827. <parameter declaration> of the i-th parameter and let DTi and
  12828. PNi be the <data type> and the <parameter name> specified in
  12829. PDi, respectively. Let PIi be the i-th parameter in the proce-
  12830. dure call.
  12831. 9) If S is a <select statement: single row> or a <fetch statement>
  12832. and a completion condition no data is raised or an exception
  12833. condition is raised, then the value of each PIi for which PNi is
  12834. referenced in a <target specification> in S is implementation-
  12835. dependent.
  12836. 10)The General Rules of Subclause 12.4, "Calls to a <procedure>",
  12837. are evaluated.
  12838. 350 Database Language SQL
  12839. X3H2-92-154/DBL CBR-002
  12840. 12.3 <procedure>
  12841. 11)Case:
  12842. a) If S executed successfully, then
  12843. i) If there is more than one status parameter, then the order
  12844. in which values are assigned to these status parameters is
  12845. implementation-dependent.
  12846. ii) Either a completion condition is raised: successful com-
  12847. pletion, or a completion condition is raised: warning, or
  12848. a completion condition is raised: no data, as determined
  12849. by the General Rules in this and other Subclauses of this
  12850. International Standard.
  12851. b) If S did not execute successfully, then:
  12852. i) All changes made to SQL-data or schemas by the execution of
  12853. S are canceled.
  12854. ii) The status parameter(s) is (are) set to the value(s) speci-
  12855. fied for the condition in clause Clause 22, "Status codes".
  12856. If there is more than one status parameters, then the order
  12857. in which values are assigned to these status parameters is
  12858. implementation-dependent.
  12859. 12)Case:
  12860. a) If S is not an <SQL diagnostics statement>, then diagnostics
  12861. information resulting from the execution of S is placed into
  12862. the diagnostics area as specified in Clause 18, "Diagnostics
  12863. management".
  12864. b) If S is an <SQL diagnostics statement>, then the diagnostics
  12865. area is not updated.
  12866. Leveling Rules
  12867. 1) The following restrictions apply for Intermediate SQL:
  12868. a) A <parameter declaration> shall not specify a <data type>
  12869. that is BIT or BIT VARYING.
  12870. 2) The following restrictions apply for Entry SQL in addition to
  12871. any Intermediate SQL restrictions:
  12872. a) A <parameter declaration> shall not specify a <data type>
  12873. that is CHARACTER VARYING.
  12874. Module 351
  12875. X3H2-92-154/DBL CBR-002
  12876. 12.4 Calls to a <procedure>
  12877. 12.4 Calls to a <procedure>
  12878. Function
  12879. Define the call to a <procedure> by an SQL-agent.
  12880. Syntax Rules
  12881. 1) If the subject <language clause> specifies ADA, then:
  12882. a) The <procedure>s of the <module> are identified by the <pro-
  12883. cedure name> as if they were declared immediately within an
  12884. Ada library unit package specification that has a name iden-
  12885. tical to the <module name> of the containing <module>. The
  12886. SQL-implementation shall generate the source code of the Ada
  12887. library unit package specification.
  12888. b) Any <data type> in a <parameter declaration> shall specify
  12889. CHARACTER, BIT, SMALLINT, INTEGER, REAL, or DOUBLE PRECISION.
  12890. c) The base type of any parameter shall be an Ada data type de-
  12891. clared in an Ada package named SQL_STANDARD of the following
  12892. form:
  12893. package SQL_STANDARD is
  12894. package CHARACTER_SET renames csp;
  12895. subtype CHARACTER_TYPE is CHARACTER_SET.cst;
  12896. type CHAR is array (POSITIVE range <>) of CHARACTER_
  12897. TYPE;
  12898. type BIT is array (NATURAL range <>) of BOOLEAN;
  12899. type SMALLINT is range bs .. ts;
  12900. type INT is range bi .. ti;
  12901. type REAL is digits dr;
  12902. type DOUBLE_PRECISION is digits dd;
  12903. subtype INDICATOR_TYPE is t;
  12904. type SQLCODE_TYPE is range bsc .. tsc;
  12905. subtype SQL_ERROR is SQLCODE_TYPE range SQL_TYPE'FIRST .. -
  12906. 1;
  12907. subtype NOT_FOUND is SQLCODE_TYPE range 100 .. 100;
  12908. type SQLSTATE_TYPE is new CHAR (1 .. 5);
  12909. package SQLSTATE_CODES is
  12910. AMBIGUOUS_CURSOR_NAME_NO_SUBCLASS:
  12911. constant SQLSTATE_TYPE :="3C000";
  12912. CARDINALITY_VIOLATION_NO_SUBCLASS:
  12913. constant SQLSTATE_TYPE :="21000";
  12914. CONNECTION_EXCEPTION_NO_SUBCLASS:
  12915. constant SQLSTATE_TYPE :="08000";
  12916. CONNECTION_EXCEPTION_CONNECTION_DOES_NOT_EXIST:
  12917. constant SQLSTATE_TYPE :="08003";
  12918. CONNECTION_EXCEPTION_CONNECTION_FAILURE:
  12919. constant SQLSTATE_TYPE :="08006";
  12920. CONNECTION_EXCEPTION_CONNECTION_NAME_IN_USE:
  12921. constant SQLSTATE_TYPE :="08002";
  12922. 352 Database Language SQL
  12923. X3H2-92-154/DBL CBR-002
  12924. 12.4 Calls to a <procedure>
  12925. CONNECTION_EXCEPTION_SQLCLIENT_UNABLE_TO_ESTABLISH_
  12926. SQLCONNECTION:
  12927. constant SQLSTATE_TYPE :="08001";
  12928. CONNECTION_EXCEPTION_SQLSERVER_REJECTED_ESTABLISHMENT_
  12929. OF_SQLCONNECTION:
  12930. constant SQLSTATE_TYPE :="08004";
  12931. CONNECTION_EXCEPTION_TRANSACTION_RESOLUTION_
  12932. UNKNOWN:
  12933. constant SQLSTATE_TYPE :="08007";
  12934. DATA_EXCEPTION_NO_SUBCLASS:
  12935. constant SQLSTATE_TYPE :="22000";
  12936. DATA_EXCEPTION_CHARACTER_NOT_IN_REPERTOIRE:
  12937. constant SQLSTATE_TYPE :="22021";
  12938. DATA_EXCEPTION_DATETIME_FIELD_OVERFLOW:
  12939. constant SQLSTATE_TYPE :="22008";
  12940. DATA_EXCEPTION_DIVISION_BY_ZERO:
  12941. constant SQLSTATE_TYPE :="22012";
  12942. DATA_EXCEPTION_ERROR_IN_ASSIGNMENT:
  12943. constant SQLSTATE_TYPE :="22005";
  12944. DATA_EXCEPTION_INDICATOR_OVERFLOW:
  12945. constant SQLSTATE_TYPE :="22022";
  12946. DATA_EXCEPTION_INTERVAL_FIELD_OVERFLOW:
  12947. constant SQLSTATE_TYPE :="22015";
  12948. DATA_EXCEPTION_INVALID_CHARACTER_VALUE_FOR_CAST:
  12949. constant SQLSTATE_TYPE :="22018";
  12950. DATA_EXCEPTION_INVALID_DATETIME_FORMAT:
  12951. constant SQLSTATE_TYPE :="22007";
  12952. DATA_EXCEPTION_INVALID_ESCAPE_CHARACTER:
  12953. constant SQLSTATE_TYPE :="22019";
  12954. DATA_EXCEPTION_INVALID_ESCAPE_SEQUENCE:
  12955. constant SQLSTATE_TYPE :="22025";
  12956. DATA_EXCEPTION_INVALID_PARAMETER_VALUE:
  12957. constant SQLSTATE_TYPE :="22023";
  12958. DATA_EXCEPTION_INVALID_TIME_ZONE_DISPLACEMENT_
  12959. VALUE:
  12960. constant SQLSTATE_TYPE :="22009";
  12961. DATA_EXCEPTION_NULL_VALUE_NO_INDICATOR_PARAMETER:
  12962. constant SQLSTATE_TYPE :="22002";
  12963. DATA_EXCEPTION_NUMERIC_VALUE_OUT_OF_RANGE:
  12964. constant SQLSTATE_TYPE :="22003";
  12965. DATA_EXCEPTION_STRING_DATA_LENGTH_MISMATCH:
  12966. constant SQLSTATE_TYPE :="22026";
  12967. DATA_EXCEPTION_STRING_DATA_RIGHT_TRUNCATION:
  12968. constant SQLSTATE_TYPE :="22001";
  12969. DATA_EXCEPTION_SUBSTRING_ERROR:
  12970. constant SQLSTATE_TYPE :="22011";
  12971. DATA_EXCEPTION_TRIM_ERROR:
  12972. constant SQLSTATE_TYPE :="22027";
  12973. DATA_EXCEPTION_UNTERMINATED_C_STRING:
  12974. constant SQLSTATE_TYPE :="22024";
  12975. DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST_NO_
  12976. SUBCLASS:
  12977. constant SQLSTATE_TYPE :="2B000";
  12978. Module 353
  12979. X3H2-92-154/DBL CBR-002
  12980. 12.4 Calls to a <procedure>
  12981. DYNAMIC_SQL_ERROR_NO_SUBCLASS:
  12982. constant SQLSTATE_TYPE :="07000";
  12983. DYNAMIC_SQL_ERROR_CURSOR_SPECIFICATION_CANNOT_BE_
  12984. EXECUTED:
  12985. constant SQLSTATE_TYPE :="07003";
  12986. DYNAMIC_SQL_ERROR_INVALID_DESCRIPTOR_COUNT:
  12987. constant SQLSTATE_TYPE :="07008";
  12988. DYNAMIC_SQL_ERROR_INVALID_DESCRIPTOR_INDEX:
  12989. constant SQLSTATE_TYPE :="07009";
  12990. DYNAMIC_SQL_ERROR_PREPARED_STATEMENT_NOT_A_CURSOR_
  12991. SPECIFICATION:
  12992. constant SQLSTATE_TYPE :="07005";
  12993. DYNAMIC_SQL_ERROR_RESTRICTED_DATA_TYPE_ATTRIBUTE_
  12994. VIOLATION:
  12995. constant SQLSTATE_TYPE :="07006";
  12996. DYNAMIC_SQL_ERROR_USING_CLAUSE_DOES_NOT_MATCH_
  12997. DYNAMIC_PARAMETER_SPEC:
  12998. constant SQLSTATE_TYPE :="07001";
  12999. DYNAMIC_SQL_ERROR_USING_CLAUSE_DOES_NOT_MATCH_
  13000. TARGET_SPEC:
  13001. constant SQLSTATE_TYPE :="07002";
  13002. DYNAMIC_SQL_ERROR_USING_CLAUSE_REQUIRED_FOR_
  13003. DYNAMIC_PARAMETERS:
  13004. constant SQLSTATE_TYPE :="07004";
  13005. DYNAMIC_SQL_ERROR_USING_CLAUSE_REQUIRED_FOR_RESULT_
  13006. FIELDS:
  13007. constant SQLSTATE_TYPE :="07007";
  13008. FEATURE_NOT_SUPPORTED_NO_SUBCLASS:
  13009. constant SQLSTATE_TYPE :="0A000";
  13010. FEATURE_NOT_SUPPORTED_MULTIPLE_ENVIRONMENT_
  13011. TRANSACTIONS:
  13012. constant SQLSTATE_TYPE :="0A001";
  13013. INTEGRITY_CONSTRAINT_VIOLATION_NO_SUBCLASS:
  13014. constant SQLSTATE_TYPE :="23000";
  13015. INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS:
  13016. constant SQLSTATE_TYPE :="28000";
  13017. INVALID_CATALOG_NAME_NO_SUBCLASS:
  13018. constant SQLSTATE_TYPE :="3D000";
  13019. INVALID_CHARACTER_SET_NAME_NO_SUBCLASS:
  13020. constant SQLSTATE_TYPE :="2C000";
  13021. INVALID_CONDITION_NUMBER_NO_SUBCLASS:
  13022. constant SQLSTATE_TYPE :="35000";
  13023. INVALID_CONNECTION_NAME_NO_SUBCLASS:
  13024. constant SQLSTATE_TYPE :="2E000";
  13025. INVALID_CURSOR_NAME_NO_SUBCLASS:
  13026. constant SQLSTATE_TYPE :="34000";
  13027. INVALID_CURSOR_STATE_NO_SUBCLASS:
  13028. constant SQLSTATE_TYPE :="24000";
  13029. INVALID_SCHEMA_NAME_NO_SUBCLASS:
  13030. constant SQLSTATE_TYPE :="3F000";
  13031. INVALID_SQL_DESCRIPTOR_NAME_NO_SUBCLASS:
  13032. constant SQLSTATE_TYPE :="33000";
  13033. INVALID_SQL_STATEMENT_NAME_NO_SUBCLASS:
  13034. 354 Database Language SQL
  13035. X3H2-92-154/DBL CBR-002
  13036. 12.4 Calls to a <procedure>
  13037. constant SQLSTATE_TYPE :="26000";
  13038. INVALID_TRANSACTION_STATE_NO_SUBCLASS:
  13039. constant SQLSTATE_TYPE :="25000";
  13040. INVALID_TRANSACTION_TERMINATION_NO_SUBCLASS:
  13041. constant SQLSTATE_TYPE :="2D000";
  13042. NO_DATA_NO_SUBCLASS:
  13043. constant SQLSTATE_TYPE :="02000";
  13044. REMOTE_DATABASE_ACCESS_NO_SUBCLASS:
  13045. constant SQLSTATE_TYPE :="HZ000";
  13046. SUCCESSFUL_COMPLETION_NO_SUBCLASS:
  13047. constant SQLSTATE_TYPE :="00000";
  13048. SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_NO_SUBCLASS:
  13049. constant SQLSTATE_TYPE :="42000";
  13050. SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DIRECT_
  13051. STATEMENT_NO_SUBCLASS:
  13052. constant SQLSTATE_TYPE :="2A000";
  13053. SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DYNAMIC_
  13054. STATEMENT_NO_SUBCLASS:
  13055. constant SQLSTATE_TYPE :="37000";
  13056. TRANSACTION_ROLLBACK_NO_SUBCLASS:
  13057. constant SQLSTATE_TYPE :="40000";
  13058. TRANSACTION_ROLLBACK_INTEGRITY_CONSTRAINT_
  13059. VIOLATION:
  13060. constant SQLSTATE_TYPE :="40002";
  13061. TRANSACTION_ROLLBACK_SERIALIZATION_FAILURE:
  13062. constant SQLSTATE_TYPE :="40001";
  13063. TRANSACTION_ROLLBACK_STATEMENT_COMPLETION_UNKNOWN:
  13064. constant SQLSTATE_TYPE :="40003";
  13065. TRIGGERED_DATA_CHANGE_VIOLATION_NO_SUBCLASS:
  13066. constant SQLSTATE_TYPE :="27000";
  13067. WARNING_NO_SUBCLASS:
  13068. constant SQLSTATE_TYPE :="01000";
  13069. WARNING_CURSOR_OPERATION_CONFLICT:
  13070. constant SQLSTATE_TYPE :="01001";
  13071. WARNING_DISCONNECT_ERROR:
  13072. constant SQLSTATE_TYPE :="01002";
  13073. WARNING_IMPLICIT_ZERO_BIT_PADDING:
  13074. constant SQLSTATE_TYPE :="01008";
  13075. WARNING_INSUFFICIENT_ITEM_DESCRIPTOR_AREAS:
  13076. constant SQLSTATE_TYPE :="01005";
  13077. WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION:
  13078. constant SQLSTATE_TYPE :="01003";
  13079. WARNING_PRIVILEGE_NOT_GRANTED:
  13080. constant SQLSTATE_TYPE :="01007";
  13081. WARNING_PRIVILEGE_NOT_REVOKED:
  13082. constant SQLSTATE_TYPE :="01006";
  13083. WARNING_QUERY_EXPRESSION_TOO_LONG_FOR_INFORMATION_
  13084. SCHEMA:
  13085. constant SQLSTATE_TYPE :="0100A";
  13086. WARNING_SEARCH_CONDITION_TOO_LONG_FOR_INFORMATION_
  13087. SCHEMA:
  13088. constant SQLSTATE_TYPE :="01009";
  13089. Module 355
  13090. X3H2-92-154/DBL CBR-002
  13091. 12.4 Calls to a <procedure>
  13092. WARNING_STRING_DATA_RIGHT_TRUNCATION_WARNING:
  13093. constant SQLSTATE_TYPE :="01004";
  13094. WITH_CHECK_OPTION_VIOLATION_NO_SUBCLASS:
  13095. constant SQLSTATE_TYPE :="44000";
  13096. end SQLSTATE_CODES;
  13097. end SQL_STANDARD;
  13098. where csp is an implementation-defined package and cst is an
  13099. implementation-defined character type such that within the
  13100. scope of an Ada use clause for
  13101. SQL_STANDARD.CHARACTER_SET, string literals can be of type
  13102. SQL_STANDARD.CHAR. bs, ts, bi, ti, dr, dd, bsc, and tsc are
  13103. implementation-defined integer values. t is INT or SMALLINT,
  13104. corresponding with an implementation-defined <exact numeric
  13105. type> of indicator parameters.
  13106. SQL_STANDARD shall contain no other declarations.
  13107. d) The base type of the SQLCODE parameter shall be
  13108. SQL_STANDARD.SQLCODE_TYPE
  13109. The base type of the SQLSTATE parameter shall be
  13110. SQL_STANDARD.SQLSTATE_TYPE
  13111. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13112. status parameter is a deprecated feature that is supported
  13113. for compatibility with earlier versions of this International
  13114. Standard. See Annex D, "Deprecated features".
  13115. e) The Ada parameter mode of the SQLCODE parameter is out. The
  13116. Ada parameter mode of the SQLSTATE parameter is out.
  13117. f) If the i-th <parameter declaration> specifies a <data type>
  13118. PDT that is CHARACTER(L) for some <length> L, then the base
  13119. type of the i-th parameter P shall be SQL_STANDARD.CHAR, with
  13120. P'LENGTH equal to the maximum possible length in octets of
  13121. PDT.
  13122. g) If the i-th <parameter declaration> specifies a <data type>
  13123. that is BIT(L) for some <length> L, then the base type of
  13124. the i-th parameter P shall be SQL_STANDARD.BIT with P'LENGTH
  13125. equal to L.
  13126. Note: BOOLEAN is the predefined enumeration type STANDARD.BOOLEAN
  13127. with values (FALSE, TRUE). The equivalences
  13128. BOOLEAN'POS(FALSE) � 0
  13129. BOOLEAN'POS(TRUE) � 1
  13130. define the correspondence between the bit values of 0 and 1
  13131. and the Boolean values of false and true, respectively.
  13132. h) If the i-th <parameter declaration> specifies a <data type>
  13133. that is SMALLINT, then the base type of the i-th parameter
  13134. shall be SQL_STANDARD.SMALLINT.
  13135. 356 Database Language SQL
  13136. X3H2-92-154/DBL CBR-002
  13137. 12.4 Calls to a <procedure>
  13138. i) If the i-th <parameter declaration> specifies a <data type>
  13139. that is INTEGER, then the base type of the i-th parameter
  13140. shall be SQL_STANDARD.INT.
  13141. j) If the i-th <parameter declaration> specifies a <data type>
  13142. that is REAL, then the base type of the i-th parameter shall
  13143. be SQL_STANDARD.REAL.
  13144. k) If the i-th <parameter declaration> specifies a <data type>
  13145. that is DOUBLE PRECISION, then the base type of the i-th
  13146. parameter shall be SQL_STANDARD. DOUBLE_PRECISION.
  13147. l) For every parameter,
  13148. Case:
  13149. i) If the parameter is an input parameter but not an output
  13150. parameter, then the Ada parameter mode is in.
  13151. ii) If the parameter is an output parameter but not an input
  13152. parameter, then the Ada parameter mode is out.
  13153. iii) If the parameter is both an input parameter and an output
  13154. parameter, then the Ada parameter mode is in out.
  13155. iv) Otherwise, the Ada parameter mode is in, out, or in out.
  13156. 2) If the subject <language clause> specifies C, then:
  13157. a) The type of an SQLCODE parameter shall be C pointer to long.
  13158. The type of an SQLSTATE parameter shall be C char with length
  13159. 6.
  13160. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13161. status parameter is a deprecated feature that is supported
  13162. for compatibility with earlier versions of this International
  13163. Standard. See Annex D, "Deprecated features".
  13164. b) Any <data type> in a <parameter declaration> shall specify
  13165. either CHARACTER, CHARACTER VARYING, BIT, INTEGER, SMALLINT,
  13166. REAL, or DOUBLE PRECISION.
  13167. c) If the i-th <parameter declaration> specifies a <data type>
  13168. PDT that is CHARACTER(L) or CHARACTER VARYING(L) for some
  13169. <length> L, then the type of the i-th parameter P shall be C
  13170. char with length one greater than the maximum possible length
  13171. in octets of PDT.
  13172. d) If the i-th <parameter declaration> specifies a <data type>
  13173. that is BIT(L) for some <length> L, then the type of the i-th
  13174. parameter is C char with length equal to the smallest integer
  13175. not less than the quotient of the division of (L/(B+1)),
  13176. where B is the implementation-defined number of bits in a C
  13177. character.
  13178. Module 357
  13179. X3H2-92-154/DBL CBR-002
  13180. 12.4 Calls to a <procedure>
  13181. e) If the i-th <parameter declaration> specifies a <data type>
  13182. that is INTEGER, then the type of the i-th parameter shall be
  13183. C pointer to long.
  13184. f) If the i-th <parameter declaration> specifies a <data type>
  13185. that is SMALLINT, then the type of the i-th parameter shall
  13186. be C pointer to short.
  13187. g) If the i-th <parameter declaration> specifies a <data type>
  13188. that is REAL, then the type of the i-th parameter shall be C
  13189. pointer to float.
  13190. h) If the i-th <parameter declaration> specifies a <data type>
  13191. that is DOUBLE PRECISION, then the type of the i-th parameter
  13192. shall be C pointer to double.
  13193. 3) If the subject <language clause> specifies COBOL, then:
  13194. a) The type of an SQLCODE parameter shall be COBOL PICTURE
  13195. S9(PC) USAGE COMPUTATIONAL, where PC is an implementation-
  13196. defined precision between 4 and 18, inclusive.
  13197. The type of an SQLSTATE parameter shall be COBOL PICTURE
  13198. X(5).
  13199. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13200. status parameter is a deprecated feature that is supported
  13201. for compatibility with earlier versions of this International
  13202. Standard. See Annex D, "Deprecated features".
  13203. b) Any <data type> in a <parameter declaration> shall specify
  13204. CHARACTER, BIT, NUMERIC, INTEGER, or SMALLINT.
  13205. c) If the i-th <parameter declaration> specifies a <data type>
  13206. PDT that is CHARACTER(L) for some <length> L, then the type
  13207. of the i-th parameter P shall be COBOL alphanumeric with
  13208. length equal to the maximum possible length in octets of PDT.
  13209. d) If the i-th <parameter declaration> specifies a <data type>
  13210. that is BIT(L) for some <length> L, then the type of the i-
  13211. th parameter is COBOL alphanumeric with length equal to the
  13212. smallest integer not less than the quotient of the division
  13213. L/B, where B is the implementation-defined number of bits in
  13214. a COBOL character.
  13215. e) If the i-th <parameter declaration> specifies a <data type>
  13216. that is NUMERIC(P, S) for some <precision> and <scale> P and
  13217. S, then the type of the i-th parameter shall be COBOL USAGE
  13218. DISPLAY SIGN LEADING SEPARATE with the following PICTURE:
  13219. Case:
  13220. i) If S=P, then a PICTURE with an "S" followed by a "V" fol-
  13221. lowed by P "9"s.
  13222. 358 Database Language SQL
  13223. X3H2-92-154/DBL CBR-002
  13224. 12.4 Calls to a <procedure>
  13225. ii) If P>S>0, then a PICTURE with an "S" followed by P-S "9"s
  13226. followed by a "V" followed by S "9"s.
  13227. iii) If S=0, then a PICTURE with an "S" followed by P "9"s op-
  13228. tionally followed by a "V".
  13229. f) If the i-th <parameter declaration> specifies a <data
  13230. type> that is INTEGER, then the type of the i-th parameter
  13231. shall be COBOL PICTURE S9(PI) USAGE BINARY, where PI is an
  13232. implementation-defined precision.
  13233. g) If the i-th <parameter declaration> specifies a <data type>
  13234. that is SMALLINT, then the type of the i-th parameter shall
  13235. be COBOL PICTURE S9(SPI) USAGE BINARY, where SPI is an
  13236. implementation-defined precision.
  13237. 4) If the subject <language clause> specifies FORTRAN, then:
  13238. a) The type of an SQLCODE parameter shall be Fortran INTEGER.
  13239. The type of an SQLSTATE parameter shall be Fortran CHARACTER
  13240. with length 5.
  13241. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13242. status parameter is a deprecated feature that is supported
  13243. for compatibility with earlier versions of this International
  13244. Standard. See Annex D, "Deprecated features".
  13245. b) Any <data type> in a <parameter declaration> shall specify
  13246. either CHARACTER, BIT, INTEGER, REAL, or DOUBLE PRECISION.
  13247. c) If the i-th <parameter declaration> specifies a <data type>
  13248. PDT that is CHARACTER(L) for some <length> L, then the type
  13249. of the i-th parameter P shall be Fortran CHARACTER with
  13250. length equal to the maximum possible length in octets of PDT.
  13251. d) If the i-th <parameter declaration> specifies a <data type>
  13252. that is BIT(L) for some <length> L, then the type of the i-
  13253. th parameter is Fortran CHARACTER with length equal to the
  13254. smallest integer not less than the quotient of the division
  13255. L/B, where B is the implementation-defined number of bits in
  13256. a Fortran character.
  13257. e) If the i-th <parameter declaration> specifies a <data type>
  13258. that is INTEGER, REAL, or DOUBLE PRECISION, then the type
  13259. of the i-th parameter shall be respectively Fortran INTEGER,
  13260. REAL, or DOUBLE PRECISION.
  13261. 5) If the subject <language clause> specifies MUMPS, then:
  13262. a) The type of an SQLSTATE parameter shall be MUMPS character
  13263. with maximum length greater than or equal to 5.
  13264. Module 359
  13265. X3H2-92-154/DBL CBR-002
  13266. 12.4 Calls to a <procedure>
  13267. The type of the SQLCODE parameter shall be INTEGER.
  13268. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13269. status parameter is a deprecated feature that is supported
  13270. for compatibility with earlier versions of this International
  13271. Standard. See Annex D, "Deprecated features".
  13272. b) Any <data type> in a <parameter declaration> shall specify
  13273. either CHARACTER VARYING, INTEGER, DECIMAL, or REAL.
  13274. c) If the i-th <parameter declaration> specifies a <data type>
  13275. PDT that is CHARACTER VARYING(L) for some <length> L, then
  13276. the type of the i-th parameter shall be MUMPS character with
  13277. maximum length equal to the maximum possible length in octets
  13278. of PDT.
  13279. d) If the i-th <parameter declaration> specifies a <data type>
  13280. DT that is INTEGER, DECIMAL, or REAL, then the type of the
  13281. i-th parameter shall be MUMPS character.
  13282. 6) If the subject <language clause> specifies PASCAL, then:
  13283. a) The type of an SQLCODE parameter shall be Pascal INTEGER.
  13284. The type of an SQLSTATE parameter shall be Pascal PACKED
  13285. ARRAY [1..5] OF CHAR.
  13286. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13287. status parameter is a deprecated feature that is supported
  13288. for compatibility with earlier versions of this International
  13289. Standard. See Annex D, "Deprecated features".
  13290. b) The argument mode of all parameters shall be VAR.
  13291. c) Any <data type> in a <parameter declaration> shall specify
  13292. either CHARACTER, BIT, INTEGER, or REAL.
  13293. d) If the i-th <parameter declaration> specifies a <data type>
  13294. PDT that is CHARACTER(L) for some <length> L, then let OL be
  13295. the maximum possible length in octets of PDT. The type of the
  13296. i-th parameter shall be
  13297. Case:
  13298. 1) If OL is 1, then Pascal CHAR.
  13299. 2) Otherwise, Pascal PACKED ARRAY [1..OL] OF CHAR.
  13300. e) If the i-th <parameter declaration> specifies a <data
  13301. type> that is BIT(L) for some <length> L, then let B be the
  13302. implementation-defined number of bits in a Pascal character;
  13303. the type of the i-th parameter is
  13304. Case:
  13305. i) If L is between 1 and B, inclusive, then Pascal CHAR.
  13306. 360 Database Language SQL
  13307. X3H2-92-154/DBL CBR-002
  13308. 12.4 Calls to a <procedure>
  13309. ii) Otherwise, let BL be equal to the smallest integer not less
  13310. than the quotient of the division L/B; the type is Pascal
  13311. PACKED ARRAY [1..BL] OF CHAR.
  13312. f) If the i-th <parameter declaration> specifies a <data type>
  13313. that is INTEGER or REAL, then the type of the i-th parameter
  13314. shall be respectively Pascal INTEGER or Pascal REAL.
  13315. 7) If the subject <language clause> specifies PLI, then:
  13316. a) The type of an SQLCODE parameter shall be PL/I FIXED BINARY
  13317. (PP), where PP is an implementation-defined precision that is
  13318. greater than or equal to 15.
  13319. The type of an SQLSTATE parameter shall be PL/I CHARACTER(5).
  13320. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  13321. status parameter is a deprecated feature that is supported
  13322. for compatibility with earlier versions of this International
  13323. Standard. See Annex D, "Deprecated features".
  13324. b) Any <data type> in a <parameter declaration> shall spec-
  13325. ify either CHARACTER, CHARACTER VARYING, BIT, BIT VARYING,
  13326. DECIMAL, INTEGER, SMALLINT, or FLOAT.
  13327. c) If the i-th <parameter declaration> specifies a <data type>
  13328. PDT that is CHARACTER(L) for some <length> L, then the type
  13329. of the i-th parameter P shall be PL/I CHARACTER with length
  13330. equal to the maximum possible length in octets of PDT.
  13331. d) If the i-th <parameter declaration> specifies a <data type>
  13332. PDT that is CHARACTER VARYING(L) for some <length> L, then
  13333. the type of the i-th parameter P shall be PL/I CHARACTER
  13334. VARYING with maximum length equal to maximum possible length
  13335. in octets of PDT.
  13336. e) If the i-th <parameter declaration> specifies a <data type>
  13337. that is BIT(L) or BIT VARYING(L) for some <length> L, then
  13338. the type of the i-th parameter is PL/I BIT with length L or
  13339. PL/I BIT VARYING with maximum length L, respectively.
  13340. f) If the i-th <parameter declaration> specifies a <data type>
  13341. that is DECIMAL(P, S) for some <precision> and <scale> P and
  13342. S, then the type of the i-th parameter shall be PL/I FIXED
  13343. REAL DECIMAL (P,S).
  13344. g) If the i-th <parameter declaration> specifies a <data type>
  13345. that is FLOAT(P) for some <precision> P, then the type of the
  13346. i-th parameter shall be PL/I FLOAT REAL BINARY (P).
  13347. h) If the i-th <parameter declaration> specifies a <data type>
  13348. that is INTEGER, then the type of the i-th parameter shall be
  13349. PL/I FIXED BINARY(PI), where PI is an implementation-defined
  13350. precision.
  13351. Module 361
  13352. X3H2-92-154/DBL CBR-002
  13353. 12.4 Calls to a <procedure>
  13354. i) If the i-th <parameter declaration> specifies a <data type>
  13355. that is SMALLINT, then the type of the i-th parameter shall
  13356. be PL/I FIXED BINARY(SPI), where SPI is an implementation-
  13357. defined precision.
  13358. Access Rules
  13359. None.
  13360. General Rules
  13361. 1) If the subject <language clause> specifies ADA, then:
  13362. a) Where Pi is used as an input parameter whose value is eval-
  13363. uated, a reference to PNi in a <general value specification>
  13364. has the value PIi.
  13365. b) Where Pi is used as an output parameter, a reference to PNi
  13366. that assigns a value SVi to PNi implicitly assigns the value
  13367. SVi to PIi.
  13368. 2) If the subject <language clause> specifies C, then:
  13369. Case:
  13370. a) If Di specifies BIT(L), then:
  13371. i) Where PNi is used as an input parameter whose value is
  13372. evaluated, a reference to PNi is implicitly treated as:
  13373. SUBSTRING ( CAST ( PIi AS BIT VARYING(ML) ) FROM 1 FOR L
  13374. )
  13375. where ML is the implementation-defined maximum length of a
  13376. BIT VARYING data type.
  13377. ii) Let BLi be the length in bits of PIi. Let BL be the
  13378. implementation-defined number of bits in a C character.
  13379. Let OL be the smallest integer not less than the quotient
  13380. of BLi/BL. Where PNi is used as an output parameter, a ref-
  13381. erence to PNi that assigns a value SVi to PNi implicitly
  13382. assigns the value
  13383. CAST ( SVi AS CHARACTER(OL) )
  13384. to PIi.
  13385. b) If Di specifies CHARACTER(L) or CHARACTER VARYING(L), then:
  13386. i) Where PNi is used as an input parameter whose value is
  13387. evaluated, a reference to PNi is implicitly treated as an
  13388. SQL character type value in the specified character set in
  13389. which the octets of PIi are the corresponding octets of
  13390. that value.
  13391. 362 Database Language SQL
  13392. X3H2-92-154/DBL CBR-002
  13393. 12.4 Calls to a <procedure>
  13394. When such a reference is evaluated:
  13395. 1) If Di specifies CHARACTER(L) and some C character pre-
  13396. ceding the least significant C character of the value
  13397. PIi contains the implementation-defined null character
  13398. that terminates a C character string, then the remaining
  13399. characters of the value are set to <space>s.
  13400. 2) If Di specifies CHARACTER(L) VARYING, then the length
  13401. in characters of the value is set to the number of char-
  13402. acters of PIi that precede the implementation-defined
  13403. null character that terminates a C character string.
  13404. 3) If the least significant C character of the value Pi
  13405. does not contain the implementation-defined null char-
  13406. acter that terminates a C character string, then an ex-
  13407. ception condition is raised: data exception-unterminated
  13408. C string. Otherwise, that least significant C charac-
  13409. ter does not correspond to any character in PIi and is
  13410. ignored.
  13411. ii) Let CLi be one greater than the maximum possible length in
  13412. octets of PNi. Where PNi is used as an output parameter, a
  13413. reference to PNi that assigns a value SVi to PNi implic-
  13414. itly assigns a value that is an SQL CHARACTER(CLi) data
  13415. type in which octets of the value are the corresponding
  13416. octets of SVi, padded on the right with <space>s as nec-
  13417. essary to reach the length CLi, concatenated with a single
  13418. implementation-defined null character that terminates a C
  13419. character string.
  13420. c) Otherwise,
  13421. i) Where PNi is used as an input parameter whose value is
  13422. evaluated, a reference to PNi has the value PIi.
  13423. ii) Where PNi is used as an output parameter, a reference to
  13424. PNi that assigns a value SVi to PNi implicitly assigns the
  13425. value SVi to PIi.
  13426. 3) If the subject <language clause> specifies COBOL, then:
  13427. Case:
  13428. a) If Di specifies BIT(L), then:
  13429. i) Where PNi is used as an input parameter whose value is
  13430. evaluated, a reference to PNi is implicitly treated as:
  13431. SUBSTRING ( CAST ( PIi AS BIT VARYING(ML) ) FROM 1 FOR L
  13432. )
  13433. where ML is the implementation-defined maximum length of a
  13434. BIT VARYING data type.
  13435. Module 363
  13436. X3H2-92-154/DBL CBR-002
  13437. 12.4 Calls to a <procedure>
  13438. ii) Let BLi be the length in bits of PIi. Let BL be the
  13439. implementation-defined number of bits in a COBOL character.
  13440. Let OL be the smallest integer not less than the quotient
  13441. of BLi/BL. Where PNi is used as an output parameter, a ref-
  13442. erence to PNi that assigns a value SVi to PNi implicitly
  13443. assigns the value
  13444. CAST ( SVi AS CHARACTER(OL) )
  13445. to PIi.
  13446. b) If Di specifies CHARACTER(L), then:
  13447. i) Where PNi is used as an input parameter whose value is
  13448. evaluated, a reference to PNi is implicitly treated as an
  13449. SQL character type value in the specified character set in
  13450. which the octets of PIi are the corresponding octets of
  13451. that value.
  13452. ii) Let CLi be the maximum possible length in octets of PNi.
  13453. Where PNi is used as an output parameter, a reference to
  13454. PNi that assigns a value SVi to PNi implicitly assigns
  13455. a value that is an SQL CHARACTER(CLi) data type in which
  13456. octets of the value are the corresponding octets of SVi,
  13457. padded on the right with <space>s as necessary to reach the
  13458. length CLi.
  13459. c) Otherwise,
  13460. i) Where PNi is used as an input parameter whose value is
  13461. evaluated, a reference to PNi has the value PIi.
  13462. ii) Where PNi is used as an output parameter, a reference to
  13463. PNi that assigns a value SVi to PNi implicitly assigns the
  13464. value SVi to PIi.
  13465. 4) If the subject <language clause> specifies FORTRAN, then:
  13466. Case:
  13467. a) If Di specifies BIT(L), then:
  13468. i) Where PNi is used as an input parameter whose value is
  13469. evaluated, a reference to PNi is implicitly treated as:
  13470. SUBSTRING ( CAST ( PIi AS BIT VARYING(ML) ) FROM 1 FOR L
  13471. )
  13472. where ML is the implementation-defined maximum length of a
  13473. BIT VARYING data type.
  13474. ii) Let BLi be the length in bits of PIi. Let BL be the
  13475. implementation-defined number of bits in a Fortran char-
  13476. acter. Let OL be the smallest integer not less than the
  13477. 364 Database Language SQL
  13478. X3H2-92-154/DBL CBR-002
  13479. 12.4 Calls to a <procedure>
  13480. quotient of BLi/BL. Where PNi is used as an output param-
  13481. eter, a reference to PNi that assigns a value SVi to PNi
  13482. implicitly assigns the value
  13483. CAST ( SVi AS CHARACTER(OL) )
  13484. to PIi.
  13485. b) If Di specifies CHARACTER(L), then:
  13486. i) Where PNi is used as an input parameter whose value is
  13487. evaluated, a reference to PNi is implicitly treated an
  13488. SQL character type value in the specified character set in
  13489. which the octets of PIi are the corresponding octets of
  13490. that value.
  13491. ii) Let CLi be the maximum possible length in octets of PNi.
  13492. Where PNi is used as an output parameter, a reference to
  13493. PNi that assigns a value SVi to PNi implicitly assigns
  13494. a value that is an SQL CHARACTER(CLi) data type in which
  13495. octets of the value are the corresponding octets of SVi,
  13496. padded on the right with <space>s as necessary to reach the
  13497. length CLi.
  13498. c) Otherwise,
  13499. i) Where PNi is used as an input parameter whose value is
  13500. evaluated, a reference to PNi has the value PIi.
  13501. ii) Where PNi is used as an output parameter, a reference to
  13502. PNi that assigns a value SVi to PNi implicitly assigns the
  13503. value SVi to PIi.
  13504. 5) If the subject <language clause> specifies MUMPS, then:
  13505. Case:
  13506. a) If Di specifies CHARACTER VARYING(L), then:
  13507. i) Where PNi is used as an input parameter whose value is
  13508. evaluated, a reference to PNi is implicitly treated as an
  13509. SQL character type value in the specified character set in
  13510. which the octets of PIi are the corresponding octets of
  13511. that value.
  13512. ii) Where PNi is used as an output parameter, a reference to
  13513. PNi that assigns a value SVi to PNi implicitly assigns a
  13514. value that is an SQL CHARACTER VARYING(ML) data type in
  13515. which octets of the value are the corresponding octets of
  13516. SVi, padded on the right with <space>s as necessary to
  13517. reach the length CLi. ML is the implementation-defined
  13518. maximum length of variable-length character strings.
  13519. Module 365
  13520. X3H2-92-154/DBL CBR-002
  13521. 12.4 Calls to a <procedure>
  13522. b) Otherwise, Di specifies INT, DEC, or REAL, and:
  13523. i) Where PNi is used as an input parameter whose value is
  13524. evaluated, a reference to PNi is implicitly treated as
  13525. CAST ( PIi AS DTi )
  13526. ii) Where PNi is used as an output parameter, a reference to
  13527. PNi that assigns a value SVi to PNi implicitly assigns the
  13528. value
  13529. CAST ( SVi AS CHARACTER VARYING(ML) )
  13530. to PIi, where ML is the implementation-defined maximum
  13531. length of variable-length character strings.
  13532. 6) If the subject <language clause> specifies PASCAL, then:
  13533. Case:
  13534. a) If Di specifies BIT(L), then:
  13535. i) Where PNi is used as an input parameter whose value is
  13536. evaluated, a reference to PNi is implicitly treated as:
  13537. SUBSTRING ( CAST ( PIi AS BIT VARYING(ML) ) FROM 1 FOR L
  13538. )
  13539. where ML is the implementation-defined maximum length of a
  13540. BIT VARYING data type.
  13541. ii) Let BLi be the length in bits of PIi. Let BL be the
  13542. implementation-defined number of bits in a Pascal char-
  13543. acter. Let OL be the smallest integer not less than the
  13544. quotient of BLi/BL. Where PNi is used as an output param-
  13545. eter, a reference to PNi that assigns a value SVi to PNi
  13546. implicitly assigns the value
  13547. CAST ( SVi AS CHARACTER (OL) )
  13548. to PIi.
  13549. b) If Di specifies CHARACTER(L), then:
  13550. i) Where PNi is used as an input parameter whose value is
  13551. evaluated, a reference to PNi is implicitly treated an
  13552. SQL character type value in the specified character set in
  13553. which the octets of PIi are the corresponding octets of the
  13554. value.
  13555. ii) Let CLi be the maximum possible length in octets of PNi.
  13556. Where PNi is used as an output parameter, a reference to
  13557. PNi that assigns a value SVi to PNi implicitly assigns a
  13558. value which is an SQL CHARACTER(CLi) data type in which
  13559. octets of the value are the corresponding octets of SVi,
  13560. padded on the right with <space>s as necessary to reach the
  13561. length CLi.
  13562. 366 Database Language SQL
  13563. X3H2-92-154/DBL CBR-002
  13564. 12.4 Calls to a <procedure>
  13565. c) Otherwise,
  13566. i) Where PNi is used as an input parameter whose value is
  13567. evaluated, a reference to PNi has the value PIi.
  13568. ii) Where PNi is used as an output parameter, a reference to
  13569. PNi that assigns a value SVi to PNi implicitly assigns the
  13570. value SVi to PIi.
  13571. 7) If the subject <language clause> specifies PLI, then:
  13572. Case:
  13573. a) If Di specifies CHARACTER(L) or CHARACTER VARYING(L), then:
  13574. i) Where PNi is used as an input parameter whose value is
  13575. evaluated, a reference to PNi is implicitly treated an
  13576. SQL character type value in the specified character set in
  13577. which the octets of PIi are the corresponding octets of the
  13578. value.
  13579. ii) Let CLi be the maximum possible length in octets of PNi.
  13580. Where PNi is used as an output parameter, a reference to
  13581. PNi that assigns a value SVi to PNi implicitly assigns a
  13582. value that is:
  13583. 1) if Di specified CHARACTER(L), then an SQL CHARACTER(CLi)
  13584. data type
  13585. 2) otherwise, an SQL CHARACTER VARYING(Ci ) data type
  13586. in which octets of the value are the corresponding octets
  13587. of SVi, padded on the right with <space>s as necessary to
  13588. reach the length CLi.
  13589. b) Otherwise,
  13590. i) Where PNi is used as an input parameter whose value is
  13591. evaluated, a reference to PNi has the value PIi.
  13592. ii) Where PNi is used as an output parameter, a reference to
  13593. PNi that assigns a value SVi to PNi implicitly assigns the
  13594. value SVi to PIi.
  13595. Leveling Rules
  13596. 1) The following restrictions apply for Intermediate SQL.
  13597. None.
  13598. 2) The following restrictions apply for Entry SQL in addition to
  13599. any Intermediate SQL restrictions:
  13600. None.
  13601. Module 367
  13602. X3H2-92-154/DBL CBR-002
  13603. 12.5 <SQL procedure statement>
  13604. 12.5 <SQL procedure statement>
  13605. Function
  13606. Define all of the SQL-statements that are <SQL procedure state-
  13607. ment>s.
  13608. Format
  13609. <SQL procedure statement> ::=
  13610. <SQL schema statement>
  13611. | <SQL data statement>
  13612. | <SQL transaction statement>
  13613. | <SQL connection statement>
  13614. | <SQL session statement>
  13615. | <SQL dynamic statement>
  13616. | <SQL diagnostics statement>
  13617. <SQL schema statement> ::=
  13618. <SQL schema definition statement>
  13619. | <SQL schema manipulation statement>
  13620. <SQL schema definition statement> ::=
  13621. <schema definition>
  13622. | <table definition>
  13623. | <view definition>
  13624. | <grant statement>
  13625. | <domain definition>
  13626. | <character set definition>
  13627. | <collation definition>
  13628. | <translation definition>
  13629. | <assertion definition>
  13630. <SQL schema manipulation statement> ::=
  13631. <drop schema statement>
  13632. | <alter table statement>
  13633. | <drop table statement>
  13634. | <drop view statement>
  13635. | <revoke statement>
  13636. | <alter domain statement>
  13637. | <drop domain statement>
  13638. | <drop character set statement>
  13639. | <drop collation statement>
  13640. | <drop translation statement>
  13641. | <drop assertion statement>
  13642. <SQL data statement> ::=
  13643. <open statement>
  13644. | <fetch statement>
  13645. | <close statement>
  13646. | <select statement: single row>
  13647. | <SQL data change statement>
  13648. 368 Database Language SQL
  13649. X3H2-92-154/DBL CBR-002
  13650. 12.5 <SQL procedure statement>
  13651. <SQL data change statement> ::=
  13652. <delete statement: positioned>
  13653. | <delete statement: searched>
  13654. | <insert statement>
  13655. | <update statement: positioned>
  13656. | <update statement: searched>
  13657. <SQL transaction statement> ::=
  13658. <set transaction statement>
  13659. | <set constraints mode statement>
  13660. | <commit statement>
  13661. | <rollback statement>
  13662. <SQL connection statement> ::=
  13663. <connect statement>
  13664. | <set connection statement>
  13665. | <disconnect statement>
  13666. <SQL session statement> ::=
  13667. <set catalog statement>
  13668. | <set schema statement>
  13669. | <set names statement>
  13670. | <set session authorization identifier statement>
  13671. | <set local time zone statement>
  13672. <SQL dynamic statement> ::=
  13673. <system descriptor statement>
  13674. | <prepare statement>
  13675. | <deallocate prepared statement>
  13676. | <describe statement>
  13677. | <execute statement>
  13678. | <execute immediate statement>
  13679. | <SQL dynamic data statement>
  13680. <SQL dynamic data statement> ::=
  13681. <allocate cursor statement>
  13682. | <dynamic open statement>
  13683. | <dynamic fetch statement>
  13684. | <dynamic close statement>
  13685. | <dynamic delete statement: positioned>
  13686. | <dynamic update statement: positioned>
  13687. <system descriptor statement> ::=
  13688. <allocate descriptor statement>
  13689. | <deallocate descriptor statement>
  13690. | <set descriptor statement>
  13691. | <get descriptor statement>
  13692. <SQL diagnostics statement> ::=
  13693. <get diagnostics statement>
  13694. Module 369
  13695. X3H2-92-154/DBL CBR-002
  13696. 12.5 <SQL procedure statement>
  13697. Syntax Rules
  13698. None.
  13699. Access Rules
  13700. None.
  13701. General Rules
  13702. None.
  13703. Leveling Rules
  13704. 1) The following restrictions apply for Intermediate SQL:
  13705. None.
  13706. 2) The following restrictions apply for Entry SQL in addition to
  13707. any Intermediate SQL restrictions:
  13708. a) An <SQL procedure statement> shall not be an <SQL schema
  13709. definition statement>.
  13710. 370 Database Language SQL
  13711. X3H2-92-154/DBL CBR-002
  13712. 13 Data manipulation
  13713. 13.1 <declare cursor>
  13714. Function
  13715. Define a cursor.
  13716. Format
  13717. <declare cursor> ::=
  13718. DECLARE <cursor name> [ INSENSITIVE ] [ SCROLL ] CURSOR
  13719. FOR <cursor specification>
  13720. <cursor specification> ::=
  13721. <query expression> [ <order by clause> ]
  13722. [ <updatability clause> ]
  13723. <updatability clause> ::=
  13724. FOR { READ ONLY | UPDATE [ OF <column name list> ] }
  13725. <order by clause> ::=
  13726. ORDER BY <sort specification list>
  13727. <sort specification list> ::=
  13728. <sort specification> [ { <comma> <sort specification> }... ]
  13729. <sort specification> ::=
  13730. <sort key> [ <collate clause > ] [ <ordering specification> ]
  13731. <sort key> ::=
  13732. <column name>
  13733. | <unsigned integer>
  13734. <ordering specification> ::= ASC | DESC
  13735. Syntax Rules
  13736. 1) The <cursor name> shall be different from the <cursor name>
  13737. contained in any other <declare cursor> in the same <module>.
  13738. 2) Any <parameter name> contained in the <cursor specification>
  13739. shall be defined in a <parameter declaration> in the <procedure>
  13740. in the containing <module> that contains an <open statement>
  13741. that specifies the <cursor name>.
  13742. Note: See the Syntax Rules of Subclause 12.1, "<module>".
  13743. Data manipulation 371
  13744. X3H2-92-154/DBL CBR-002
  13745. 13.1 <declare cursor>
  13746. 3) Let T be the table specified by the <query expression>.
  13747. 4) Let CS be the cursor specified by the <cursor specification>.
  13748. 5) If <updatability clause> is not specified, then:
  13749. a) If either INSENSITIVE, SCROLL, or ORDER BY is specified, or
  13750. if T is a read-only table, then an <updatability clause> of
  13751. READ ONLY is implicit.
  13752. b) Otherwise, an <updatability clause> of FOR UPDATE without a
  13753. <column name list> is implicit.
  13754. 6) If an <updatability clause> of READ ONLY is specified or im-
  13755. plicit, then CS is a read-only cursor; otherwise, CS is an
  13756. updatable cursor.
  13757. 7) If an <order by clause> is specified, then the cursor specified
  13758. by the <cursor specification> is said to be an ordered cursor.
  13759. 8) The simply underlying table of a <cursor specification> is the
  13760. table derived from by the <query expression> simply contained in
  13761. the <cursor specification>.
  13762. 9) If T is an updatable table, then let TU be the leaf generally
  13763. underlying table of the <cursor specification>.
  13764. 10)If ORDER BY is specified, then each <sort specification> in the
  13765. <order by clause> shall identify a column of T.
  13766. Case:
  13767. a) If a <sort specification> contains a <column name>, then T
  13768. shall contain exactly one column with that <column name> and
  13769. the <sort specification> identifies that column.
  13770. b) If a <sort specification> contains an <unsigned integer>,
  13771. then the <unsigned integer> shall be greater than 0 and not
  13772. greater than the degree of T. The <sort specification> iden-
  13773. tifies the column of T with the ordinal position specified by
  13774. the <unsigned integer>.
  13775. 11)If a <sort specification> contains a <collate clause>, then
  13776. the data type of the column identified by the <sort specifica-
  13777. tion> shall be character string. The column descriptor of the
  13778. corresponding column in the result has the collating sequence
  13779. specified in <collate clause> and the coercibility attribute
  13780. Explicit.
  13781. 12)If an <updatability clause> of FOR UPDATE with or without a
  13782. <column name list> is specified or implicit, then T shall be an
  13783. updatable table and INSENSITIVE shall not be specified.
  13784. 13)If an <updatability clause> of FOR UPDATE without a <column name
  13785. list> is specified or implicit, then a <column name list> that
  13786. includes the <column name> of every column of TU is implicit.
  13787. 372 Database Language SQL
  13788. X3H2-92-154/DBL CBR-002
  13789. 13.1 <declare cursor>
  13790. 14)If an <updatability clause> of FOR UPDATE with a <column name
  13791. list> is specified, then each <column name> in the <column name
  13792. list> shall be the <column name> of a column of TU.
  13793. Access Rules
  13794. None.
  13795. General Rules
  13796. 1) If T is an updatable table, then the cursor is associated with
  13797. the named table TU. For every row in T, there is exactly one
  13798. corresponding row in TU from which the row of T is derived.
  13799. 2) If an <order by clause> is not specified, then the table speci-
  13800. fied by the <cursor specification> is T and the ordering of rows
  13801. in T is implementation-dependent.
  13802. 3) If an <order by clause> is specified, then the ordering of rows
  13803. of the result is effectively determined by the <order by clause>
  13804. as follows:
  13805. a) Each <sort specification> specifies the sort direction for
  13806. the corresponding sort key Ki. If DESC is not specified in
  13807. the i-th <sort specification>, then the sort direction for Ki
  13808. is ascending and the applicable <comp op> is the <less than
  13809. operator>. Otherwise, the sort direction for Ki is descending
  13810. and the applicable <comp op> is the <greater than operator>.
  13811. b) Let P be any row of the result table and let Q be any other
  13812. row of that table, and let PVi and QVi be the values of Ki
  13813. in these rows, respectively. The relative position of rows
  13814. P and Q in the result is determined by comparing PVi and
  13815. QVi according to the rules of Subclause 8.2, "<comparison
  13816. predicate>", where the <comp op> is the applicable <comp op>
  13817. for Ki, with the following special treatment of null values.
  13818. Whether a sort key value that is null is considered greater
  13819. or less than a non-null value is implementation-defined, but
  13820. all sort key values that are null shall either be considered
  13821. greater than all non-null values or be considered less than
  13822. all non-null values. PVi is said to precede QVi if the value
  13823. of the <comparison predicate> "PVi <comp op> QVi" is true for
  13824. the applicable <comp op>.
  13825. c) In the result table, the relative position of row P is before
  13826. row Q if and only if PVn precedes QVn for some n greater than
  13827. 0 and less than the number of <sort specification>s and PVi
  13828. = QVi for all i < n. The relative order of two rows that are
  13829. not distinct is implementation-dependent.
  13830. Data manipulation 373
  13831. X3H2-92-154/DBL CBR-002
  13832. 13.1 <declare cursor>
  13833. Leveling Rules
  13834. 1) The following restrictions apply for Intermediate SQL:
  13835. a) A <declare cursor> shall not specify INSENSITIVE.
  13836. b) If an <updatability clause> of FOR UPDATE with or without
  13837. a <column name list> is specified, then neither SCROLL nor
  13838. ORDER BY shall be specified.
  13839. 2) The following restrictions apply for Entry SQL in addition to
  13840. any Intermediate SQL restrictions:
  13841. a) A <declare cursor> shall not specify SCROLL.
  13842. b) A <cursor specification> shall not contain an <updatability
  13843. clause>.
  13844. 374 Database Language SQL
  13845. X3H2-92-154/DBL CBR-002
  13846. 13.2 <open statement>
  13847. 13.2 <open statement>
  13848. Function
  13849. Open a cursor.
  13850. Format
  13851. <open statement> ::=
  13852. OPEN <cursor name>
  13853. Syntax Rules
  13854. 1) The containing <module> shall contain a <declare cursor> CR
  13855. whose <cursor name> is the same as the <cursor name> in the
  13856. <open statement>.
  13857. Access Rules
  13858. 1) The Access Rules for the <query expression> simply contained
  13859. in the <declare cursor> identified by the <cursor name> are
  13860. applied.
  13861. General Rules
  13862. 1) If cursor CR is not in the closed state, then an exception con-
  13863. dition is raised: invalid cursor state.
  13864. 2) Let S be the <cursor specification> of cursor CR.
  13865. 3) Cursor CR is opened in the following steps:
  13866. a) A copy of S is effectively created in which:
  13867. i) Each <target specification> is replaced by the value of the
  13868. target;
  13869. ii) Each <value specification> generally contained in S that
  13870. is CURRENT_USER, SESSION_USER, or SYSTEM_USER is replaced
  13871. by the value resulting from evaluation of CURRENT_USER,
  13872. SESSION_USER, or SYSTEM_USER, respectively, with all such
  13873. evaluations effectively done at the same instant in time;
  13874. and
  13875. iii) Each <datetime value function> generally contained in S
  13876. is replaced by the value resulting from evaluation of that
  13877. <datetime value function>, with all such evaluations effec-
  13878. tively done at the same instant in time.
  13879. b) Let T be the table specified by the copy of S.
  13880. c) A table descriptor for T is effectively created.
  13881. Data manipulation 375
  13882. X3H2-92-154/DBL CBR-002
  13883. 13.2 <open statement>
  13884. d) The General Rules of Subclause 13.1, "<declare cursor>", are
  13885. applied.
  13886. e) Case:
  13887. i) If S specifies INSENSITIVE, then a copy of T is effectively
  13888. created and cursor CR is placed in the open state and its
  13889. position is before the first row of the copy of T.
  13890. ii) Otherwise, cursor CR is placed in the open state and its
  13891. position is before the first row of T.
  13892. Leveling Rules
  13893. 1) The following restrictions apply for Intermediate SQL:
  13894. None.
  13895. 2) The following restrictions apply for Entry SQL in addition to
  13896. any Intermediate SQL restrictions:
  13897. None.
  13898. 376 Database Language SQL
  13899. X3H2-92-154/DBL CBR-002
  13900. 13.3 <fetch statement>
  13901. 13.3 <fetch statement>
  13902. Function
  13903. Position a cursor on a specified row of a table and retrieve values
  13904. from that row.
  13905. Format
  13906. <fetch statement> ::=
  13907. FETCH [ [ <fetch orientation> ] FROM ]
  13908. <cursor name> INTO <fetch target list>
  13909. <fetch orientation> ::=
  13910. NEXT
  13911. | PRIOR
  13912. | FIRST
  13913. | LAST
  13914. | { ABSOLUTE | RELATIVE } <simple value specification>
  13915. <fetch target list> ::=
  13916. <target specification> [ { <comma> <target specification> }... ]
  13917. Syntax Rules
  13918. 1) If the <fetch orientation> is omitted, then NEXT is implicit.
  13919. 2) The containing <module> shall contain a <declare cursor> CR
  13920. whose <cursor name> is the same as the <cursor name> in the
  13921. <fetch statement>. Let T be the table defined by the <cursor
  13922. specification> of CR.
  13923. 3) If the implicit or explicit <fetch orientation> is not NEXT,
  13924. then the <declare cursor> CR shall specify SCROLL.
  13925. 4) If a <fetch orientation> that contains a <simple value specifi-
  13926. cation> is specified, then the data type of that <simple value
  13927. specification> shall be exact numeric with a scale of 0.
  13928. 5) The number of <target specification>s in the <fetch target list>
  13929. shall be the same as the degree of table T. The i-th <target
  13930. specification> in the <fetch target list> corresponds with the
  13931. i-th column of table T.
  13932. 6) The Syntax Rules of Subclause 9.1, "Retrieval assignment", apply
  13933. to each corresponding <target specification> and column of table
  13934. T, as TARGET and VALUE, respectively.
  13935. Access Rules
  13936. None.
  13937. Data manipulation 377
  13938. X3H2-92-154/DBL CBR-002
  13939. 13.3 <fetch statement>
  13940. General Rules
  13941. 1) If cursor CR is not in the open state, then an exception condi-
  13942. tion is raised: invalid cursor state.
  13943. 2) Case:
  13944. a) If the <fetch orientation> contains a <simple value spec-
  13945. ification>, then let J be the value of that <simple value
  13946. specification>.
  13947. b) If the <fetch orientation> specifies NEXT or FIRST, then let
  13948. J be +1.
  13949. c) If the <fetch orientation> specifies PRIOR or LAST, then let
  13950. J be -1.
  13951. 3) Let Tt be a table of the same degree as T.
  13952. Case:
  13953. a) If the <fetch orientation> specifies ABSOLUTE, FIRST, or
  13954. LAST, then let Tt contain all rows of T, preserving their
  13955. order in T.
  13956. b) If the <fetch orientation> specifies NEXT or specifies
  13957. RELATIVE with a positive value of J, then:
  13958. i) If the table T identified by cursor CR is empty or if the
  13959. position of CR is on or after the last row of T, then let
  13960. Tt be a table of no rows.
  13961. ii) If the position of CR is on a row R that is other than the
  13962. last row of T, then let Tt contain all rows of T ordered
  13963. after row R, preserving their order in T.
  13964. iii) If the position of CR is before a row R, then let Tt con-
  13965. tain row R and all rows of T ordered after row R, preserv-
  13966. ing their order in T.
  13967. c) If the <fetch orientation> specifies PRIOR or specifies
  13968. RELATIVE with a negative value of J, then:
  13969. i) If the table T identified by cursor CR is empty or if the
  13970. position of CR is on or before the first row of T, then let
  13971. Tt be a table of no rows.
  13972. ii) If the position of CR is on a row R that is other than the
  13973. first row of T, then let Tt contain all rows of T ordered
  13974. before row R, preserving their order in T.
  13975. iii) If the position of CR is before the next row of a row R
  13976. that is not the last row of T, then let Tt contain row R
  13977. and all rows of T ordered before row R, preserving their
  13978. order in T.
  13979. 378 Database Language SQL
  13980. X3H2-92-154/DBL CBR-002
  13981. 13.3 <fetch statement>
  13982. iv) If the position of CR is after the last row of T, then let
  13983. Tt contain all rows of T, preserving their order in T.
  13984. d) If RELATIVE is specified with a zero value of J, then:
  13985. i) If the position of CR is on a row of T, then let Tt be a
  13986. table comprising that one row.
  13987. ii) Otherwise, let Tt be an empty table.
  13988. 4) Let N be the number of rows in Tt. If J is positive, then let
  13989. K be J. If J is negative, then let K be N+J+1. If J is zero
  13990. and ABSOLUTE is specified, then let K be zero; if J is zero and
  13991. RELATIVE is specified, then let K be 1.
  13992. 5) Case:
  13993. a) If K is greater than 0 and not greater than N, then CR is
  13994. positioned on the K-th row of Tt and the corresponding row of
  13995. T. That row becomes the current row of CR.
  13996. b) Otherwise, no SQL-data values are assigned to any targets
  13997. in the <fetch target list>, and a completion condition is
  13998. raised: no data.
  13999. Case:
  14000. i) If the <fetch orientation> specifies RELATIVE with J equal
  14001. to zero, then the position of CR is unchanged.
  14002. ii) If the <fetch orientation> implicitly or explicitly spec-
  14003. ifies NEXT, specifies ABSOLUTE or RELATIVE with K greater
  14004. than N, or specifies LAST, then CR is positioned after the
  14005. last row.
  14006. iii) Otherwise, the <fetch orientation> specifies PRIOR, FIRST,
  14007. or ABSOLUTE or RELATIVE with K not greater than N and CR is
  14008. positioned before the first row.
  14009. 6) If a completion condition no data has been raised, then no fur-
  14010. ther General Rules of this Subclause are applied.
  14011. 7) If an exception condition is raised during derivation of any
  14012. <derived column> associated with the current row of CR, then CR
  14013. remains positioned on the current row.
  14014. 8) Values from the current row are assigned to their corresponding
  14015. targets identified by the <fetch target list>. The assignments
  14016. are made in an implementation-dependent order. Let TV be a tar-
  14017. get and let SV denote its corresponding value in the current
  14018. row of CR. The General Rules of Subclause 9.1, "Retrieval as-
  14019. signment", are applied to TV and SV as TARGET and VALUE, respec-
  14020. tively.
  14021. Data manipulation 379
  14022. X3H2-92-154/DBL CBR-002
  14023. 13.3 <fetch statement>
  14024. 9) If an exception condition occurs during the assignment of SV
  14025. to TV, then the value of TV is implementation-dependent and CR
  14026. remains positioned on the current row.
  14027. Leveling Rules
  14028. 1) The following restrictions apply for Intermediate SQL:
  14029. None.
  14030. 2) The following restrictions apply for Entry SQL in addition to
  14031. any Intermediate SQL restrictions:
  14032. a) A <fetch statement> shall not contain a <fetch orientation>.
  14033. b) A <fetch statement> shall not specify FROM.
  14034. c) If the data type of the target identified by the i-th <target
  14035. specification> in the <fetch target list> is an exact numeric
  14036. type, then the data type of the i-th column of the table T
  14037. shall be an exact numeric type.
  14038. 380 Database Language SQL
  14039. X3H2-92-154/DBL CBR-002
  14040. 13.4 <close statement>
  14041. 13.4 <close statement>
  14042. Function
  14043. Close a cursor.
  14044. Format
  14045. <close statement> ::=
  14046. CLOSE <cursor name>
  14047. Syntax Rules
  14048. 1) The containing <module> shall contain a <declare cursor> CR
  14049. whose <cursor name> is the same as the <cursor name> of the
  14050. <close statement>.
  14051. Access Rules
  14052. None.
  14053. General Rules
  14054. 1) If cursor CR is not in the open state, then an exception condi-
  14055. tion is raised: invalid cursor state.
  14056. 2) Cursor CR is placed in the closed state and the copy of the
  14057. <cursor specification> of CR is destroyed.
  14058. Leveling Rules
  14059. 1) The following restrictions apply for Intermediate SQL:
  14060. None.
  14061. 2) The following restrictions apply for Entry SQL in addition to
  14062. any Intermediate SQL restrictions:
  14063. None.
  14064. Data manipulation 381
  14065. X3H2-92-154/DBL CBR-002
  14066. 13.5 <select statement: single row>
  14067. 13.5 <select statement: single row>
  14068. Function
  14069. Retrieve values from a specified row of a table.
  14070. Format
  14071. <select statement: single row> ::=
  14072. SELECT [ <set quantifier> ] <select list>
  14073. INTO <select target list>
  14074. <table expression>
  14075. <select target list> ::=
  14076. <target specification> [ { <comma> <target specification> }... ]
  14077. Syntax Rules
  14078. 1) The number of elements in the <select list> shall be the same
  14079. as the number of elements in the <select target list>. The i-th
  14080. <target specification> in the <select target list> corresponds
  14081. with the i-th element of the <select list>.
  14082. 2) The Syntax Rules of Subclause 9.1, "Retrieval assignment", ap-
  14083. ply to each corresponding <target specification> and <value
  14084. expression>, as TARGET and VALUE, respectively.
  14085. 3) Let S be a <query specification> whose <select list> and <table
  14086. expression> are those specified in the <select statement: single
  14087. row> and that specifies the <set quantifier> if it is specified
  14088. in the <select statement: single row>. S shall be a valid <query
  14089. specification>.
  14090. Access Rules
  14091. None.
  14092. General Rules
  14093. 1) Let Q be the result of <query specification> S.
  14094. 2) Case:
  14095. a) If the cardinality of Q is greater than 1, then an ex-
  14096. ception condition is raised: cardinality violation. It is
  14097. implementation-dependent whether or not SQL-data values are
  14098. assigned to the targets identified by the <select target
  14099. list>.
  14100. b) If Q is empty, then no SQL-data values are assigned to any
  14101. targets identified by the <select target list>, and a comple-
  14102. tion condition is raised: no data.
  14103. 382 Database Language SQL
  14104. X3H2-92-154/DBL CBR-002
  14105. 13.5 <select statement: single row>
  14106. c) Otherwise, values in the row of Q are assigned to their cor-
  14107. responding targets.
  14108. 3) If a completion condition no data has been raised, then no fur-
  14109. ther General Rules of this Subclause are applied.
  14110. 4) The assignment of values to targets in the <select target list>
  14111. is in an implementation-dependent order.
  14112. 5) If an exception condition is raised during the assignment of a
  14113. value to a target, then the values of targets are implementation-
  14114. dependent.
  14115. 6) The target identified by the i-th <target specification> of the
  14116. <select target list> corresponds to the i-th value in the row of
  14117. Q.
  14118. 7) Let TV be an identified target and let SV be its corresponding
  14119. value in the row of Q.
  14120. 8) The General Rules of Subclause 9.1, "Retrieval assignment", are
  14121. applied to TV and SV, as TARGET and VALUE, respectively.
  14122. Leveling Rules
  14123. 1) The following restrictions apply for Intermediate SQL:
  14124. None.
  14125. 2) The following restrictions apply for Entry SQL in addition to
  14126. any Intermediate SQL restrictions:
  14127. a) If the data type of the target identified by the i-th <tar-
  14128. get specification> in the <select target list> is an exact
  14129. numeric type, then the data type of the i-th column of the
  14130. table T shall be an exact numeric type.
  14131. b) The <table expression> shall not include a <group by clause>
  14132. or a <having clause> and shall not identify a grouped view.
  14133. Data manipulation 383
  14134. X3H2-92-154/DBL CBR-002
  14135. 13.6 <delete statement: positioned>
  14136. 13.6 <delete statement: positioned>
  14137. Function
  14138. Delete a row of a table.
  14139. Format
  14140. <delete statement: positioned> ::=
  14141. DELETE FROM <table name>
  14142. WHERE CURRENT OF <cursor name>
  14143. Syntax Rules
  14144. 1) The containing <module> shall contain a <declare cursor> whose
  14145. <cursor name> is the same as the <cursor name> in the <delete
  14146. statement: positioned>. Let CR be the cursor specified by <cur-
  14147. sor name>.
  14148. 2) CR shall be an updatable cursor.
  14149. Note: updatable cursor is defined in Subclause 13.1, "<declare
  14150. cursor>".
  14151. 3) Let T be the table identified by the <table name>. Let QS be the
  14152. <query specification> that is the simply underlying table of the
  14153. simply underlying table of CR. The simply underlying table of QS
  14154. shall be T.
  14155. Note: The simply underlying table of a <cursor specification> is
  14156. defined in Subclause 13.1, "<declare cursor>".
  14157. Access Rules
  14158. 1) The applicable privileges shall include DELETE for the <table
  14159. name>.
  14160. Note: The applicable privileges for a <table name> are defined
  14161. in Subclause 10.3, "<privileges>".
  14162. General Rules
  14163. 1) If the access mode of the current SQL-transaction is read-only
  14164. and T is not a temporary table, then an exception condition is
  14165. raised: invalid transaction state.
  14166. 2) If cursor CR is not positioned on a row, then an exception con-
  14167. dition is raised: invalid cursor state.
  14168. 3) The row from which the current row of CR is derived is marked
  14169. for deletion.
  14170. 4) If, while CR is open, the row from which the current row of CR
  14171. is derived has been marked for deletion by any <delete state-
  14172. ment: searched>, marked for deletion by any <delete statement:
  14173. positioned> that identifies any cursor other than CR, updated
  14174. 384 Database Language SQL
  14175. X3H2-92-154/DBL CBR-002
  14176. 13.6 <delete statement: positioned>
  14177. by any <update statement: searched>, or updated by any <update
  14178. statement: positioned> that identifies any cursor other than CR,
  14179. then a completion condition is raised: warning-cursor operation
  14180. conflict.
  14181. 5) All rows that are marked for deletion are effectively deleted
  14182. at the end of the <delete statement: positioned> prior to the
  14183. checking of any integrity constraint.
  14184. 6) If the <delete statement: positioned> deleted the last row of
  14185. CR, then the position of CR is after the last row; otherwise,
  14186. the position of CR is before the next row.
  14187. Leveling Rules
  14188. 1) The following restrictions apply for Intermediate SQL:
  14189. None.
  14190. 2) The following restrictions apply for Entry SQL in addition to
  14191. any Intermediate SQL restrictions:
  14192. None.
  14193. Data manipulation 385
  14194. X3H2-92-154/DBL CBR-002
  14195. 13.7 <delete statement: searched>
  14196. 13.7 <delete statement: searched>
  14197. Function
  14198. Delete rows of a table.
  14199. Format
  14200. <delete statement: searched> ::=
  14201. DELETE FROM <table name>
  14202. [ WHERE <search condition> ]
  14203. Syntax Rules
  14204. 1) Let T be the table identified by the <table name>. T shall not
  14205. be a read-only table.
  14206. 2) The scope of the <table name> is the entire <delete statement:
  14207. searched>.
  14208. Access Rules
  14209. 1) The applicable privileges shall include DELETE for the <table
  14210. name>.
  14211. Note: The applicable privileges for a <table name> are defined
  14212. in Subclause 10.3, "<privileges>".
  14213. General Rules
  14214. 1) If the access mode of the current SQL-transaction is read-only
  14215. and T is not a temporary table, then an exception condition is
  14216. raised: invalid transaction state.
  14217. 2) Case:
  14218. a) If <search condition> is not specified, then all rows of T
  14219. are marked for deletion.
  14220. b) If <search condition> is specified, then it is applied to
  14221. each row of T with the <table name> bound to that row, and
  14222. all rows for which the result of the <search condition> is
  14223. true are marked for deletion.
  14224. The <search condition> is effectively evaluated for each row
  14225. of T before marking for deletion any row of T.
  14226. Each <subquery> in the <search condition> is effectively
  14227. executed for each row of T and the results used in the ap-
  14228. plication of the <search condition> to the given row of T.
  14229. If any executed <subquery> contains an outer reference to a
  14230. column of T, the reference is to the value of that column in
  14231. the given row of T.
  14232. Note: Outer reference is defined in Subclause 6.4, "<column
  14233. reference>".
  14234. 386 Database Language SQL
  14235. X3H2-92-154/DBL CBR-002
  14236. 13.7 <delete statement: searched>
  14237. 3) If any row that is marked for deletion by the <delete statement:
  14238. searched> has been marked for deletion by any <delete statement:
  14239. positioned> that identifies some cursor CR that is still open
  14240. or updated by any <update statement: positioned> that identifies
  14241. some cursor CR that is still open, then a completion condition
  14242. is raised: warning-cursor operation conflict.
  14243. 4) All rows that are marked for deletion are effectively deleted
  14244. at the end of the <delete statement: searched> prior to the
  14245. checking of any integrity constraint.
  14246. 5) If no row is deleted, then a completion condition is raised: no
  14247. data.
  14248. Leveling Rules
  14249. 1) The following restrictions apply for Intermediate SQL:
  14250. a) No leaf generally underlying table of T shall be an under-
  14251. lying table of any <query expression> generally contained in
  14252. the <search condition>.
  14253. 2) The following restrictions apply for Entry SQL in addition to
  14254. any Intermediate SQL restrictions:
  14255. None.
  14256. Data manipulation 387
  14257. X3H2-92-154/DBL CBR-002
  14258. 13.8 <insert statement>
  14259. 13.8 <insert statement>
  14260. Function
  14261. Create new rows in a table.
  14262. Format
  14263. <insert statement> ::=
  14264. INSERT INTO <table name>
  14265. <insert columns and source>
  14266. <insert columns and source> ::=
  14267. [ <left paren> <insert column list> <right paren> ]
  14268. <query expression>
  14269. | DEFAULT VALUES
  14270. <insert column list> ::= <column name list>
  14271. Syntax Rules
  14272. 1) The table T identified by the <table name> shall not be a read-
  14273. only table.
  14274. 2) An <insert columns and source> that specifies DEFAULT VALUES is
  14275. equivalent to an <insert columns and source> that specifies a
  14276. <query expression> of the form
  14277. VALUES (DEFAULT, . . . )
  14278. where the number of "DEFAULT" entries is equal to the number of
  14279. columns of T.
  14280. 3) No <column name> of T shall be identified more than once. If the
  14281. <insert column list> is omitted, then an <insert column list>
  14282. that identifies all columns of T in the ascending sequence of
  14283. their ordinal positions within T is implicit.
  14284. 4) A column identified by the <insert column list> is an object
  14285. column.
  14286. 5) Let QT be the table specified by the <query expression>. The
  14287. degree of QT shall be equal to the number of <column name>s in
  14288. the <insert column list>. The column of table T identified by
  14289. the i-th <column name> in the <insert column list> corresponds
  14290. with the i-th column of QT.
  14291. 6) The Syntax Rules of Subclause 9.2, "Store assignment", apply to
  14292. corresponding columns of T and QT as TARGET and VALUE, respec-
  14293. tively.
  14294. 388 Database Language SQL
  14295. X3H2-92-154/DBL CBR-002
  14296. 13.8 <insert statement>
  14297. Access Rules
  14298. 1) Case:
  14299. a) If an <insert column list> is specified, then the applicable
  14300. <privileges> shall include INSERT for each <column name> in
  14301. the <insert column list>.
  14302. b) Otherwise, the applicable privileges shall include INSERT for
  14303. each <column name> in T.
  14304. Note: The applicable privileges for a <table name> are defined
  14305. in Subclause 10.3, "<privileges>".
  14306. 2) Each <column name> in the <insert column list> shall identify a
  14307. column of T.
  14308. General Rules
  14309. 1) If the access mode of the current SQL-transaction is read-only
  14310. and T is not a temporary table, then an exception condition is
  14311. raised: invalid transaction state.
  14312. 2) Let B be the leaf generally underlying table of T.
  14313. 3) The <query expression> is effectively evaluated before inserting
  14314. any rows into B.
  14315. 4) Let Q be the result of that <query expression>.
  14316. Case:
  14317. a) If Q is empty, then no row is inserted and a completion con-
  14318. dition is raised: no data.
  14319. b) Otherwise, for each row R of Q:
  14320. i) A candidate row of B is effectively created in which the
  14321. value of each column is its default value, as specified in
  14322. the General Rules of Subclause 11.5, "<default clause>".
  14323. The candidate row includes every column of B.
  14324. ii) For every object column in the candidate row, the value of
  14325. the object column identified by the i-th <column name> in
  14326. the <insert column list> is replaced by the i-th value of
  14327. R.
  14328. iii) Let C be a column that is represented in the candidate row
  14329. and let SV be its value in the candidate row. The General
  14330. Rules of Subclause 9.2, "Store assignment", are applied to
  14331. C and SV as TARGET and VALUE, respectively.
  14332. iv) The candidate row is inserted into B.
  14333. Note: The data values allowable in the candidate row may be
  14334. constrained by a WITH CHECK OPTION constraint. The effect
  14335. of a WITH CHECK OPTION constraint is defined in the General
  14336. Rules of Subclause 11.19, "<view definition>".
  14337. Data manipulation 389
  14338. X3H2-92-154/DBL CBR-002
  14339. 13.8 <insert statement>
  14340. Leveling Rules
  14341. 1) The following restrictions apply for Intermediate SQL:
  14342. a) The leaf generally underlying table of T shall not be gen-
  14343. erally contained in the <query expression> immediately
  14344. contained in the <insert columns and source> except as the
  14345. <qualifier> of a <column reference>.
  14346. 2) The following restrictions apply for Entry SQL in addition to
  14347. any Intermediate SQL restrictions:
  14348. a) The <query expression> that is contained in an <insert state-
  14349. ment> shall be a <query specification> or it shall be a <ta-
  14350. ble value constructor> that contains exactly one <row value
  14351. constructor> of the form "<left paren> <row value constructor
  14352. list> <right paren>", and each <row value constructor ele-
  14353. ment> of that <row value constructor list> shall be a <value
  14354. specification>.
  14355. b) If the data type of the target identified by the i-th <column
  14356. name> is an exact numeric type, then the data type of the i-
  14357. th item of the <insert statement> shall be an exact numeric
  14358. type.
  14359. c) If the data type of the target C identified by the i-th <col-
  14360. umn name> is character string, then the length in characters
  14361. of the i-th item of the <insert statement> shall be less than
  14362. or equal to the length of C.
  14363. d) The <insert columns and source> shall immediately contain a
  14364. <query expression>.
  14365. 390 Database Language SQL
  14366. X3H2-92-154/DBL CBR-002
  14367. 13.9 <update statement: positioned>
  14368. 13.9 <update statement: positioned>
  14369. Function
  14370. Update a row of a table.
  14371. Format
  14372. <update statement: positioned> ::=
  14373. UPDATE <table name>
  14374. SET <set clause list>
  14375. WHERE CURRENT OF <cursor name>
  14376. <set clause list> ::=
  14377. <set clause> [ { <comma> <set clause> }... ]
  14378. <set clause> ::=
  14379. <object column> <equals operator> <update source>
  14380. <update source> ::=
  14381. <value expression>
  14382. | <null specification>
  14383. | DEFAULT
  14384. <object column> ::= <column name>
  14385. Syntax Rules
  14386. 1) The containing <module> shall contain a <declare cursor> for
  14387. a cursor whose <cursor name> is the same as the <cursor name>
  14388. in the <update statement: positioned>. Let CR be the cursor
  14389. specified by <cursor name>.
  14390. 2) CR shall be an updatable cursor.
  14391. Note: updatable cursor is defined in Subclause 13.1, "<declare
  14392. cursor>".
  14393. 3) Let T be the table identified by the <table name>. Let QS be the
  14394. <query specification> that is the simply underlying table of the
  14395. simply underlying table of CR. The simply underlying table of QS
  14396. shall be T.
  14397. Note: The simply underlying table of a <cursor specification> is
  14398. defined in Subclause 13.1, "<declare cursor>".
  14399. 4) If CR is an ordered cursor, then for each <object column> OC,
  14400. the column of T identified by OC shall not be directly or in-
  14401. directly referenced in the <order by clause> of the defining
  14402. <cursor specification> for CR.
  14403. Data manipulation 391
  14404. X3H2-92-154/DBL CBR-002
  14405. 13.9 <update statement: positioned>
  14406. 5) No leaf generally underlying table of T shall be an underly-
  14407. ing table of any <query expression> generally contained in any
  14408. <value expression> immediately contained in any <update source>
  14409. contained in the <set clause list>.
  14410. 6) A <value expression> in a <set clause> shall not directly con-
  14411. tain a <set function specification>.
  14412. 7) The same <object column> shall not appear more than once in a
  14413. <set clause list>.
  14414. 8) If the cursor identified by <cursor name> was specified using
  14415. an explicit or implicit <updatability clause> of FOR UPDATE,
  14416. then each <column name> specified as an <object column> shall
  14417. identify a column in the explicit or implicit <column name list>
  14418. associated with the <updatability clause>.
  14419. 9) The scope of the <table name> is the entire <update statement:
  14420. positioned>.
  14421. 10)For every <set clause>, the Syntax Rules of Subclause 9.2,
  14422. "Store assignment", apply to the column of T identified by the
  14423. <object column> and the <value expression> of the <set clause>
  14424. as TARGET and VALUE, respectively.
  14425. Access Rules
  14426. 1) The applicable privileges shall include UPDATE for each <object
  14427. column>.
  14428. Note: The applicable privileges for a <table name> are defined
  14429. in Subclause 10.3, "<privileges>".
  14430. 2) Each <column name> specified as an <object column> shall iden-
  14431. tify a column of T.
  14432. General Rules
  14433. 1) If the access mode of the current SQL-transaction is read-only
  14434. and T is not a temporary table, then an exception condition is
  14435. raised: invalid transaction state.
  14436. 2) If cursor CR is not positioned on a row, then an exception con-
  14437. dition is raised: invalid cursor state.
  14438. 3) The object row is that row from which the current row of CR is
  14439. derived.
  14440. 4) If, while CR is open, the object row has been marked for dele-
  14441. tion by any <delete statement: searched>, marked for deletion
  14442. by any <delete statement: positioned> that identifies any cursor
  14443. other than CR, updated by any <update statement: searched>, or
  14444. updated by any <update statement: positioned> that identifies
  14445. any cursor other than CR, then a completion condition is raised:
  14446. warning-cursor operation conflict.
  14447. 392 Database Language SQL
  14448. X3H2-92-154/DBL CBR-002
  14449. 13.9 <update statement: positioned>
  14450. 5) The value of DEFAULT is the default value indicated in the col-
  14451. umn descriptor for the <object column> in the containing <set
  14452. clause>.
  14453. 6) The <value expression>s are effectively evaluated before updat-
  14454. ing the object row. If a <value expression> contains a reference
  14455. to a column of T, then the reference is to the value of that
  14456. column in the object row before any value of the object row is
  14457. updated.
  14458. 7) CR remains positioned on its current row, even if an exception
  14459. condition is raised during derivation of any <value expression>
  14460. associated with the object row.
  14461. 8) A <set clause> specifies an object column and an update value
  14462. of that column. The object column is the column identified by
  14463. the <object column> in the <set clause>. The update value is the
  14464. value specified by the <update source>.
  14465. Note: The data values allowable in the object row may be con-
  14466. strained by a WITH CHECK OPTION constraint. The effect of a
  14467. WITH CHECK OPTION constraint is defined in the General Rules of
  14468. Subclause 11.19, "<view definition>".
  14469. 9) The object row is updated as specified by each <set clause>.
  14470. For each <set clause>, the value of the specified object column,
  14471. denoted by C, is replaced by the specified update value, denoted
  14472. by SV. The General Rules of Subclause 9.2, "Store assignment",
  14473. are applied to C and SV as TARGET and VALUE, respectively.
  14474. Leveling Rules
  14475. 1) The following restrictions apply for Intermediate SQL:
  14476. a) CR shall not be an ordered cursor.
  14477. 2) The following restrictions apply for Entry SQL in addition to
  14478. any Intermediate SQL restrictions:
  14479. a) If the data type of the column identified by the i-th <object
  14480. column> is an exact numeric type, then the data type of the
  14481. i-th <value expression> in the <update statement: positioned>
  14482. shall be an exact numeric type.
  14483. b) If the data type of the column identified by the i-th <object
  14484. column> C is character string, then the length in characters
  14485. of the i-th <value expression> in the <update statement:
  14486. positioned> shall be less than or equal to the length of C.
  14487. c) An <update source> shall not specify DEFAULT.
  14488. Data manipulation 393
  14489. X3H2-92-154/DBL CBR-002
  14490. 13.10 <update statement: searched>
  14491. 13.10 <update statement: searched>
  14492. Function
  14493. Update rows of a table.
  14494. Format
  14495. <update statement: searched> ::=
  14496. UPDATE <table name>
  14497. SET <set clause list>
  14498. [ WHERE <search condition> ]
  14499. Syntax Rules
  14500. 1) Let T be the table identified by the <table name>. T shall be an
  14501. updatable table.
  14502. 2) A <value expression> in a <set clause> shall not directly con-
  14503. tain a <set function specification>.
  14504. 3) The same <object column> shall not appear more than once in a
  14505. <set clause list>.
  14506. 4) The scope of the <table name> is the entire <update statement:
  14507. searched>.
  14508. 5) For every <set clause>, the Syntax Rules of Subclause 9.2,
  14509. "Store assignment", apply to the column of T identified by the
  14510. <object column> and the <value expression> of the <set clause>
  14511. as TARGET and VALUE, respectively.
  14512. Access Rules
  14513. 1) The applicable privileges shall include UPDATE for each <object
  14514. column>.
  14515. Note: The applicable privileges for a <table name> are defined
  14516. in Subclause 10.3, "<privileges>".
  14517. 2) Each <column name> specified as an <object column> shall iden-
  14518. tify a column of T.
  14519. General Rules
  14520. 1) If the access mode of the current SQL-transaction is read-only
  14521. and T is not a temporary table, then an exception condition is
  14522. raised: invalid transaction state.
  14523. 2) Case:
  14524. a) If a <search condition> is not specified, then all rows of T
  14525. are the object rows.
  14526. 394 Database Language SQL
  14527. X3H2-92-154/DBL CBR-002
  14528. 13.10 <update statement: searched>
  14529. b) If a <search condition> is specified, then it is applied
  14530. to each row of T with the <table name> bound to that row,
  14531. and the object rows are those rows for which the result of
  14532. the <search condition> is true. The <search condition> is
  14533. effectively evaluated for each row of T before updating any
  14534. row of T.
  14535. Each <subquery> in the <search condition> is effectively
  14536. executed for each row of T and the results used in the ap-
  14537. plication of the <search condition> to the given row of T.
  14538. If any executed <subquery> contains an outer reference to a
  14539. column of T, the reference is to the value of that column in
  14540. the given row of T.
  14541. Note: Outer reference is defined in Subclause 6.4, "<column
  14542. reference>".
  14543. 3) If any row in the set of object rows has been marked for dele-
  14544. tion by any <delete statement: positioned> that identifies some
  14545. cursor CR that is still open or updated by any <update state-
  14546. ment: positioned> that identifies some cursor CR that is still
  14547. open, then a completion condition is raised: warning-cursor
  14548. operation conflict.
  14549. 4) If the set of object rows is empty, then a completion condition
  14550. is raised: no data.
  14551. 5) If a completion condition no data has been raised, then no fur-
  14552. ther General Rules of this Subclause are applied.
  14553. 6) The <value expression>s are effectively evaluated for each row
  14554. of T before updating any row of T.
  14555. 7) A <set clause> specifies an object column and an update value
  14556. of that column. The object column is the column identified by
  14557. the <object column> in the <set clause>. The update value is the
  14558. value specified by the <update source>.
  14559. Note: The data values allowable in the object row may be con-
  14560. strained by a WITH CHECK OPTION constraint. The effect of a
  14561. WITH CHECK OPTION constraint is defined in the General Rules of
  14562. Subclause 11.19, "<view definition>".
  14563. 8) Each object row is updated as specified by each <set clause>.
  14564. For each <set clause>, the value of the specified object column,
  14565. denoted by C, is replaced by the specified update value, denoted
  14566. by SV. The General Rules of Subclause 9.2, "Store assignment",
  14567. are applied to C and SV as TARGET and VALUE, respectively.
  14568. Data manipulation 395
  14569. X3H2-92-154/DBL CBR-002
  14570. 13.10 <update statement: searched>
  14571. Leveling Rules
  14572. 1) The following restrictions apply for Intermediate SQL:
  14573. a) No leaf generally underlying table of T shall be an under-
  14574. lying table of any <query expression> generally contained in
  14575. the <search condition> or in any <value expression> immedi-
  14576. ately contained in any <update source> contained in the <set
  14577. clause list>.
  14578. 2) The following restrictions apply for Entry SQL in addition to
  14579. any Intermediate SQL restrictions:
  14580. a) If the data type of the column identified by the i-th <object
  14581. column> is an exact numeric type, then the data type of the
  14582. i-th <value expression> in the <update statement: searched>
  14583. shall be an exact numeric type.
  14584. b) If the data type of the column identified by the i-th <object
  14585. column> C is character string, then the length in characters
  14586. of the i-th <value expression> in the <update statement:
  14587. searched> shall be less than or equal to the length of C.
  14588. 396 Database Language SQL
  14589. X3H2-92-154/DBL CBR-002
  14590. 13.11 <temporary table declaration>
  14591. 13.11 <temporary table declaration>
  14592. Function
  14593. Declare a declared local temporary table that will be effectively
  14594. materialized the first time that any <procedure> in the <module>
  14595. that contains the <temporary table declaration> is executed and
  14596. whose scope is all the <procedure>s of that <module> executed
  14597. within the same SQL-session.
  14598. Format
  14599. <temporary table declaration> ::=
  14600. DECLARE LOCAL TEMPORARY TABLE <qualified local table name>
  14601. <table element list>
  14602. [ ON COMMIT { PRESERVE | DELETE } ROWS ]
  14603. Syntax Rules
  14604. 1) Let T be the <local table name> of <qualified local table name>.
  14605. T shall be different from the <local table name> of any other
  14606. <temporary table declaration> contained within the <module>.
  14607. 2) Let A be the current <authorization identifier>.
  14608. 3) The descriptor of the table defined by a <temporary table decla-
  14609. ration> includes the name of T and the column descriptor speci-
  14610. fied by each <column definition>. The i-th column descriptor is
  14611. given by the i-th <column definition>.
  14612. 4) A <temporary table declaration> shall contain at least one <col-
  14613. umn definition>.
  14614. 5) If ON COMMIT is not specified, then ON COMMIT DELETE ROWS is
  14615. implicit.
  14616. Access Rules
  14617. None.
  14618. General Rules
  14619. 1) Let U be the implementation-dependent <schema name> that is
  14620. effectively derived from the implementation-dependent SQL-
  14621. session identifier associated with the SQL-session and an
  14622. implementation-dependent name associated with the <module> that
  14623. contains the <temporary table declaration>.
  14624. 2) The definition of T within a <module> is effectively equivalent
  14625. to the definition of a persistent base table U.T. Within the
  14626. module, any reference to MODULE.T is equivalent to a reference
  14627. to U.T.
  14628. Data manipulation 397
  14629. X3H2-92-154/DBL CBR-002
  14630. 13.11 <temporary table declaration>
  14631. 3) A set of privilege descriptors is created that define the priv-
  14632. ileges INSERT, SELECT, UPDATE, DELETE, and REFERENCES on this
  14633. table and INSERT (<column name>), UPDATE (<column name>), and
  14634. REFERENCES (<column name>) for every <column definition> in the
  14635. table definition to A. These privileges are not grantable. The
  14636. grantor for each of these privilege descriptors is set to the
  14637. special grantor value "_SYSTEM".
  14638. 4) The definition of a temporary table persists for the duration
  14639. of the SQL-session. The termination of the SQL-session is effec-
  14640. tively followed by the execution of the following <drop table
  14641. statement> with the current <authorization identifier> and
  14642. current <schema name> U without further Access Rule checking:
  14643. DROP TABLE T
  14644. 5) The definition of a declared local temporary table does not
  14645. appear in any view of the Information Schema.
  14646. Leveling Rules
  14647. 1) The following restrictions apply for Intermediate SQL:
  14648. a) Conforming Intermediate SQL language shall not contain any
  14649. <temporary table declaration>.
  14650. 2) The following restrictions apply for Entry SQL in addition to
  14651. any Intermediate SQL restrictions:
  14652. None.
  14653. 398 Database Language SQL
  14654. X3H2-92-154/DBL CBR-002
  14655. 14 Transaction management
  14656. 14.1 <set transaction statement>
  14657. Function
  14658. Set the attributes of the next SQL-transaction for the SQL-agent.
  14659. Format
  14660. <set transaction statement> ::=
  14661. SET TRANSACTION <transaction mode> [ { <comma> <transaction mode> }... ]
  14662. <transaction mode> ::=
  14663. <isolation level>
  14664. | <transaction access mode>
  14665. | <diagnostics size>
  14666. <transaction access mode> ::=
  14667. READ ONLY
  14668. | READ WRITE
  14669. <isolation level> ::=
  14670. ISOLATION LEVEL <level of isolation>
  14671. <level of isolation> ::=
  14672. READ UNCOMMITTED
  14673. | READ COMMITTED
  14674. | REPEATABLE READ
  14675. | SERIALIZABLE
  14676. <diagnostics size> ::=
  14677. DIAGNOSTICS SIZE <number of conditions>
  14678. <number of conditions> ::= <simple value specification>
  14679. Syntax Rules
  14680. 1) No <transaction mode> shall be specified more than once.
  14681. 2) If an <isolation level> is not specified, then a <level of iso-
  14682. lation> of ISOLATION LEVEL SERIALIZABLE is implicit.
  14683. 3) If READ WRITE is specified, then the <level of isolation> shall
  14684. not be READ UNCOMMITTED.
  14685. Transaction management 399
  14686. X3H2-92-154/DBL CBR-002
  14687. 14.1 <set transaction statement>
  14688. 4) If a <transaction access mode> is not specified and a <level of
  14689. isolation> of READ UNCOMMITTED is specified, then READ ONLY is
  14690. implicit. Otherwise, READ WRITE is implicit.
  14691. 5) The data type of <number of conditions> shall be exact numeric
  14692. with scale 0.
  14693. Access Rules
  14694. None.
  14695. General Rules
  14696. 1) If a <set transaction statement> statement is executed when an
  14697. SQL-transaction is currently active, then an exception condition
  14698. is raised: invalid transaction state.
  14699. 2) If <number of conditions> is specified and is less than 1, then
  14700. an exception condition is raised: invalid condition number.
  14701. 3) Let TXN be the next SQL-transaction for the SQL-agent.
  14702. 4) If READ ONLY is specified, then the access mode of TXN is set to
  14703. read-only. If READ WRITE is specified, then the access mode of
  14704. TXN is set to read-write.
  14705. 5) The isolation level of TXN is set to an implementation-defined
  14706. isolation level that will not exhibit any of the phenomena that
  14707. the explicit or implicit <level of isolation> would not exhibit,
  14708. as specified in Table 9, "SQL-transaction isolation levels and
  14709. the three phenomena".
  14710. 6) If <number of conditions> is specified, then the diagnostics
  14711. area limit of TXN is set to <number of conditions>.
  14712. 7) If <number of conditions> is not specified, then the diagnostics
  14713. area limit of TXN is set to an implementation-dependent value
  14714. not less than 1.
  14715. Leveling Rules
  14716. 1) The following restrictions apply for Intermediate SQL:
  14717. None.
  14718. 2) The following restrictions apply for Entry SQL in addition to
  14719. any Intermediate SQL restrictions:
  14720. a) Conforming Entry SQL language shall not contain any <set
  14721. transaction statement>.
  14722. 400 Database Language SQL
  14723. X3H2-92-154/DBL CBR-002
  14724. 14.2 <set constraints mode statement>
  14725. 14.2 <set constraints mode statement>
  14726. Function
  14727. If an SQL-transaction is currently active, then set the constraint
  14728. mode for that SQL-transaction in the current SQL-session. If no
  14729. SQL-transaction is currently active, then set the constraint mode
  14730. for the next SQL-transaction in the current SQL-session for the
  14731. SQL-agent.
  14732. Format
  14733. <set constraints mode statement> ::=
  14734. SET CONSTRAINTS <constraint name list> { DEFERRED | IMMEDIATE }
  14735. <constraint name list> ::=
  14736. ALL
  14737. | <constraint name> [ { <comma> <constraint name> }... ]
  14738. Syntax Rules
  14739. 1) If a <constraint name> is specified, then it shall identify a
  14740. constraint.
  14741. 2) The constraint identified by <constraint name> shall be
  14742. DEFERRABLE.
  14743. Access Rules
  14744. None.
  14745. General Rules
  14746. 1) If an SQL-transaction is currently active, then let TXN be the
  14747. currently active SQL-transaction. Otherwise, let TXN be the next
  14748. SQL-transaction for the SQL-agent.
  14749. 2) If IMMEDIATE is specified, then
  14750. Case:
  14751. a) If ALL is specified, then the constraint mode in TXN of all
  14752. constraints that are DEFERRABLE is set to immediate.
  14753. b) Otherwise, the constraint mode in TXN for the constraints
  14754. identified by the <constraint name>s in the <constraint name
  14755. list> is set to immediate.
  14756. 3) If DEFERRED is specified, then
  14757. Transaction management 401
  14758. X3H2-92-154/DBL CBR-002
  14759. 14.2 <set constraints mode statement>
  14760. Case:
  14761. a) If ALL is specified, then the constraint mode in TXN of all
  14762. constraints that are DEFERRABLE is set to deferred.
  14763. b) Otherwise, the constraint mode in TXN for the constraints
  14764. identified by the <constraint name>s in the <constraint name
  14765. list> is set to deferred.
  14766. Leveling Rules
  14767. 1) The following restrictions apply for Intermediate SQL:
  14768. a) Conforming Intermediate SQL language shall not contain any
  14769. <set constraints mode statement>.
  14770. 2) The following restrictions apply for Entry SQL in addition to
  14771. any Intermediate SQL restrictions:
  14772. None.
  14773. 402 Database Language SQL
  14774. X3H2-92-154/DBL CBR-002
  14775. 14.3 <commit statement>
  14776. 14.3 <commit statement>
  14777. Function
  14778. Terminate the current SQL-transaction with commit.
  14779. Format
  14780. <commit statement> ::=
  14781. COMMIT [ WORK ]
  14782. Syntax Rules
  14783. None.
  14784. Access Rules
  14785. None.
  14786. General Rules
  14787. 1) If the current SQL-transaction is part of an encompassing trans-
  14788. action that is controlled by an agent other than the SQL-agent,
  14789. then an exception condition is raised: invalid transaction ter-
  14790. mination.
  14791. 2) For every open cursor CR in any <module> associated with the
  14792. current SQL-transaction, the following statement is implicitly
  14793. executed:
  14794. CLOSE CR
  14795. 3) For every temporary table in any <module> associated with the
  14796. current SQL-transaction that specifies the ON COMMIT DELETE
  14797. option and that was updated by the current SQL-transaction, the
  14798. execution of the <commit statement> is effectively preceded by
  14799. the execution of a <delete statement: searched> that specifies
  14800. DELETE FROM T, where T is the <table name> of that temporary
  14801. table.
  14802. 4) The effects specified in the General Rules of Subclause 14.2,
  14803. "<set constraints mode statement>" occur as if the statement SET
  14804. CONSTRAINTS ALL IMMEDIATE were executed.
  14805. 5) Case:
  14806. a) If any constraint is not satisfied, then any changes to SQL-
  14807. data or schemas that were made by the current SQL-transaction
  14808. are canceled and an exception condition is raised: transac-
  14809. tion rollback-integrity constraint violation.
  14810. Transaction management 403
  14811. X3H2-92-154/DBL CBR-002
  14812. 14.3 <commit statement>
  14813. b) If any other error preventing commitment of the SQL-
  14814. transaction has occurred, then any changes to SQL-data or
  14815. schemas that were made by the current SQL-transaction are
  14816. canceled and an exception condition is raised: transaction
  14817. rollback with an implementation-defined subclass value.
  14818. c) Otherwise, any changes to SQL-data or schemas that were made
  14819. by the current SQL-transaction are made accessible to all
  14820. concurrent and subsequent SQL-transactions.
  14821. 6) The current SQL-transaction is terminated.
  14822. Leveling Rules
  14823. 1) The following restrictions apply for Intermediate SQL:
  14824. None.
  14825. 2) The following restrictions apply for Entry SQL in addition to
  14826. any Intermediate SQL restrictions:
  14827. a) In conforming Entry SQL language, WORK shall be specified.
  14828. 404 Database Language SQL
  14829. X3H2-92-154/DBL CBR-002
  14830. 14.4 <rollback statement>
  14831. 14.4 <rollback statement>
  14832. Function
  14833. Terminate the current SQL-transaction with rollback.
  14834. Format
  14835. <rollback statement> ::=
  14836. ROLLBACK [ WORK ]
  14837. Syntax Rules
  14838. None.
  14839. Access Rules
  14840. None.
  14841. General Rules
  14842. 1) If the current SQL-transaction is part of an encompassing trans-
  14843. action that is controlled by an agent other than the SQL-agent
  14844. and the <rollback statement> is not being implicitly executed,
  14845. then an exception condition is raised: invalid transaction ter-
  14846. mination.
  14847. 2) For every open cursor CR in any <module> associated with the
  14848. current SQL-transaction, the following statement is implicitly
  14849. executed:
  14850. CLOSE CR
  14851. 3) Any changes to SQL-data or schemas that were made by the current
  14852. SQL-transaction are canceled.
  14853. 4) The current SQL-transaction is terminated.
  14854. Leveling Rules
  14855. 1) The following restrictions apply for Intermediate SQL:
  14856. None.
  14857. 2) The following restrictions apply for Entry SQL in addition to
  14858. any Intermediate SQL restrictions:
  14859. a) In conforming Entry SQL language, WORK shall be specified.
  14860. Transaction management 405
  14861. X3H2-92-154/DBL CBR-002
  14862. 406 Database Language SQL
  14863. X3H2-92-154/DBL CBR-002
  14864. 15 Connection management
  14865. 15.1 <connect statement>
  14866. Function
  14867. Establish an SQL-connection.
  14868. Format
  14869. <connect statement> ::=
  14870. CONNECT TO <connection target>
  14871. <connection target> ::=
  14872. <SQL-server name>
  14873. [ AS <connection name> ]
  14874. [ USER <user name> ]
  14875. | DEFAULT
  14876. Syntax Rules
  14877. 1) If <user name> is not specified, then an implementation-defined
  14878. <user name> for the SQL-connection is implicit.
  14879. Access Rules
  14880. None.
  14881. General Rules
  14882. 1) If a <connect statement> is executed after the first transaction-
  14883. initiating SQL-statement executed by the current SQL-transaction
  14884. and the implementation does not support transactions that affect
  14885. more than one SQL-server, then an exception condition is raised:
  14886. feature not supported-multiple server transactions
  14887. 2) If <user name> is specified, then let S be the character string
  14888. that is the value of <user name> and let V be the character
  14889. string that is the value of
  14890. TRIM ( BOTH ' ' FROM CV )
  14891. 3) If V does not conform to the Format and Syntax Rules of an <au-
  14892. thorization identifier>, then an exception condition is raised:
  14893. invalid authorization specification.
  14894. Connection management 407
  14895. X3H2-92-154/DBL CBR-002
  14896. 15.1 <connect statement>
  14897. 4) If the <module> that contains the <procedure> that contains the
  14898. <connect statement> specifies a <module authorization identi-
  14899. fier>, then whether or not <user name> must be identical to that
  14900. <module authorization identifier> is implementation-defined,
  14901. as are any other restrictions on the value of <user name>.
  14902. Otherwise, any restrictions on the value of <user name> are
  14903. implementation-defined.
  14904. 5) If the value of <user name> violates the implementation-defined
  14905. restrictions, then an exception condition is raised: invalid
  14906. authorization specification.
  14907. 6) If <connection name> was specified, then let CV be the value
  14908. of the <simple value specification> immediately contained in
  14909. <connection name>. If neither DEFAULT nor <connection name> were
  14910. specified, then let CV be the value of <SQL-server name>. Let CN
  14911. be the result of
  14912. TRIM ( BOTH ' ' FROM CV )
  14913. If CN does not conform to the Format and Syntax Rules of an
  14914. <identifier>, then an exception condition is raised: invalid
  14915. connection name.
  14916. 7) If an SQL-connection with name CN has already been established
  14917. by the current SQL-agent and has not been disconnected, or if
  14918. DEFAULT is specified and a default SQL-connection has already
  14919. been established by the current SQL-agent and has not been dis-
  14920. connected, then an exception condition is raised: connection
  14921. exception-connection name in use.
  14922. 8) Case:
  14923. a) If DEFAULT is specified, then the default SQL-session is
  14924. initiated and associated with the default SQL-server. The
  14925. method by which the default SQL-server is determined is
  14926. implementation-defined.
  14927. b) Otherwise, an SQL-session is initiated and associated with
  14928. the SQL-server identified by <SQL-server name>. The method by
  14929. which <SQL-server name> is used to determine the appropriate
  14930. SQL-server is implementation-defined.
  14931. 9) If the <connect statement> successfully initiates an SQL-
  14932. session, then:
  14933. a) The current SQL-connection and current SQL-session, if any,
  14934. become a dormant SQL-connection and a dormant SQL-session,
  14935. respectively. The SQL-server context information is preserved
  14936. and is not affected in any way by operations performed over
  14937. the initiated SQL-connection.
  14938. Note: The SQL-session context information is defined in
  14939. Subclause 4.30, "SQL-sessions".
  14940. 408 Database Language SQL
  14941. X3H2-92-154/DBL CBR-002
  14942. 15.1 <connect statement>
  14943. b) The SQL-session initiated by the <connect statement> becomes
  14944. the current SQL-session and the SQL-connection established to
  14945. that SQL-session becomes the current SQL-connection.
  14946. Note: If the <connect statement> fails to initiate an SQL-
  14947. session, then the current SQL-connection and current SQL-
  14948. session, if any, remain unchanged.
  14949. 10)If the SQL-client cannot establish the SQL-connection, then an
  14950. exception condition is raised: connection exception- SQL-client
  14951. unable to establish SQL-connection.
  14952. 11)If the SQL-server rejects the establishment of the SQL-
  14953. connection, then an exception condition is raised: connection
  14954. exception- SQL-server rejected establishment of SQL-connection.
  14955. 12)The SQL-server for the subsequent execution of <procedure>s
  14956. in any <module>s associated with the SQL-agent is set to the
  14957. SQL-server identified by <SQL-server name>.
  14958. 13)The SQL-session <authorization identifier> is set to <user
  14959. name>.
  14960. Leveling Rules
  14961. 1) The following restrictions apply for Intermediate SQL:
  14962. a) Conforming Intermediate SQL language shall not contain any
  14963. <connect statement>.
  14964. 2) The following restrictions apply for Entry SQL in addition to
  14965. any Intermediate SQL restrictions:
  14966. None.
  14967. Connection management 409
  14968. X3H2-92-154/DBL CBR-002
  14969. 15.2 <set connection statement>
  14970. 15.2 <set connection statement>
  14971. Function
  14972. Select an SQL-connection from the available SQL-connections.
  14973. Format
  14974. <set connection statement> ::=
  14975. SET CONNECTION <connection object>
  14976. <connection object> ::=
  14977. DEFAULT
  14978. | <connection name>
  14979. Syntax Rules
  14980. None.
  14981. Access Rules
  14982. None.
  14983. General Rules
  14984. 1) If a <set connection statement> is executed after the first
  14985. transaction-initiating SQL-statement executed by the current
  14986. SQL-transaction and the implementation does not support trans-
  14987. actions that affect more than one SQL-server, then an excep-
  14988. tion condition is raised: feature not supported-multiple server
  14989. transactions.
  14990. 2) Case:
  14991. a) If DEFAULT is specified and there is no default SQL-
  14992. connection that is current or dormant for the current SQL-
  14993. agent, then an exception condition is raised: connection
  14994. exception-connection does not exist.
  14995. b) Otherwise, if <connection name> does not identify an SQL-
  14996. session that is current or dormant for the current SQL-agent,
  14997. then an exception condition is raised: connection exception-
  14998. connection does not exist.
  14999. 3) If the SQL-connection identified by <connection object> cannot
  15000. be selected, then an exception condition is raised: connection
  15001. exception-connection failure.
  15002. 4) The current SQL-connection and current SQL-session become a dor-
  15003. mant SQL-connection and a dormant SQL-session, respectively.
  15004. 410 Database Language SQL
  15005. X3H2-92-154/DBL CBR-002
  15006. 15.2 <set connection statement>
  15007. The SQL-server context information is preserved and is not af-
  15008. fected in any way by operations performed over the selected
  15009. SQL-connection.
  15010. Note: The SQL-session context information is defined in
  15011. Subclause 4.30, "SQL-sessions".
  15012. 5) The SQL-connection identified by <connection object> becomes the
  15013. current SQL-connection and the SQL-session associated with that
  15014. SQL-connection becomes the current SQL-session. All SQL-session
  15015. context information is restored to the same state as at the time
  15016. the SQL-connection became dormant.
  15017. Note: The SQL-session context information is defined in
  15018. Subclause 4.30, "SQL-sessions".
  15019. 6) The SQL-server for the subsequent execution of <procedure>s in
  15020. any <module>s associated with the SQL-agent is set to that of
  15021. the current SQL-connection.
  15022. Leveling Rules
  15023. 1) The following restrictions apply for Intermediate SQL:
  15024. a) Conforming Intermediate SQL language shall not contain any
  15025. <set connection statement>.
  15026. 2) The following restrictions apply for Entry SQL in addition to
  15027. any Intermediate SQL restrictions:
  15028. None.
  15029. Connection management 411
  15030. X3H2-92-154/DBL CBR-002
  15031. 15.3 <disconnect statement>
  15032. 15.3 <disconnect statement>
  15033. Function
  15034. Terminate an SQL-connection.
  15035. Format
  15036. <disconnect statement> ::=
  15037. DISCONNECT <disconnect object>
  15038. <disconnect object> ::=
  15039. <connection object>
  15040. | ALL
  15041. | CURRENT
  15042. Syntax Rules
  15043. None.
  15044. Access Rules
  15045. None.
  15046. General Rules
  15047. 1) If <connection name> is specified and <connection name> does
  15048. not identify an SQL-connection that is current or dormant for
  15049. the current SQL-agent, then an exception condition is raised:
  15050. connection exception-connection does not exist.
  15051. 2) If DEFAULT is specified and there is no default SQL-connection
  15052. that is current or dormant for the current SQL-agent, then an
  15053. exception condition is raised: connection exception-connection
  15054. does not exist.
  15055. 3) If CURRENT is specified and there is no current SQL-connection
  15056. for the current SQL-agent, then an exception condition is
  15057. raised: connection exception-connection does not exist.
  15058. 4) Let C be the current SQL-connection.
  15059. 5) Let L be a list of SQL-connections. If a <connection name> is
  15060. specified, then L is that SQL-connection. If CURRENT is spec-
  15061. ified, then L is the current SQL-connection, if any. If ALL is
  15062. specified, then L is a list representing every SQL-connection
  15063. that is current or dormant for the current SQL-agent, in an
  15064. implementation-dependent order. If DEFAULT is specified, then L
  15065. is the default SQL-connection.
  15066. 6) If any SQL-connection in L is active, then an exception condi-
  15067. tion is raised: invalid transaction state.
  15068. 412 Database Language SQL
  15069. X3H2-92-154/DBL CBR-002
  15070. 15.3 <disconnect statement>
  15071. 7) For every SQL-connection C1 in L, treating the SQL-session S1
  15072. identified by C1 as the current SQL-session, all of the actions
  15073. that are required after the last call of a <procedure> by an
  15074. SQL-agent, except for the execution of a <rollback statement>
  15075. or a <commit statement>, are performed. C1 is terminated, re-
  15076. gardless of any exception condition that might occur during the
  15077. disconnection process.
  15078. Note: See the General Rules of Subclause 12.1, "<module>", for
  15079. the actions to be performed after the last call of a <procedure>
  15080. by an SQL-agent.
  15081. 8) If any error is detected during execution of a <disconnect
  15082. statement>, then a completion condition is raised: warning-
  15083. disconnect error.
  15084. 9) If C is contained in L, then there is no current SQL-connection
  15085. following the execution of the <disconnect statement>. Otherwise,
  15086. C remains the current SQL-connection.
  15087. Leveling Rules
  15088. 1) The following restrictions apply for Intermediate SQL:
  15089. a) Conforming Intermediate SQL language shall not contain any
  15090. <disconnect statement>.
  15091. 2) The following restrictions apply for Entry SQL in addition to
  15092. any Intermediate SQL restrictions:
  15093. None.
  15094. Connection management 413
  15095. X3H2-92-154/DBL CBR-002
  15096. 414 Database Language SQL
  15097. X3H2-92-154/DBL CBR-002
  15098. 16 Session management
  15099. 16.1 <set catalog statement>
  15100. Function
  15101. Set the default catalog name for unqualified <schema name>s in
  15102. <preparable statement>s that are prepared in the current SQL-
  15103. session by an <execute immediate statement> or a <prepare state-
  15104. ment> and in <direct SQL statement>s that are invoked directly.
  15105. Format
  15106. <set catalog statement> ::=
  15107. SET CATALOG <value specification>
  15108. Syntax Rules
  15109. 1) The <data type> of the <value specification> shall be an SQL
  15110. character data type.
  15111. Access Rules
  15112. None.
  15113. General Rules
  15114. 1) Let S be the character string that is the value of the <value
  15115. specification> and let V be the character string that is the
  15116. value of
  15117. TRIM ( BOTH ' ' FROM S )
  15118. 2) If V does not conform to the Format and Syntax Rules of a <cat-
  15119. alog name>, then an exception condition is raised: invalid
  15120. catalog name.
  15121. 3) The default catalog name of the current SQL-session is set to V.
  15122. Leveling Rules
  15123. 1) The following restrictions apply for Intermediate SQL:
  15124. a) Conforming Intermediate SQL language shall not contain any
  15125. <set catalog statement>.
  15126. Session management 415
  15127. X3H2-92-154/DBL CBR-002
  15128. 16.1 <set catalog statement>
  15129. 2) The following restrictions apply for Entry SQL in addition to
  15130. any Intermediate SQL restrictions
  15131. None.
  15132. 416 Database Language SQL
  15133. X3H2-92-154/DBL CBR-002
  15134. 16.2 <set schema statement>
  15135. 16.2 <set schema statement>
  15136. Function
  15137. Set the default schema name for unqualified <qualified name>s in
  15138. <preparable statement>s that are prepared in the current SQL-
  15139. session by an <execute immediate statement> or a <prepare state-
  15140. ment> and in <direct SQL statement>s that are invoked directly.
  15141. Format
  15142. <set schema statement> ::=
  15143. SET SCHEMA <value specification>
  15144. Syntax Rules
  15145. 1) The data type of the <value specification> shall be an SQL char-
  15146. acter data type.
  15147. Access Rules
  15148. None.
  15149. General Rules
  15150. 1) Let S be the character string that is the value of the <value
  15151. specification> and let V be the character string that is the
  15152. value of
  15153. TRIM ( BOTH ' ' FROM S )
  15154. 2) If V does not conform to the Format and Syntax Rules of a
  15155. <schema name>, then an exception condition is raised: invalid
  15156. schema name.
  15157. 3) Case:
  15158. a) If V conforms to the Format and Syntax Rules for a <schema
  15159. name> that contains a <catalog name>, then let X be the <cat-
  15160. alog name> part and let Y be the <unqualified schema name>
  15161. part of V. The following statement is implicitly executed:
  15162. SET CATALOG 'X'
  15163. and the <set schema statement> is effectively replaced by:
  15164. SET SCHEMA 'Y'
  15165. b) Otherwise, the default unqualified schema name of the current
  15166. SQL-session is set to V.
  15167. Session management 417
  15168. X3H2-92-154/DBL CBR-002
  15169. 16.2 <set schema statement>
  15170. Leveling Rules
  15171. 1) The following restrictions apply for Intermediate SQL:
  15172. a) Conforming Intermediate SQL language shall not contain any
  15173. <set schema statement>.
  15174. 2) The following restrictions apply for Entry SQL in addition to
  15175. any Intermediate SQL restrictions:
  15176. None.
  15177. 418 Database Language SQL
  15178. X3H2-92-154/DBL CBR-002
  15179. 16.3 <set names statement>
  15180. 16.3 <set names statement>
  15181. Function
  15182. Set the default character set name for <identifier>s and <character
  15183. string literal>s in <preparable statement>s that are prepared in
  15184. the current SQL-session by an <execute immediate statement> or a
  15185. <prepare statement> and in <direct SQL statement>s that are invoked
  15186. directly.
  15187. Format
  15188. <set names statement> ::=
  15189. SET NAMES <value specification>
  15190. Syntax Rules
  15191. 1) The <data type> of the <value specification> shall be an SQL
  15192. character data type.
  15193. Access Rules
  15194. None.
  15195. General Rules
  15196. 1) Let S be the character string that is the value of the <value
  15197. specification> and let V be the character string that is the
  15198. value of
  15199. TRIM ( BOTH ' ' FROM S )
  15200. 2) If V does not conform to the Format and Syntax Rules of a <char-
  15201. acter set name>, then an exception condition is raised: invalid
  15202. character set name.
  15203. 3) The default character set name of the current SQL-session is set
  15204. to V.
  15205. Leveling Rules
  15206. 1) The following restrictions apply for Intermediate SQL:
  15207. a) Conforming Intermediate SQL language shall not contain any
  15208. <set names statement>.
  15209. 2) The following restrictions apply for Entry SQL in addition to
  15210. any Intermediate SQL restrictions:
  15211. None.
  15212. Session management 419
  15213. X3H2-92-154/DBL CBR-002
  15214. 16.4 <set session authorization identifier statement>
  15215. 16.4 <set session authorization identifier statement>
  15216. Function
  15217. Set the <authorization identifier> of the current SQL-session.
  15218. Format
  15219. <set session authorization identifier statement> ::=
  15220. SET SESSION AUTHORIZATION <value specification>
  15221. Syntax Rules
  15222. 1) The <data type> of the <value specification> shall be an SQL
  15223. character data type.
  15224. Access Rules
  15225. None.
  15226. General Rules
  15227. 1) If a <set session authorization identifier statement> is ex-
  15228. ecuted and an SQL-transaction is currently active, then an
  15229. exception condition is raised: invalid transaction state.
  15230. 2) Let S be the character string that is the value of the <value
  15231. specification> and let V be the character string that is the
  15232. value of
  15233. TRIM ( BOTH ' 'FROM S )
  15234. 3) If V does not conform to the Format and Syntax Rules of an <au-
  15235. thorization identifier>, then an exception condition is raised:
  15236. invalid authorization specification.
  15237. 4) Whether or not the <authorization identifier> for the SQL-
  15238. session can be set to an <authorization identifier> other than
  15239. the <authorization identifier> of the SQL-session when the
  15240. SQL-session is started is implementation-defined, as are any
  15241. restrictions pertaining to such changes.
  15242. 5) If the current <authorization identifier> is restricted from
  15243. setting the <authorization identifier> to the specified value,
  15244. then an exception condition is raised: invalid authorization
  15245. specification.
  15246. 6) Let T be any temporary table defined in the currently active
  15247. SQL-session. In all the privilege descriptors for T and for each
  15248. of the columns of T, the <authorization identifier> is set to V.
  15249. 420 Database Language SQL
  15250. X3H2-92-154/DBL CBR-002
  15251. 16.4 <set session authorization identifier statement>
  15252. 7) The <authorization identifier> of the current SQL-session is set
  15253. to V.
  15254. Leveling Rules
  15255. 1) The following restrictions apply for Intermediate SQL:
  15256. None.
  15257. 2) The following restrictions apply for Entry SQL in addition to
  15258. any Intermediate SQL restrictions:
  15259. a) Conforming Entry SQL language shall not contain any <set
  15260. session authorization identifier statement>.
  15261. Session management 421
  15262. X3H2-92-154/DBL CBR-002
  15263. 16.5 <set local time zone statement>
  15264. 16.5 <set local time zone statement>
  15265. Function
  15266. Set the default local time zone displacement for the current SQL-
  15267. session.
  15268. Format
  15269. <set local time zone statement> ::=
  15270. SET TIME ZONE <set time zone value>
  15271. <set time zone value> ::=
  15272. <interval value expression>
  15273. | LOCAL
  15274. Syntax Rules
  15275. 1) The <data type> of the <interval value expression> immediately
  15276. contained in the <set time zone value> shall be INTERVAL HOUR TO
  15277. MINUTE.
  15278. Access Rules
  15279. None.
  15280. General Rules
  15281. 1) Case:
  15282. a) If LOCAL is specified, then the default local time zone dis-
  15283. placement of the current SQL-session is set to the original
  15284. implementation-defined default local time zone displace-
  15285. ment that was established when the current SQL-session was
  15286. started.
  15287. b) Otherwise,
  15288. Case:
  15289. i) If the value of the <interval value expression> is not the
  15290. null value and is between INTERVAL -'12:59' and INTERVAL
  15291. +'13:00', then the default local time zone displacement of
  15292. the current SQL-session is set to the value of the <inter-
  15293. val value expression>.
  15294. ii) Otherwise, an exception condition is raised: data exception-
  15295. invalid time zone displacement value.
  15296. 422 Database Language SQL
  15297. X3H2-92-154/DBL CBR-002
  15298. 16.5 <set local time zone statement>
  15299. Leveling Rules
  15300. 1) The following restrictions apply for Intermediate SQL;
  15301. None.
  15302. 2) The following restrictions apply for Entry SQL;
  15303. a) Conforming Entry SQL language shall not contain any <set
  15304. local time zone statement>.
  15305. Session management 423
  15306. X3H2-92-154/DBL CBR-002
  15307. 424 Database Language SQL
  15308. X3H2-92-154/DBL CBR-002
  15309. 17 Dynamic SQL
  15310. 17.1 Description of SQL item descriptor areas
  15311. Function
  15312. Specify the identifiers, data types, and codes used in SQL item
  15313. descriptor areas.
  15314. Syntax Rules
  15315. 1) An SQL item descriptor area comprises the items specified in
  15316. Table 17, "Data types of <key word>s used in SQL item descriptor
  15317. areas".
  15318. 2) Let DT be a data type. The data type T of a <simple value spec-
  15319. ification> or a <simple target specification> SVT is said to
  15320. match the data type specified by the item descriptor area if and
  15321. only if one of the following conditions is true.
  15322. Case:
  15323. a) TYPE indicates NUMERIC and T is specified by NUMERIC(P,S),
  15324. where P is the value of PRECISION and S is the value of
  15325. SCALE.
  15326. b) TYPE indicates DECIMAL and T is specified by DECIMAL(P,S),
  15327. where P is the value of PRECISION and S is the value of
  15328. SCALE.
  15329. c) TYPE indicates INTEGER and T is specified by INTEGER.
  15330. d) TYPE indicates SMALLINT and T is specified by SMALLINT.
  15331. e) TYPE indicates FLOAT and T is specified by FLOAT(P), where P
  15332. is the value of PRECISION.
  15333. f) TYPE indicates REAL and T is specified by REAL.
  15334. g) TYPE indicates DOUBLE PRECISION and T is specified by DOUBLE
  15335. PRECISION.
  15336. h) TYPE indicates BIT and T is specified by BIT(L), where L is
  15337. the value of LENGTH.
  15338. i) TYPE indicates BIT VARYING and T is specified by BIT
  15339. VARYING(L), where
  15340. Case:
  15341. i) SVT is a <simple value specification> and L is the value of
  15342. LENGTH.
  15343. Dynamic SQL 425
  15344. X3H2-92-154/DBL CBR-002
  15345. 17.1 Description of SQL item descriptor areas
  15346. ii) SVT is a <simple target specification> and L is not less
  15347. than the value of LENGTH.
  15348. j) TYPE indicates CHARACTER and T is specified by CHARACTER(L),
  15349. where L is the value of LENGTH and the <character set spec-
  15350. ification> formed by the values of CHARACTER_SET_CATALOG,
  15351. CHARACTER_SET_SCHEMA, and CHARACTER_SET_NAME identifies the
  15352. character set of SVT.
  15353. k) TYPE indicates CHARACTER VARYING and T is specified by
  15354. CHARACTER VARYING(L), where the <character set specification>
  15355. formed by the values of CHARACTER_SET_CATALOG, CHARACTER_SET_
  15356. SCHEMA, and CHARACTER_SET_NAME identifies the character set
  15357. of SVT and
  15358. Case:
  15359. i) SVT is a <simple value specification> and L is the value of
  15360. LENGTH.
  15361. ii) SVT is a <simple target specification> and L is not less
  15362. than the value of LENGTH.
  15363. 3) An item descriptor area is valid if and only if TYPE indicates
  15364. a code defined in Table 18, "Codes used for SQL data types in
  15365. Dynamic SQL", and one of the following is true:
  15366. Case:
  15367. a) TYPE indicates NUMERIC and PRECISION and SCALE are valid
  15368. precision and scale values for the NUMERIC data type.
  15369. b) TYPE indicates DECIMAL and PRECISION and SCALE are valid
  15370. precision and scale values for the DECIMAL data type.
  15371. c) TYPE indicates FLOAT and PRECISION is a valid precision value
  15372. for the FLOAT data type.
  15373. d) TYPE indicates INTEGER, SMALLINT, REAL, or DOUBLE PRECISION.
  15374. e) TYPE indicates BIT or BIT VARYING and LENGTH is a valid
  15375. length value for the BIT date type.
  15376. f) TYPE indicates CHARACTER or CHARACTER VARYING, LENGTH
  15377. is a valid length value for the CHARACTER data type, and
  15378. CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and CHARACTER_
  15379. SET_NAME are a valid qualified character set name for the
  15380. CHARACTER data type.
  15381. g) TYPE indicates a <datetime type>, DATETIME_INTERVAL_CODE is a
  15382. code specified in Table 19, "Codes associated with datetime
  15383. data types in Dynamic SQL", and PRECISION is a valid value
  15384. for the <time precision> or <timestamp precision> of the
  15385. indicated datetime datatype.
  15386. 426 Database Language SQL
  15387. X3H2-92-154/DBL CBR-002
  15388. 17.1 Description of SQL item descriptor areas
  15389. h) TYPE indicates an <interval type>, DATETIME_INTERVAL_CODE
  15390. is a code specified in Table 20, "Codes used for <interval
  15391. qualifier>s in Dynamic SQL", and DATETIME_INTERVAL_PRECISION
  15392. and PRECISION are valid values for <interval leading field
  15393. precision> and <interval fractional seconds precision> for an
  15394. <interval qualifier>.
  15395. Table 17-Data types of <key word>s
  15396. _________________used_in_SQL_item_descriptor_areas_________________
  15397. _<key_word>_____________Data_Type__________________________________
  15398. | TYPE | exact numeric with scale 0 |
  15399. | | |
  15400. | LENGTH | exact numeric with scale 0 |
  15401. | | |
  15402. | OCTET_LENGTH | exact numeric with scale 0 |
  15403. | | |
  15404. | RETURNED_LENGTH | exact numeric with scale 0 |
  15405. | | |
  15406. | RETURNED_OCTET_ | exact numeric with scale 0 |
  15407. LENGTH
  15408. | PRECISION | exact numeric with scale 0 |
  15409. | | |
  15410. | SCALE | exact numeric with scale 0 |
  15411. | | |
  15412. | DATETIME_INTERVAL_ | exact numeric with scale 0 |
  15413. CODE
  15414. | DATETIME_INTERVAL_ | exact numeric with scale 0 |
  15415. | PRECISION | |
  15416. | | |
  15417. | NULLABLE | exact numeric with scale 0 |
  15418. | | |
  15419. | INDICATOR | exact numeric with scale 0 |
  15420. | | |
  15421. | DATA | matches data type specified by TYPE, |
  15422. LENGTH, PRECISION, SCALE, DATETIME_
  15423. INTERVAL_CODE, DATETIME_INTERVAL_
  15424. PRECISION, CHARACTER_SET_CATALOG,
  15425. CHARACTER_SET_SCHEMA, and CHARACTER_SET_
  15426. NAME
  15427. | NAME | character string with character set SQL_ |
  15428. | | TEXT and length not less than 128 charac- |
  15429. | | ters |
  15430. | | |
  15431. | UNNAMED | exact numeric with scale 0 |
  15432. | | |
  15433. | COLLATION_CATALOG | character string with character set SQL_ |
  15434. | | TEXT and length not less than 128 charac- |
  15435. ters
  15436. | COLLATION_SCHEMA | character string with character set SQL_ |
  15437. | | TEXT and length not less than 128 charac- |
  15438. | | ters |
  15439. | | |
  15440. Dynamic SQL 427
  15441. X3H2-92-154/DBL CBR-002
  15442. 17.1 Description of SQL item descriptor areas
  15443. Table 17-Data types of <key word>s used
  15444. ________________in_SQL_item_descriptor_areas_(Cont.)_______________
  15445. _<key_word>_____________Data_Type__________________________________
  15446. | COLLATION_NAME | character string with character set SQL_ |
  15447. TEXT and length not less than 128 charac-
  15448. ters
  15449. | CHARACTER_SET_ | character string with character set SQL_ |
  15450. | CATALOG | TEXT and length not less than 128 charac- |
  15451. | | ters |
  15452. | | |
  15453. | CHARACTER_SET_SCHEMA | character string with character set SQL_ |
  15454. | | TEXT and length not less than 128 charac- |
  15455. | | ters |
  15456. | | |
  15457. | CHARACTER_SET_NAME | character string with character set SQL_ |
  15458. | | TEXT and length not less than 128 charac- |
  15459. |______________________|_ters______________________________________|
  15460. | | |
  15461. |Access Rules | |
  15462. | | |
  15463. None.
  15464. General Rules
  15465. 1) Table 18, "Codes used for SQL data types in Dynamic SQL", speci-
  15466. fies the codes associated with the SQL data types.
  15467. 428 Database Language SQL
  15468. X3H2-92-154/DBL CBR-002
  15469. 17.1 Description of SQL item descriptor areas
  15470. _______Table_18-Codes_used_for_SQL_data_types_in_Dynamic_SQL_______
  15471. _Data_Type__________________Code___________________________________
  15472. | Implementation-defined | < 0 |
  15473. data types
  15474. | BIT | 14 |
  15475. | | |
  15476. | BIT VARYING | 15 |
  15477. | | |
  15478. | CHARACTER | 1 |
  15479. | | |
  15480. | CHARACTER VARYING | 12 |
  15481. | | |
  15482. | DATE, TIME, or TIMESTAMP | 9 |
  15483. | | |
  15484. | DECIMAL | 3 |
  15485. | | |
  15486. | DOUBLE PRECISION | 8 |
  15487. | | |
  15488. | FLOAT | 6 |
  15489. | | |
  15490. | INTEGER | 4 |
  15491. | | |
  15492. | INTERVAL | 10 |
  15493. | | |
  15494. | NUMERIC | 2 |
  15495. | | |
  15496. | REAL | 7 |
  15497. | | |
  15498. |_SMALLINT_________________|_5_____________________________________|
  15499. | | |
  15500. 2) Table 19, "Codes associated with datetime data types in Dynamic
  15501. SQL", specifies the codes associated with the datetime data
  15502. types.
  15503. _Table_19-Codes_associated_with_datetime_data_types_in_Dynamic_SQL_
  15504. _Datetime_Data_Type_________Code___________________________________
  15505. | DATE | 1 |
  15506. | | |
  15507. | TIME | 2 |
  15508. | | |
  15509. | TIME WITH TIME ZONE | 4 |
  15510. | | |
  15511. | TIMESTAMP | 3 |
  15512. | | |
  15513. |_TIMESTAMP_WITH_TIME_ZONE_|_5_____________________________________|
  15514. | | |
  15515. 3) Table 20, "Codes used for <interval qualifier>s in Dynamic SQL",
  15516. specifies the codes associated with <interval qualifier>s for
  15517. interval data types.
  15518. Dynamic SQL 429
  15519. X3H2-92-154/DBL CBR-002
  15520. 17.1 Description of SQL item descriptor areas
  15521. ____Table_20-Codes_used_for_<interval_qualifier>s_in_Dynamic_SQL___
  15522. _Datetime_Qualifier_________Code___________________________________
  15523. | DAY | 3 |
  15524. | | |
  15525. | DAY TO HOUR | 8 |
  15526. | | |
  15527. | DAY TO MINUTE | 9 |
  15528. | | |
  15529. | DAY TO SECOND | 10 |
  15530. | | |
  15531. | HOUR | 4 |
  15532. | | |
  15533. | HOUR TO MINUTE | 11 |
  15534. | | |
  15535. | HOUR TO SECOND | 12 |
  15536. | | |
  15537. | MINUTE | 5 |
  15538. | | |
  15539. | MINUTE TO SECOND | 13 |
  15540. | | |
  15541. | MONTH | 2 |
  15542. | | |
  15543. | SECOND | 6 |
  15544. | | |
  15545. | YEAR | 1 |
  15546. | | |
  15547. |_YEAR_TO_MONTH____________|_7_____________________________________|
  15548. | | |
  15549. Leveling Rules
  15550. 1) The following restrictions apply for Intermediate SQL:
  15551. None.
  15552. 2) The following restrictions apply for Entry SQL in addition to
  15553. any Intermediate SQL restrictions:
  15554. None.
  15555. 430 Database Language SQL
  15556. X3H2-92-154/DBL CBR-002
  15557. 17.2 <allocate descriptor statement>
  15558. 17.2 <allocate descriptor statement>
  15559. Function
  15560. Allocate an SQL descriptor area.
  15561. Format
  15562. <allocate descriptor statement> ::=
  15563. ALLOCATE DESCRIPTOR <descriptor name> [ WITH MAX <occurrences> ]
  15564. <occurrences> ::= <simple value specification>
  15565. Syntax Rules
  15566. 1) The data type of <occurrences> shall be exact numeric with scale
  15567. 0.
  15568. 2) If WITH MAX <occurrences> is not specified, then an implementation-
  15569. defined default value for <occurrences> that is greater than 0
  15570. is implicit.
  15571. Access Rules
  15572. None.
  15573. General Rules
  15574. 1) Let S be the character string that is the value of the <simple
  15575. value specification> that is immediately contained in <descrip-
  15576. tor name> and let V be the character string that is the result
  15577. of
  15578. TRIM ( BOTH ' ' FROM S )
  15579. If V does not conform to the Format and Syntax Rules of an
  15580. <identifier>, then an exception condition is raised: invalid
  15581. SQL descriptor name.
  15582. 2) The <allocate descriptor statement> allocates an SQL descriptor
  15583. area whose name is V and whose scope is specified by the <scope
  15584. clause>. The descriptor area will have at least <occurrences>
  15585. number of item descriptor areas. All values are initially un-
  15586. defined. If an SQL descriptor has already been allocated whose
  15587. name is V, whose scope is specified by the <scope option>, and
  15588. that has not yet been deallocated, then an exception condition
  15589. is raised: invalid SQL descriptor name.
  15590. 3) If <occurrences> is less than 1 or is greater than an implementation-
  15591. defined maximum value, then an exception condition is raised:
  15592. dynamic SQL error-invalid descriptor index. The maximum number
  15593. Dynamic SQL 431
  15594. X3H2-92-154/DBL CBR-002
  15595. 17.2 <allocate descriptor statement>
  15596. of SQL descriptor areas that can be allocated at one time is
  15597. implementation-defined.
  15598. Leveling Rules
  15599. 1) The following restrictions apply for Intermediate SQL:
  15600. a) An <occurrences> and a <descriptor name> shall be a <lit-
  15601. eral>.
  15602. 2) The following restrictions apply for Entry SQL in addition to
  15603. any Intermediate SQL restrictions:
  15604. a) Conforming Entry SQL language shall not contain any Dynamic
  15605. SQL language.
  15606. 432 Database Language SQL
  15607. X3H2-92-154/DBL CBR-002
  15608. 17.3 <deallocate descriptor statement>
  15609. 17.3 <deallocate descriptor statement>
  15610. Function
  15611. Deallocate an SQL descriptor area.
  15612. Format
  15613. <deallocate descriptor statement> ::=
  15614. DEALLOCATE DESCRIPTOR <descriptor name>
  15615. Syntax Rules
  15616. None.
  15617. Access Rules
  15618. None.
  15619. General Rules
  15620. 1) The <deallocate descriptor statement> deallocates an SQL de-
  15621. scriptor area whose name is the value of the <descriptor name>'s
  15622. <simple value specification> and whose scope is specified by
  15623. the <scope clause>. If an SQL descriptor area is not currently
  15624. allocated whose name is the value of the <descriptor name>'s
  15625. <simple value specification> and whose scope is specified by the
  15626. <scope option>, then an exception condition is raised: invalid
  15627. SQL descriptor name.
  15628. Leveling Rules
  15629. 1) The following restrictions apply for Intermediate SQL:
  15630. a) A <descriptor name> shall be a <literal>.
  15631. 2) The following restrictions apply for Entry SQL in addition to
  15632. any Intermediate SQL restrictions:
  15633. a) Conforming Entry SQL language shall contain no Dynamic SQL
  15634. language.
  15635. Dynamic SQL 433
  15636. X3H2-92-154/DBL CBR-002
  15637. 17.4 <get descriptor statement>
  15638. 17.4 <get descriptor statement>
  15639. Function
  15640. Get information from an SQL descriptor area.
  15641. Format
  15642. <get descriptor statement> ::=
  15643. GET DESCRIPTOR <descriptor name> <get descriptor information>
  15644. <get descriptor information> ::=
  15645. <get count>
  15646. | VALUE <item number>
  15647. <get item information> [ { <comma> <get item information> }... ]
  15648. <get count> ::=
  15649. <simple target specification 1> <equals operator> COUNT
  15650. <get item information> ::=
  15651. <simple target specification 2> <equals operator> <descriptor item name>>
  15652. <item number> ::= <simple value specification>
  15653. <simple target specification 1> ::= <simple target specification>
  15654. <simple target specification 2> ::= <simple target specification>
  15655. <descriptor item name> ::=
  15656. TYPE
  15657. | LENGTH
  15658. | OCTET_LENGTH
  15659. | RETURNED_LENGTH
  15660. | RETURNED_OCTET_LENGTH
  15661. | PRECISION
  15662. | SCALE
  15663. | DATETIME_INTERVAL_CODE
  15664. | DATETIME_INTERVAL_PRECISION
  15665. | NULLABLE
  15666. | INDICATOR
  15667. | DATA
  15668. | NAME
  15669. | UNNAMED
  15670. | COLLATION_CATALOG
  15671. | COLLATION_SCHEMA
  15672. | COLLATION_NAME
  15673. | CHARACTER_SET_CATALOG
  15674. | CHARACTER_SET_SCHEMA
  15675. | CHARACTER_SET_NAME
  15676. 434 Database Language SQL
  15677. X3H2-92-154/DBL CBR-002
  15678. 17.4 <get descriptor statement>
  15679. Syntax Rules
  15680. 1) The data type of <item number> shall be exact numeric with scale
  15681. 0.
  15682. 2) The data type of <simple target specification 1> shall be exact
  15683. numeric with scale 0.
  15684. 3) The data type of a <simple target specification 2> shall be the
  15685. data type shown in Table 17, "Data types of <key word>s used in
  15686. SQL item descriptor areas", for the corresponding <descriptor
  15687. item name>.
  15688. Access Rules
  15689. None.
  15690. General Rules
  15691. 1) If a <descriptor name> specified in a <get descriptor state-
  15692. ment> identifies an SQL descriptor area that is not currently
  15693. allocated, then an exception condition is raised: invalid SQL
  15694. descriptor name.
  15695. 2) If the data type of the <simple target specification> associated
  15696. with the keyword DATA does not match the data type specified by
  15697. the item descriptor area, then an exception condition is raised:
  15698. data exception-error in assignment.
  15699. Note: Match is defined in the Syntax Rules of Subclause 17.1,
  15700. "Description of SQL item descriptor areas".
  15701. 3) If the <item number> specified in a <get descriptor statement>
  15702. is greater than the number of <occurrences> specified when the
  15703. <descriptor name> was allocated or less than 1, then an excep-
  15704. tion condition is raised: dynamic SQL error-invalid descriptor
  15705. index.
  15706. 4) If the <item number> specified in a <get descriptor statement>
  15707. is greater than the value of COUNT, then a completion condition
  15708. is raised: no data.
  15709. 5) If a <get descriptor statement> is executed to get the value
  15710. of DATA without getting the value of INDICATOR and the value of
  15711. INDICATOR is negative, then an exception condition is raised:
  15712. data exception-null value, no indicator parameter.
  15713. 6) If an exception condition is raised in a <get descriptor state-
  15714. ment>, then the values of all targets specified by <simple tar-
  15715. get specification 1> and <simple target specification 2> are
  15716. implementation-dependent.
  15717. Dynamic SQL 435
  15718. X3H2-92-154/DBL CBR-002
  15719. 17.4 <get descriptor statement>
  15720. 7) A <get descriptor statement> gets values in the SQL descriptor
  15721. area specified by <descriptor name>. The values are as follows:
  15722. a) COUNT is a count of the number of <dynamic parameter specifi-
  15723. cation>s or <select list> columns described in item descrip-
  15724. tor areas.
  15725. b) The values of TYPE, LENGTH, OCTET_LENGTH, RETURNED_LENGTH,
  15726. RETURNED_OCTET_LENGTH, PRECISION, SCALE, DATETIME_INTERVAL_
  15727. CODE, DATETIME_INTERVAL_PRECISION, COLLATION_CATALOG,
  15728. COLLATION_SCHEMA, COLLATION_NAME, CHARACTER_SET_CATALOG,
  15729. CHARACTER_SET_SCHEMA, and CHARACTER_SET_NAME are the data
  15730. type, length (in characters, bits, or positions, as appro-
  15731. priate), length in octets, returned length in characters,
  15732. returned length in octets, precision, scale, datetime data
  15733. type, interval qualifier, collation, and character set of
  15734. a <dynamic parameter specification> or <select list> col-
  15735. umn described by the item descriptor area specified by <item
  15736. number>.
  15737. c) NAME is the name associated with the <dynamic parameter spec-
  15738. ification> or <select list> column described by the item de-
  15739. scriptor area specified by <item number>. For a <select list>
  15740. column, if the column name is implementation-dependent, then
  15741. NAME is the implementation-dependent name for the column and
  15742. UNNAMED is set to 1; otherwise, NAME is the <derived column
  15743. name> of the column and UNNAMED is set to 0. For a <dynamic
  15744. parameter specification>, the values of NAME and UNNAMED are
  15745. implementation-dependent.
  15746. d) DATA is a value for the <target specification> described by
  15747. the item descriptor area specified by <item number>. If the
  15748. value of INDICATOR is negative, then the value of DATA is
  15749. undefined.
  15750. e) INDICATOR is a value for the <indicator parameter> associated
  15751. with the <target specification>.
  15752. f) Case:
  15753. i) For a <select list> column, if NULLABLE is set to 1, then
  15754. the column can have the null value; otherwise, the column
  15755. cannot have the null value.
  15756. ii) For a <dynamic parameter specification>, NULLABLE is set
  15757. to 1, indicating that the <dynamic parameter specification>
  15758. can have the null value.
  15759. 436 Database Language SQL
  15760. X3H2-92-154/DBL CBR-002
  15761. 17.4 <get descriptor statement>
  15762. Leveling Rules
  15763. 1) The following restrictions apply for Intermediate SQL:
  15764. a) A <descriptor name> shall be a <literal>.
  15765. 2) The following restrictions apply for Entry SQL in addition to
  15766. any Intermediate SQL restrictions:
  15767. a) Conforming Entry SQL language shall not contain any Dynamic
  15768. SQL language.
  15769. Dynamic SQL 437
  15770. X3H2-92-154/DBL CBR-002
  15771. 17.5 <set descriptor statement>
  15772. 17.5 <set descriptor statement>
  15773. Function
  15774. Set information in an SQL descriptor area.
  15775. Format
  15776. <set descriptor statement> ::=
  15777. SET DESCRIPTOR <descriptor name> <set descriptor information>
  15778. <set descriptor information> ::=
  15779. <set count>
  15780. | VALUE <item number>
  15781. <set item information> [ { <comma> <set item information> }... ]
  15782. <set count> ::=
  15783. COUNT <equals operator> <simple value specification 1>
  15784. <set item information> ::=
  15785. <descriptor item name> <equals operator> <simple value specification 2>
  15786. <simple value specification 1> ::= <simple value specification>
  15787. <simple value specification 2> ::= <simple value specification>
  15788. <item number> ::= <simple value specification>
  15789. Syntax Rules
  15790. 1) The data type of <item number> shall be exact numeric with scale
  15791. 0.
  15792. 2) The data type of <simple value specification 1> shall be an
  15793. exact numeric with scale 0.
  15794. 3) The data type of a <simple value specification 2> shall be the
  15795. data type shown in Table 17, "Data types of <key word>s used in
  15796. SQL item descriptor areas", for the corresponding <descriptor
  15797. item name>. <descriptor item name> shall not be RETURNED_LENGTH,
  15798. RETURNED_OCTET_LENGTH, OCTET_LENGTH, NULLABLE, COLLATION_
  15799. CATALOG, COLLATION_SCHEMA, COLLATION_NAME, NAME, or UNNAMED.
  15800. Other alternatives for <descriptor item name> shall not be spec-
  15801. ified more than once in a <set descriptor statement>.
  15802. Access Rules
  15803. None.
  15804. 438 Database Language SQL
  15805. X3H2-92-154/DBL CBR-002
  15806. 17.5 <set descriptor statement>
  15807. General Rules
  15808. 1) If a <descriptor name> specified in a <set descriptor state-
  15809. ment> identifies an SQL descriptor area that is not currently
  15810. allocated, then an exception condition is raised: invalid SQL
  15811. descriptor name.
  15812. 2) If the <item number> specified in a <set descriptor statement>
  15813. is greater than the number of <occurrences> specified when the
  15814. <descriptor name> was allocated or less than 1, then an excep-
  15815. tion condition is raised: dynamic SQL error-invalid descriptor
  15816. index.
  15817. 3) A <set descriptor statement> sets values in the SQL descriptor
  15818. area specified by <descriptor name>. The values are as follows:
  15819. a) COUNT is a count of the number of <dynamic parameter specifi-
  15820. cation> values or <target specification>s described in item
  15821. descriptor areas.
  15822. b) TYPE, LENGTH, PRECISION, SCALE, DATETIME_INTERVAL_CODE,
  15823. DATETIME_INTERVAL_PRECISION, CHARACTER_SET_CATALOG, CHARACTER_
  15824. SET_SCHEMA, and CHARACTER_SET_NAME are a description of the
  15825. data type, length (in characters, bits, or positions, as ap-
  15826. propriate), precision, scale, datetime data type, interval
  15827. qualifier, and character set of a <dynamic parameter specifi-
  15828. cation> value or <target specification> described by the item
  15829. descriptor area specified by <item number>.
  15830. c) DATA is a value for the <dynamic parameter specification>
  15831. described by the item descriptor area specified by <item
  15832. number>. INDICATOR is a value for the <indicator parameter>
  15833. associated with the <dynamic parameter specification>.
  15834. 4) When more than one value is set in a single <set descriptor
  15835. statement>, the values are effectively assigned in the fol-
  15836. lowing order: TYPE, DATETIME_INTERVAL_CODE, DATETIME_INTERVAL_
  15837. PRECISION, PRECISION, SCALE, CHARACTER_SET_CATALOG, CHARACTER_
  15838. SET_SCHEMA, CHARACTER_SET_NAME, LENGTH, INDICATOR, and DATA.
  15839. When any value other than DATA is set, the value of DATA becomes
  15840. undefined.
  15841. 5) For every <set item information> specified, let DIN be the <de-
  15842. scriptor item name> and let V be the value of the <simple value
  15843. specification 2>. If DIN is DATA and the data type of V does
  15844. not match the data type specified by the item descriptor area,
  15845. then an exception condition is raised: data exception-error in
  15846. assignment.
  15847. Note: Match is defined in the Syntax Rules of Subclause 17.1,
  15848. "Description of SQL item descriptor areas".
  15849. The item descriptor area field DIN is set to V and then
  15850. Dynamic SQL 439
  15851. X3H2-92-154/DBL CBR-002
  15852. 17.5 <set descriptor statement>
  15853. Case:
  15854. a) If DIN is TYPE and V indicates CHARACTER or CHARACTER
  15855. VARYING, then CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA,
  15856. and CHARACTER_SET_NAME are set to the values for the de-
  15857. fault character set name for the SQL-session, LENGTH is set
  15858. to 1, and all other item descriptor area fields are set to
  15859. implementation-dependent values.
  15860. b) If DIN is TYPE and V indicates BIT or BIT VARYING, then
  15861. LENGTH is set to 1 and all other item descriptor area fields
  15862. are set to implementation-dependent values.
  15863. c) If DIN is TYPE and V indicates DATETIME, then PRECISION is
  15864. set to 0 and all other item descriptor area fields are set to
  15865. implementation-dependent values.
  15866. d) If DIN is TYPE and V indicates INTERVAL, then DATETIME_
  15867. INTERVAL_PRECISION is set to 2 and all other item descrip-
  15868. tor area fields are set to implementation-dependent values.
  15869. e) If DIN is TYPE and V indicates NUMERIC or DECIMAL, then SCALE
  15870. is set to 0, PRECISION is set to the implementation-defined
  15871. default value for the precision of NUMERIC or DECIMAL data
  15872. types, respectively, and all other item descriptor area
  15873. fields are set to implementation-dependent values.
  15874. f) If DIN is TYPE and V indicates INTEGER or SMALLINT, then all
  15875. other item descriptor area fields are set to implementation-
  15876. dependent values.
  15877. g) If DIN is TYPE and V indicates FLOAT, then PRECISION is set
  15878. to the implementation-defined default value for the precision
  15879. of FLOAT data types and all other item descriptor area fields
  15880. are set to implementation-dependent values.
  15881. h) If DIN is TYPE and V indicates REAL or DOUBLE PRECISION,
  15882. then all other item descriptor area fields are set to
  15883. implementation-dependent values.
  15884. i) If DIN is DATETIME_INTERVAL_CODE and TYPE is DATETIME, then
  15885. i) If V indicates DATE, TIME, or TIME WITH TIME ZONE, then
  15886. PRECISION is set to 0 and all other item descriptor area
  15887. fields are set to implementation-dependent values.
  15888. ii) If V indicates TIMESTAMP, or TIMESTAMP WITH TIME ZONE, then
  15889. PRECISION is set to 6 and all other item descriptor area
  15890. fields are set to implementation-dependent values.
  15891. 440 Database Language SQL
  15892. X3H2-92-154/DBL CBR-002
  15893. 17.5 <set descriptor statement>
  15894. j) If DIN is DATETIME_INTERVAL_CODE and TYPE is INTERVAL, then
  15895. DATETIME_INTERVAL_PRECISION is set to 2 and
  15896. i) If V indicates DAY TO SECOND, HOUR TO SECOND, MINUTE TO
  15897. SECOND, or SECOND, then PRECISION is set to 6.
  15898. ii) Otherwise, PRECISION is set to 0.
  15899. 6) If an exception condition is raised in a <set descriptor
  15900. statement>, then the values of all elements of the item de-
  15901. scriptor area specified in the <set descriptor statement> are
  15902. implementation-dependent.
  15903. 7) Restrictions on changing TYPE, LENGTH, PRECISION, DATETIME_
  15904. INTERVAL_CODE, DATETIME_INTERVAL_PRECISION, SCALE, CHARACTER_
  15905. SET_CATALOG, CHARACTER_SET_SCHEMA, and CHARACTER_SET_NAME values
  15906. resulting from the execution of a <describe statement> before
  15907. execution of a <execute statement>, <dynamic open statement>,
  15908. or <dynamic fetch statement> are implementation-defined, except
  15909. as specified in the General Rules of Subclause 17.9, "<using
  15910. clause>".
  15911. Leveling Rules
  15912. 1) The following restrictions apply for Intermediate SQL:
  15913. a) A <descriptor name> shall be a <literal>.
  15914. 2) The following restrictions apply for Entry SQL in addition to
  15915. any Intermediate SQL restrictions:
  15916. a) Conforming Entry SQL language shall not contain any Dynamic
  15917. SQL language.
  15918. Dynamic SQL 441
  15919. X3H2-92-154/DBL CBR-002
  15920. 17.6 <prepare statement>
  15921. 17.6 <prepare statement>
  15922. Function
  15923. Prepare a statement for execution.
  15924. Format
  15925. <prepare statement> ::=
  15926. PREPARE <SQL statement name> FROM <SQL statement variable>
  15927. <SQL statement variable> ::= <simple value specification>
  15928. <preparable statement> ::=
  15929. <preparable SQL data statement>
  15930. | <preparable SQL schema statement>
  15931. | <preparable SQL transaction statement>
  15932. | <preparable SQL session statement>
  15933. | <preparable implementation-defined statement>
  15934. <preparable SQL data statement> ::=
  15935. <delete statement: searched>
  15936. | <dynamic single row select statement>
  15937. | <insert statement>
  15938. | <dynamic select statement>
  15939. | <update statement: searched>
  15940. | <preparable dynamic delete statement: positioned>
  15941. | <preparable dynamic update statement: positioned>
  15942. <preparable SQL schema statement> ::=
  15943. <SQL schema statement>
  15944. <preparable SQL transaction statement> ::=
  15945. <SQL transaction statement>
  15946. <preparable SQL session statement> ::=
  15947. <SQL session statement>
  15948. <dynamic select statement> ::= <cursor specification>
  15949. <dynamic single row select statement> ::= <query specification>
  15950. <preparable implementation-defined statement> ::= !! See the Syntax
  15951. Rules.
  15952. 442 Database Language SQL
  15953. X3H2-92-154/DBL CBR-002
  15954. 17.6 <prepare statement>
  15955. Syntax Rules
  15956. 1) The <simple value specification> of <SQL statement variable>
  15957. shall not be a <literal>.
  15958. 2) The data type of <SQL statement variable> shall be character
  15959. string.
  15960. 3) The Format and Syntax Rules for <preparable implementation-
  15961. defined statement> are implementation-defined.
  15962. Access Rules
  15963. None.
  15964. General Rules
  15965. 1) Let P be the contents of the <SQL statement variable>.
  15966. 2) If P is a <preparable dynamic delete statement: positioned> or a
  15967. <preparable dynamic update statement: positioned>, then P refers
  15968. to either a dynamic cursor with the same <cursor name> or to an
  15969. extended dynamic cursor whose <extended cursor name> value is
  15970. the same as the <cursor name>.
  15971. Case:
  15972. a) If both an extended dynamic cursor and a dynamic cursor with
  15973. the same name as the <cursor name> exist, then an exception
  15974. condition is raised: ambiguous cursor name.
  15975. b) If there is neither an extended dynamic cursor nor a dynamic
  15976. cursor with the name of <cursor name>, then an exception
  15977. condition is raised: invalid cursor name.
  15978. 3) Let E1, E2, E3, and E4 be <value expression>s of the form "<dy-
  15979. namic parameter specification>" or a <dynamic parameter specifi-
  15980. cation> enclosed in any number of matching parentheses. Let F be
  15981. a <value expression> whose data type is determined via General
  15982. Rules in Clause 6, "Scalar expressions" and the Rules in this
  15983. Subclause. Let X1, X2, X3, and X4 be <value expression>s meeting
  15984. the criteria for either En or F.
  15985. 4) If one or more of the following are true, then an exception
  15986. condition is raised: syntax error or access rule violation in
  15987. dynamic SQL statement.
  15988. a) P does not conform to the Format, Syntax Rules, and Access
  15989. Rules of a <preparable statement>.
  15990. b) P contains E1 as a <value expression> simply contained in a
  15991. <select list>.
  15992. c) P contains E1 as both operands of a single dyadic operator.
  15993. Dynamic SQL 443
  15994. X3H2-92-154/DBL CBR-002
  15995. 17.6 <prepare statement>
  15996. d) P contains a <value expression> of the form "+ E1", "- E1",
  15997. "E1 COLLATE <collation name>", or "EXTRACT (<extract field>
  15998. FROM E1)".
  15999. e) P contains a <set function specification> with argument E1.
  16000. f) P contains a <null predicate> with a value E1 in the <row
  16001. value constructor>.
  16002. g) P contains an <overlaps predicate> where E1 is the <value
  16003. expression> that is the second <row value constructor ele-
  16004. ment> in either the first or second operands of the <overlaps
  16005. predicate>.
  16006. h) P contains E1 as the first operand of COALESCE or the first
  16007. <when operand> in a <case specification> or both operands of
  16008. NULLIF.
  16009. i) P contains a <comparison predicate> or <between predicate>
  16010. where E1 is both the i-th <value expression> in the <row
  16011. value constructor> that is the first operand and the i-th
  16012. <value expression> in the <row value constructor> that is the
  16013. second operand of the <comparison predicate> or the second or
  16014. third operand of the <between predicate>.
  16015. j) P contains a <table value constructor> in which the i-th
  16016. <value expression> in each <row value constructor> is E1 and
  16017. either:
  16018. i) P is not an <insert statement>, or
  16019. ii) P is an <insert statement> and the <table value construc-
  16020. tor> is not the <query expression> simply contained in the
  16021. <insert statement>.
  16022. k) P contains an <in predicate> with an <in value list> in which
  16023. E1 is both the <row value constructor> and the first <value
  16024. specification> of the <in value list>.
  16025. l) P contains a <position expression> in which both immediately
  16026. contained <character value expression>s are E1.
  16027. m) P contains a <form-of-use conversion> or a <character trans-
  16028. lation> whose immediately contained <character value expres-
  16029. sion> is E1.
  16030. n) P contains a <fold> whose operand is E1.
  16031. o) P contains a <trim function> whose <trim character> or <trim
  16032. source> is E1.
  16033. p) P contains a <character substring function> whose <character
  16034. value expression> is E1.
  16035. q) P contains a <comment>.
  16036. 444 Database Language SQL
  16037. X3H2-92-154/DBL CBR-002
  16038. 17.6 <prepare statement>
  16039. 5) Case:
  16040. a) If E1 is followed by an <interval qualifier> IQ, then the
  16041. data type of E1 is assumed to be INTERVAL IQ.
  16042. b) In OCTET_LENGTH(E1), CHARACTER_LENGTH(E1), and CHARACTER_
  16043. LENGTH(E1), the data type of E1 is assumed to be CHARACTER
  16044. VARYING(L), where L is the implementation-defined maximum
  16045. value of <length> for CHARACTER VARYING.
  16046. c) In POSITION(X1 IN X2), and SUBSTRING(X1 FROM X3 FOR X4), if
  16047. X1 (X2) meets the criteria for E1, E2, E3, and E4, then the
  16048. data type of X1 (X2) is assumed to be CHARACTER VARYING(L),
  16049. where L is the implementation-defined maximum value of
  16050. <length> for CHARACTER VARYING. If X3 (X4) meets the cri-
  16051. teria for E1, E2, E3, and E4, then the data type of X3 (X4)
  16052. is assumed to be NUMERIC(P,0), where P is the implementation-
  16053. defined maximum value of <precision> for NUMERIC.
  16054. d) In a <value expression> of the form "X1 <concatenation oper-
  16055. ator> X2", if X1 (X2) meets the criteria for E1, E2, E3, and
  16056. E4, then the data type of X1 (X2) is assumed to be CHARACTER
  16057. VARYING(L), where L is the implementation-defined maximum
  16058. value of <length> for CHARACTER VARYING.
  16059. e) In BIT_LENGTH(E1), the data type of E1 is assumed to be BIT
  16060. VARYING(L), where L is the implementation-defined maximum
  16061. value of <length> for BIT VARYING.
  16062. f) In a <value expression> of the form "E1 + <datetime term>",
  16063. "<datetime term> + E1" or "<datetime term> - E1", the data
  16064. type of E1 is assumed to be
  16065. Case:
  16066. i) If the <datetime term> is a date data type, then the data
  16067. type of E1 is assumed to be INTERVAL YEAR(P) TO MONTH,
  16068. where P is the implementation-defined maximum <interval
  16069. leading field precision>.
  16070. ii) Otherwise, the data type of E1 is assumed to be INTERVAL
  16071. DAY(P) TO SECOND(F), where P and F are the implementation-
  16072. defined maximum <interval leading field precision> and max-
  16073. imum <interval fractional seconds precision>, respectively.
  16074. g) In a <value expression> of the form "<interval term> * E1" or
  16075. "<interval term> / E1", the data type of E1 is assumed to be
  16076. NUMERIC(P,0), where P is the implementation-defined maximum
  16077. value of <precision> for NUMERIC.
  16078. h) In all other <value expression>s of the form "E1+ F", "E1-
  16079. F", "E1* F", "E1/ F", "F + E1", "F - E1", "F * E1", or "F /
  16080. E1", the data type of E1 is assumed to be the data type of F.
  16081. Dynamic SQL 445
  16082. X3H2-92-154/DBL CBR-002
  16083. 17.6 <prepare statement>
  16084. i) In a <value expression> of the form "CAST (E1 AS <domain
  16085. name>)", "CAST (E1 AS <data type>)", the data type of E1 is
  16086. the <data type> of the specified domain or the explicitly-
  16087. specified <data type>.
  16088. j) If one or more operands of COALESCE are E1, then the data
  16089. type of E1 is assumed to be the data type of the first
  16090. operand.
  16091. k) If one or more <when operand>s in a <case specification> are
  16092. E1, then the data type of E1 is assumed to be the data type
  16093. of the first <when operand>.
  16094. l) If one operand of NULLIF is E1, then the data type of E1 is
  16095. assumed to be the data type of the other operand.
  16096. m) In the first and second operands of a <comparison predicate>
  16097. or <between predicate>, or the first and third operands of a
  16098. <between predicate>, if the i-th value of one operand is E1,
  16099. then the data type of E1 is the data type of the i-th value
  16100. of the other operand.
  16101. n) In the first and second operands of an <overlaps predicate>,
  16102. if either of the first <row value constructor element>s is
  16103. E1, then the data type of E1 is the data type of the first
  16104. <row value constructor element> of the other operand. If both
  16105. of the first <row value constructor element>s are E1, then
  16106. the data type of each E1 is assumed to be TIMESTAMP WITH TIME
  16107. ZONE.
  16108. o) In a <table value constructor> in which the i-th <value ex-
  16109. pression> of some <row value constructor> is E1 that contains
  16110. a <row value constructor> whose i-th <value expression> is
  16111. not E1, the data type of E1 is the data type of the i-th
  16112. <value expression> of the first <row value constructor> whose
  16113. i-th <value expression> is not E1.
  16114. p) In a <table value constructor> in which the i-th <value ex-
  16115. pression> in each <row value constructor> is E1 that is the
  16116. <query expression> simply contained in an <insert statement>,
  16117. the data type of E1 is the data type of the corresponding
  16118. column of the implicit or explicit <insert column list> con-
  16119. tained in the <insert statement>.
  16120. q) In an <in predicate> that specifies a <table subquery>, the
  16121. data types of <value expression>s E1 in the <row value con-
  16122. structor> are assumed to be the same as the data types of the
  16123. respective columns of the <table subquery>.
  16124. r) In an <in predicate> that specifies an <in value list>, if
  16125. the <row value constructor> is not E1, then let D be its data
  16126. type. Otherwise, let D be the data type of the first <value
  16127. specification> of the <in value list>. The data type of any
  16128. E1 in the <in predicate> is assumed to be D.
  16129. 446 Database Language SQL
  16130. X3H2-92-154/DBL CBR-002
  16131. 17.6 <prepare statement>
  16132. s) If E1 appears for <match value>, <pattern>, or <escape
  16133. character> in <like predicate>, then the data type of
  16134. E1 is assumed to be CHARACTER VARYING(L), where L is
  16135. the implementation-defined maximum value of <length> for
  16136. CHARACTER VARYING.
  16137. t) If any value in the <row value constructor> of a <quantified
  16138. comparison predicate> or <match predicate> is E1, then the
  16139. data type of E1 is assumed to be the same as the data type of
  16140. the respective column of the <table subquery>.
  16141. u) If <value specification> in <set catalog statement>, <set
  16142. schema statement>, <set names statement>, or <set session
  16143. authorization identifier statement> is E1, then the data
  16144. type of E1 is assumed to be CHARACTER VARYING(L), where L
  16145. is the implementation-defined maximum value of <length> for
  16146. CHARACTER VARYING.
  16147. v) If <simple value specification> in <set local time zone
  16148. statement> is E1, then the data type of E1 is assumed to be
  16149. CHARACTER VARYING(L), where L is the implementation-defined
  16150. maximum value of <length> for CHARACTER VARYING.
  16151. w) If a <value expression> in a <set clause> is E1, then the
  16152. data type of E1 is assumed to be the same data type as the
  16153. corresponding <object column>.
  16154. 6) If the value of the <SQL statement name> identifies an existing
  16155. prepared statement, then an implicit
  16156. DEALLOCATE PREPARE SSN
  16157. is executed, where SSN is the value of the <SQL statement name>.
  16158. 7) P is prepared for execution.
  16159. 8) If <extended statement name> is specified for the <SQL statement
  16160. name>, then let S be the character string that is the value of
  16161. the <simple target specification> and let V be the character
  16162. string that is the result of
  16163. TRIM ( BOTH ' ' FROM S )
  16164. If V does not conform to the Format and Syntax Rules of an
  16165. <identifier>, then an exception condition is raised: invalid
  16166. SQL statement identifier.
  16167. 9) Case:
  16168. a) If <extended statement name> is specified for the <SQL state-
  16169. ment name>, then the value of the <extended statement name>
  16170. is associated with the prepared statement. This value and ex-
  16171. plicit or implied <scope option> shall be specified for each
  16172. <execute statement> or <allocate cursor statement> that is to
  16173. be associated with this prepared statement.
  16174. Dynamic SQL 447
  16175. X3H2-92-154/DBL CBR-002
  16176. 17.6 <prepare statement>
  16177. b) If <statement name> is specified for the <SQL statement
  16178. name>, then:
  16179. i) If P is a <cursor specification> and <statement name> is
  16180. associated with a cursor C through a <dynamic declare cur-
  16181. sor>, then an association is made between C and P. The
  16182. association is preserved until the prepared statement is
  16183. destroyed.
  16184. ii) If P is not a <cursor specification> and <statement name>
  16185. is associated with a cursor C through a <dynamic declare
  16186. cursor>, then an exception condition is raised: dynamic SQL
  16187. error- prepared statement is not a cursor specification.
  16188. iii) Otherwise, the same <statement name> shall be specified for
  16189. each <execute statement> that is to be associated with this
  16190. prepared statement.
  16191. 10)The validity of an <extended statement name> value or a <state-
  16192. ment name> in an SQL-transaction different from the one in which
  16193. the statement was prepared is implementation-dependent.
  16194. Leveling Rules
  16195. 1) The following restrictions apply for Intermediate SQL:
  16196. None.
  16197. 2) The following restrictions apply for Entry SQL in addition to
  16198. any Intermediate SQL restrictions:
  16199. a) Conforming Entry SQL language shall not contain any Dynamic
  16200. SQL language.
  16201. 448 Database Language SQL
  16202. X3H2-92-154/DBL CBR-002
  16203. 17.7 <deallocate prepared statement>
  16204. 17.7 <deallocate prepared statement>
  16205. Function
  16206. Deallocate SQL-statements that have been prepared with a <prepare
  16207. statement>.
  16208. Format
  16209. <deallocate prepared statement> ::=
  16210. DEALLOCATE PREPARE <SQL statement name>
  16211. Syntax Rules
  16212. 1) If <SQL statement name> is a <statement name>, then the <module>
  16213. that contains the <deallocate prepared statement> shall also
  16214. contain a <prepare statement> that specifies the same <statement
  16215. name>.
  16216. Access Rules
  16217. None.
  16218. General Rules
  16219. 1) If the <SQL statement name> does not identify a statement pre-
  16220. pared in the scope of the <SQL statement name>, then an excep-
  16221. tion condition is raised: invalid SQL statement name.
  16222. 2) If the value of <SQL statement name> identifies an existing
  16223. prepared statement that is the <cursor specification> of an open
  16224. cursor, then an exception condition is raised: invalid cursor
  16225. state.
  16226. 3) The prepared statement identified by the <SQL statement name>
  16227. is destroyed. Any cursor that was allocated with an <allocate
  16228. cursor statement> that is associated with the prepared state-
  16229. ment identified by the <SQL statement name> is destroyed. If
  16230. the value of the <SQL statement name> identifies an existing
  16231. prepared statement that is a <cursor specification>, then any
  16232. prepared statements that reference that cursor are destroyed.
  16233. Leveling Rules
  16234. 1) The following restrictions apply for Intermediate SQL:
  16235. a) Conforming Intermediate SQL language shall contain no <deal-
  16236. locate prepared statement>.
  16237. 2) The following restrictions apply for Entry SQL in addition to
  16238. Intermediate SQL restrictions:
  16239. None.
  16240. Dynamic SQL 449
  16241. X3H2-92-154/DBL CBR-002
  16242. 17.8 <describe statement>
  16243. 17.8 <describe statement>
  16244. Function
  16245. Obtain information about the <select list> columns or <dynamic
  16246. parameter specification>s contained in a prepared statement.
  16247. Format
  16248. <describe statement> ::=
  16249. <describe input statement>
  16250. | <describe output statement>
  16251. <describe input statement> ::=
  16252. DESCRIBE INPUT <SQL statement name> <using descriptor>
  16253. <describe output statement> ::=
  16254. DESCRIBE [ OUTPUT ] <SQL statement name> <using descriptor>
  16255. Syntax Rules
  16256. 1) If <SQL statement name> is a <statement name>, then the contain-
  16257. ing <module> shall contain a <prepare statement> whose <state-
  16258. ment name> is the same as the <statement name> of the <describe
  16259. statement>.
  16260. Access Rules
  16261. None.
  16262. General Rules
  16263. 1) When the <describe statement> is executed, if the value of the
  16264. <SQL statement name> does not identify a statement prepared
  16265. in the scope of the <SQL statement name>, then an exception
  16266. condition is raised: invalid SQL statement name.
  16267. 2) The descriptor area is set with information as described in
  16268. Subclause 17.9, "<using clause>".
  16269. Leveling Rules
  16270. 1) The following restrictions apply for Intermediate SQL:
  16271. a) Conforming Intermediate SQL language shall not contain any
  16272. <describe input statement>.
  16273. 2) The following restrictions apply for Entry SQL in addition to
  16274. any Intermediate SQL restrictions:
  16275. a) Conforming Entry SQL language shall not contain any Dynamic
  16276. SQL language.
  16277. 450 Database Language SQL
  16278. X3H2-92-154/DBL CBR-002
  16279. 17.9 <using clause>
  16280. 17.9 <using clause>
  16281. Function
  16282. Describe the input/output variables for an <SQL dynamic statement>.
  16283. Format
  16284. <using clause> ::=
  16285. <using arguments>
  16286. | <using descriptor>
  16287. <using arguments> ::=
  16288. { USING | INTO } <argument> [ { <comma> <argument> }... ]
  16289. <argument> ::= <target specification>
  16290. <using descriptor> ::=
  16291. { USING | INTO } SQL DESCRIPTOR <descriptor name>
  16292. Syntax Rules
  16293. 1) The keyword INTO shall appear in <using clause> only if the
  16294. <using clause> is contained in a <dynamic fetch statement> or a
  16295. <result using clause>.
  16296. Access Rules
  16297. None.
  16298. General Rules
  16299. 1) The <identifier>s used to reference components of SQL descriptor
  16300. areas are as shown in Table 17, "Data types of <key word>s used
  16301. in SQL item descriptor areas".
  16302. 2) If a <descriptor name> is specified in a <using clause>, then an
  16303. SQL system descriptor area shall have been allocated and not yet
  16304. deallocated whose name is the value of the <descriptor name>'s
  16305. <simple value specification> and whose scope is that specified
  16306. by the <scope option>. Otherwise, an exception condition is
  16307. raised: invalid SQL descriptor name.
  16308. 3) When a <describe output statement> is executed, a representation
  16309. of the column descriptors of the <select list> columns for the
  16310. prepared statement is stored in the specified SQL descriptor
  16311. area as follows:
  16312. a) Let N be the <occurrences> specified when the <descriptor
  16313. name> was allocated.
  16314. Dynamic SQL 451
  16315. X3H2-92-154/DBL CBR-002
  16316. 17.9 <using clause>
  16317. b) If the prepared statement that is being described is a <dy-
  16318. namic select statement> or a <dynamic single row select
  16319. statement>, then let T be the table defined by the prepared
  16320. statement and let D be the degree of T. Otherwise, let D be
  16321. 0.
  16322. c) COUNT is set to D.
  16323. d) If D is greater than N, then a completion condition is
  16324. raised: warning-insufficient item descriptor areas.
  16325. e) If D is 0 or D is greater than N, then no item descriptor
  16326. areas are set. Otherwise, the first D item descriptor areas
  16327. are set so that the i-th item descriptor area contains the
  16328. descriptor of the i-th column of T. The descriptor of a col-
  16329. umn consists of values for TYPE, NULLABLE, NAME, UNNAMED, and
  16330. other fields depending on the value of TYPE as described be-
  16331. low. The DATA and INDICATOR fields are not relevant in this
  16332. case. Those fields and fields that are not applicable for a
  16333. particular value of TYPE are set to implementation-dependent
  16334. values.
  16335. i) TYPE is set to a code, as shown in Table 18, "Codes used
  16336. for SQL data types in Dynamic SQL", indicating the data
  16337. type of the column.
  16338. ii) NULLABLE is set to 1 if the resulting column is possibly
  16339. nullable and 0 otherwise.
  16340. iii) If the column name is implementation-dependent, then NAME
  16341. is set to the implementation-dependent name of the column,
  16342. and UNNAMED is set to 1. Otherwise, NAME is set to the
  16343. <derived column> name for the column and UNNAMED is set to
  16344. 0.
  16345. iv) Case:
  16346. 1) If TYPE indicates a <character string type>, then:
  16347. LENGTH is set to the length or maximum length in char-
  16348. acters of the character string; OCTET_LENGTH is set to
  16349. the maximum possible length in octets of the character
  16350. string; CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA and
  16351. CHARACTER_SET_NAME are set to the <character set name>
  16352. of the character string's character set; and COLLATION_
  16353. CATALOG, COLLATION_SCHEMA and COLLATION_NAME are set to
  16354. the <collation name> of the character string's colla-
  16355. tion. If the subject <language clause> specifies C, then
  16356. the lengths specified in LENGTH and OCTET_LENGTH do not
  16357. include the implementation-defined null character that
  16358. terminates a C character string.
  16359. 452 Database Language SQL
  16360. X3H2-92-154/DBL CBR-002
  16361. 17.9 <using clause>
  16362. 2) If TYPE indicates a <bit string type>, then LENGTH is
  16363. set to the length or maximum length in bits of the bit
  16364. string and OCTET_LENGTH is set to the maximum possible
  16365. length in octets of the bit string.
  16366. 3) If TYPE indicates an <exact numeric type>, then
  16367. PRECISION and SCALE are set to the precision and scale
  16368. of the exact numeric.
  16369. 4) If TYPE indicates an <approximate numeric type>, then
  16370. PRECISION is set to the precision of the approximate
  16371. numeric.
  16372. 5) If TYPE indicates a <datetime type>, then LENGTH is
  16373. set to the length in positions of the datetime type,
  16374. DATETIME_INTERVAL_CODE is set to a code as specified
  16375. in Table 19, "Codes associated with datetime data types
  16376. in Dynamic SQL", to indicate the specific datetime data
  16377. type, and PRECISION is set to the <time precision> or
  16378. <timestamp precision>, if either is applicable.
  16379. 6) If TYPE indicates an <interval type>, then DATETIME_
  16380. INTERVAL_CODE is set to a code as specified in Table 20,
  16381. "Codes used for <interval qualifier>s in Dynamic SQL",
  16382. to indicate the <interval qualifier> of the interval
  16383. data type, DATETIME_INTERVAL_PRECISION is set to the
  16384. <interval leading field precision>, and PRECISION is
  16385. set to the <interval fractional seconds precision>, if
  16386. applicable.
  16387. 4) When a <describe input statement> is executed, a descriptor
  16388. for the <dynamic parameter specification>s for the prepared
  16389. statement is stored in the specified SQL descriptor area as
  16390. follows:
  16391. a) Let N be the <occurrences> specified when the <descriptor
  16392. name> was allocated.
  16393. b) Let D be the number of <dynamic parameter specification>s in
  16394. the prepared statement.
  16395. c) COUNT is set to D.
  16396. d) If D is greater than N, then a completion condition is
  16397. raised: warning-insufficient item descriptor areas.
  16398. e) If D is 0 or D is greater than N, then no item descriptor
  16399. areas are set. Otherwise, the first D item descriptor areas
  16400. are set so that the i-th item descriptor area contains a
  16401. descriptor of the i-th <dynamic parameter specification>. The
  16402. descriptor of a <dynamic parameter specification> consists
  16403. of values for TYPE, NULLABLE, NAME, UNNAMED, and other fields
  16404. depending on the value of TYPE as described below. The DATA
  16405. and INDICATOR fields are not relevant in this case. Those
  16406. Dynamic SQL 453
  16407. X3H2-92-154/DBL CBR-002
  16408. 17.9 <using clause>
  16409. fields and fields that are not applicable for a particular
  16410. value of TYPE are set to implementation-dependent values.
  16411. i) TYPE is set to a code, as shown in Table 18, "Codes used
  16412. for SQL data types in Dynamic SQL", indicating the data
  16413. type of the <dynamic parameter specification>.
  16414. ii) NULLABLE is set to 1.
  16415. Note: This indicates that the <dynamic parameter specifica-
  16416. tion> can have the null value.
  16417. iii) UNNAMED is set to 1 and NAME is set to an implementation-
  16418. dependent value.
  16419. iv) Case:
  16420. 1) If TYPE indicates a <character string type>, then:
  16421. LENGTH is set to the length or maximum length in char-
  16422. acters of the character string; OCTET_LENGTH is set to
  16423. the maximum possible length in octets of the character
  16424. string; CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA and
  16425. CHARACTER_SET_NAME are set to the <character set name>
  16426. of the character string's character set; and COLLATION_
  16427. CATALOG, COLLATION_SCHEMA and COLLATION_NAME are set to
  16428. the <collation name> of the character string's colla-
  16429. tion. If the subject <language clause> specifies C, then
  16430. the lengths specified in LENGTH and OCTET_LENGTH do not
  16431. include the implementation-defined null character that
  16432. terminates a C character string.
  16433. 2) If TYPE indicates a <bit string type>, then LENGTH is
  16434. set to the length or maximum length in bits of the bit
  16435. string and OCTET_LENGTH is set to the maximum possible
  16436. length in octets of the bit string.
  16437. 3) If TYPE indicates an <exact numeric type>, then
  16438. PRECISION and SCALE are set to the precision and scale
  16439. of the exact numeric.
  16440. 4) If TYPE indicates an <approximate numeric type>, then
  16441. PRECISION is set to the precision of the approximate
  16442. numeric.
  16443. 5) If TYPE indicates a <datetime type>, then LENGTH is
  16444. set to the length in positions of the datetime type,
  16445. DATETIME_INTERVAL_CODE is set to a code as specified
  16446. in Table 19, "Codes associated with datetime data types
  16447. in Dynamic SQL", to indicate the specific datetime data
  16448. type and PRECISION is set to the <time precision> or
  16449. <timestamp precision>, if either is applicable.
  16450. 454 Database Language SQL
  16451. X3H2-92-154/DBL CBR-002
  16452. 17.9 <using clause>
  16453. 6) If TYPE indicates an <interval type>, then DATETIME_
  16454. INTERVAL_CODE is set to a code as specified in Table 20,
  16455. "Codes used for <interval qualifier>s in Dynamic SQL",
  16456. to indicate the <interval qualifier> of the interval
  16457. data type, DATETIME_INTERVAL_PRECISION is set to the
  16458. <interval leading field precision> and PRECISION is
  16459. set to the <interval fractional seconds precision>, if
  16460. applicable.
  16461. 5) When a <using clause> is used in a <dynamic open statement>
  16462. or as the <parameter using clause> in an <execute statement>,
  16463. the <using clause> describes the <dynamic parameter specifica-
  16464. tion> values for the <dynamic open statement> or the <execute
  16465. statement>, respectively. Let PS be the prepared <dynamic se-
  16466. lect statement> referenced by the <dynamic open statement> or
  16467. the prepared statement referenced by the <execute statement>,
  16468. respectively.
  16469. Let D be the number of <dynamic parameter specification>s in
  16470. PS.
  16471. a) If <using arguments> is specified and the number of <ar-
  16472. gument>s is not D, then an exception condition is raised:
  16473. dynamic SQL error- using clause does not match dynamic param-
  16474. eter specifications.
  16475. b) If <using descriptor> is specified, then:
  16476. i) If the value of COUNT is greater than the number of <oc-
  16477. currences> specified when the <descriptor name> was allo-
  16478. cated or is less than zero, then an exception condition is
  16479. raised: dynamic SQL error-invalid descriptor count.
  16480. ii) If the value of COUNT is not D, then an exception condition
  16481. is raised: dynamic SQL error- using clause does not match
  16482. dynamic parameter specifications.
  16483. iii) If the first D item descriptor areas are not valid as spec-
  16484. ified in Subclause 17.1, "Description of SQL item descrip-
  16485. tor areas", then an exception condition is raised: dynamic
  16486. SQL error- using clause does not match dynamic parameter
  16487. specifications.
  16488. iv) If the value of INDICATOR is not negative, and the value
  16489. of DATA is not a valid value of the data type indicated
  16490. by TYPE, then an exception condition is raised: dynamic
  16491. SQL error- using clause does not match dynamic parameter
  16492. specifications.
  16493. c) Let TDT be the effective data type of the i-th <dynamic pa-
  16494. rameter specification>, defined to be the type represented
  16495. by the values of TYPE, LENGTH, PRECISION, SCALE, DATETIME_
  16496. INTERVAL_CODE, DATETIME_INTERVAL_PRECISION, CHARACTER_SET_
  16497. CATALOG, CHARACTER_SET_SCHEMA, and CHARACTER_SET_NAME that
  16498. Dynamic SQL 455
  16499. X3H2-92-154/DBL CBR-002
  16500. 17.9 <using clause>
  16501. would be set by a <describe input statement> to reflect the
  16502. descriptor of the i-th dynamic parameter of PS.
  16503. Note: See the General Rules of Subclause 17.8, "<describe
  16504. statement>".
  16505. d) Case:
  16506. i) If <using descriptor> is specified, then let SDT be the
  16507. effective data type of the i-th <dynamic parameter spec-
  16508. ification> value as represented by the values of TYPE,
  16509. LENGTH, PRECISION, SCALE, DATETIME_INTERVAL_CODE, DATETIME_
  16510. INTERVAL_PRECISION, CHARACTER_SET_CATALOG, CHARACTER_SET_
  16511. SCHEMA, and CHARACTER_SET_NAME in the i-th item descriptor
  16512. area. If the INDICATOR value of the i-th item descriptor
  16513. area is not negative, then let SV be the value represented
  16514. by the value of DATA with data type SDT. Otherwise, let SV
  16515. be the null value.
  16516. ii) If <using arguments> is specified, then let SDT and SV be
  16517. the data type and value, respectively, of the i-th <argu-
  16518. ment>.
  16519. e) If the <cast specification>
  16520. CAST ( SV AS TDT )
  16521. violates the Syntax Rules of Subclause 6.10, "<cast specifi-
  16522. cation>", then an exception condition is raised: dynamic SQL
  16523. error-restricted data type attribute violation.
  16524. f) If the <cast specification>
  16525. CAST (SV AS TDT )
  16526. violates the General Rules of Subclause 6.10, "<cast specifi-
  16527. cation>", then an exception condition is raised in accordance
  16528. with the General Rules of Subclause 6.10, "<cast specifica-
  16529. tion>".
  16530. g) The <cast specification>
  16531. CAST ( SV AS TDT )
  16532. is effectively performed and is the value of the i-th dynamic
  16533. parameter.
  16534. 6) When a <using clause> is used in a <dynamic fetch statement>
  16535. or as the <result using clause> of an <execute statement>, it
  16536. describes the <target specification>s for the <dynamic fetch
  16537. statement> or <execute statement>, respectively. Let PS be the
  16538. prepared <dynamic select statement> referenced by the <dynamic
  16539. fetch statement> or the prepared <dynamic single row select
  16540. statement> referenced by the <execute statement>, respectively.
  16541. 456 Database Language SQL
  16542. X3H2-92-154/DBL CBR-002
  16543. 17.9 <using clause>
  16544. Let D be the degree of the table specified by PS.
  16545. a) If <using arguments> is specified and the number of <ar-
  16546. gument>s is not D, then an exception condition is raised:
  16547. dynamic SQL error- using clause does not match target speci-
  16548. fications.
  16549. b) If <using descriptor> is specified, then:
  16550. i) If the value of COUNT is greater than the number of <occur-
  16551. rences> specified when the <descriptor name> was allocated
  16552. or less than zero, then an exception condition is raised:
  16553. dynamic SQL error-invalid descriptor count.
  16554. ii) If COUNT is not equal to D, then an exception condition
  16555. is raised: dynamic SQL error- using clause does not match
  16556. target specifications.
  16557. iii) If the first D item descriptor areas are not valid as spec-
  16558. ified in Subclause 17.1, "Description of SQL item descrip-
  16559. tor areas", then an exception condition is raised: dynamic
  16560. SQL error- using clause does not match target specifica-
  16561. tions.
  16562. 7) When a <using clause> is used in a <dynamic fetch statement>
  16563. or as the <result using clause> of an <execute statement>, the
  16564. result is a set of <target specification> values corresponding
  16565. to the <select list> columns for the retrieved row. If <using
  16566. descriptor> is specified, then the SQL descriptor area is set.
  16567. The value of the i-th <target specification> is represented in
  16568. the i-th item descriptor area as follows:
  16569. a) Let SDT be the effective data type of the i-th <select list>
  16570. column, defined to be the type represented by the values of
  16571. TYPE, LENGTH, PRECISION, SCALE, DATETIME_INTERVAL_PRECISION,
  16572. DATETIME_INTERVAL_CODE, CHARACTER_SET_CATALOG, CHARACTER_
  16573. SET_SCHEMA, and CHARACTER_SET_NAME that would be set by a
  16574. <describe output statement> to reflect the description of the
  16575. i-th <select list> column. Let SV be the value of the <select
  16576. list> column, with data type SDT.
  16577. Note: See the General Rules of Subclause 17.8, "<describe
  16578. statement>".
  16579. b) Let TDT be the effective data type of the i-th <target spec-
  16580. ification> as represented by the values of TYPE, LENGTH,
  16581. PRECISION, SCALE, DATETIME_INTERVAL_CODE, DATETIME_INTERVAL_
  16582. PRECISION, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and
  16583. CHARACTER_SET_NAME, in the i-th item descriptor area.
  16584. c) If the <cast specification>
  16585. CAST ( SV AS TDT )
  16586. Dynamic SQL 457
  16587. X3H2-92-154/DBL CBR-002
  16588. 17.9 <using clause>
  16589. violates the Syntax Rules of Subclause 6.10, "<cast specifi-
  16590. cation>", then an exception condition is raised: dynamic SQL
  16591. error- restricted data type attribute violation.
  16592. d) If the <cast specification>
  16593. CAST ( SV AS TDT )
  16594. violates the General Rules of Subclause 6.10, "<cast specifi-
  16595. cation>", then an exception condition is raised in accordance
  16596. with the General Rules of Subclause 6.10, "<cast specifica-
  16597. tion>".
  16598. e) The <cast specification>
  16599. CAST ( SV AS TDT )
  16600. is effectively performed, and is the value TV of the i-th
  16601. <target specification>.
  16602. f) If TV is the null value, then the value of INDICATOR is set
  16603. to -1.
  16604. g) If TV is not the null value, then:
  16605. i) The value of INDICATOR is set to 0 and the value of DATA is
  16606. set to TV.
  16607. ii) Case:
  16608. 1) If TYPE indicates CHARACTER VARYING or BIT VARYING, then
  16609. RETURNED_LENGTH is set to the length in characters or
  16610. bits, respectively, of TV, and RETURNED_OCTET_LENGTH is
  16611. set to the length in octets of TV.
  16612. 2) If SDT is CHARACTER VARYING or BIT VARYING, then
  16613. RETURNED_LENGTH is set to the length in characters or
  16614. bits, respectively, of SV, and RETURNED_OCTET_LENGTH is
  16615. set to the length in octets of SV.
  16616. Note: All other values of the SQL descriptor area are un-
  16617. changed.
  16618. Leveling Rules
  16619. 1) The following restrictions apply for Intermediate SQL:
  16620. a) A <descriptor name> shall be a <literal>.
  16621. 2) The following restrictions apply for Entry SQL in addition to
  16622. any Intermediate SQL restrictions:
  16623. a) Conforming Entry SQL language shall not contain any Dynamic
  16624. SQL language.
  16625. 458 Database Language SQL
  16626. X3H2-92-154/DBL CBR-002
  16627. 17.10 <execute statement>
  16628. 17.10 <execute statement>
  16629. Function
  16630. Associate input parameters and output targets with a prepared
  16631. statement and execute the statement.
  16632. Format
  16633. <execute statement> ::=
  16634. EXECUTE <SQL statement name>
  16635. [ <result using clause> ]
  16636. [ <parameter using clause> ]
  16637. <result using clause> ::= <using clause>
  16638. <parameter using clause> ::= <using clause>
  16639. Syntax Rules
  16640. 1) If <SQL statement name> is a <statement name>, then the contain-
  16641. ing <module> shall contain a <prepare statement> whose <state-
  16642. ment name> is the same as the <statement name> of the <execute
  16643. statement>.
  16644. 2) If <result using clause> is specified, then the <result us-
  16645. ing clause> shall contain either a <using arguments> or <using
  16646. descriptor> that contains the keyword INTO.
  16647. Access Rules
  16648. None.
  16649. General Rules
  16650. 1) When the <execute statement> is executed, if the <SQL statement
  16651. name> does not identify a statement P previously prepared in the
  16652. scope of the <SQL statement name>, then an exception condition
  16653. is raised: invalid SQL statement name.
  16654. 2) If P is a <dynamic select statement> that does not conform to
  16655. the Format and Syntax Rules of a <dynamic single row select
  16656. statement>, then an exception condition is raised: dynamic SQL
  16657. error-cursor specification cannot be executed.
  16658. 3) If P contains the <table name> of a created or declared local
  16659. temporary table and if the <execute statement> is not in the
  16660. same <module> as the <prepare statement> that prepared the pre-
  16661. pared statement, then an exception condition is raised: syntax
  16662. rule or access rule violation in dynamic SQL statement.
  16663. Dynamic SQL 459
  16664. X3H2-92-154/DBL CBR-002
  16665. 17.10 <execute statement>
  16666. 4) If P contains <dynamic parameter specification>s and a <parame-
  16667. ter using clause> is not specified, then an exception condition
  16668. is raised: dynamic SQL error- using clause required for dynamic
  16669. parameters.
  16670. 5) If P is a <dynamic single row select statement> and a <result
  16671. using clause> is not specified, then an exception condition
  16672. is raised: dynamic SQL error-using clause required for result
  16673. fields.
  16674. 6) If a <parameter using clause> that is <using descriptor> is
  16675. specified, then the General Rules specified in Subclause 17.9,
  16676. "<using clause>", for a <parameter using clause> in an <execute
  16677. statement> are applied.
  16678. 7) If P is a <dynamic single row select statement>, then the
  16679. General Rules specified in Subclause 17.9, "<using clause>", for
  16680. a <result using clause> in an <execute statement> are applied.
  16681. 8) P is executed.
  16682. Case:
  16683. a) If P is a <dynamic single row select statement>, then all
  16684. General Rules in Subclause 13.5, "<select statement: single
  16685. row>", apply to P, replacing "<query specification> S" with
  16686. "the <query specification> contained in P". The <argument>s
  16687. contained in the <result using clause> or the item descriptor
  16688. areas of the SQL descriptor area referenced in the <result
  16689. using clause>, if any, provide the <target specification>s
  16690. corresponding to the <select list> of P.
  16691. b) If the <preparable statement> is a <preparable dynamic
  16692. delete statement: positioned>, then all General Rules in
  16693. Subclause 17.19, "<preparable dynamic delete statement: posi-
  16694. tioned>", apply to the <preparable statement>.
  16695. c) If the <preparable statement> is a <preparable dynamic up-
  16696. date statement: positioned>, then all General Rules in
  16697. Subclause 17.20, "<preparable dynamic update statement: posi-
  16698. tioned>", apply to the <preparable statement>.
  16699. d) Otherwise, the results of the execution are the same as if
  16700. the statement was contained in a <procedure> and executed;
  16701. these are described in Subclause 12.3, "<procedure>".
  16702. Leveling Rules
  16703. 1) The following restrictions apply for Intermediate SQL:
  16704. a) Conforming Intermediate SQL language shall contain no <result
  16705. using clause>.
  16706. 460 Database Language SQL
  16707. X3H2-92-154/DBL CBR-002
  16708. 17.10 <execute statement>
  16709. 2) The following restrictions apply for Entry SQL in addition to
  16710. any Intermediate SQL restrictions:
  16711. a) Conforming Entry SQL language shall not contain any Dynamic
  16712. SQL language.
  16713. Dynamic SQL 461
  16714. X3H2-92-154/DBL CBR-002
  16715. 17.11 <execute immediate statement>
  16716. 17.11 <execute immediate statement>
  16717. Function
  16718. Dynamically prepare and execute a preparable statement.
  16719. Format
  16720. <execute immediate statement> ::=
  16721. EXECUTE IMMEDIATE <SQL statement variable>
  16722. Syntax Rules
  16723. 1) The data type of <SQL statement variable> shall be character
  16724. string.
  16725. Access Rules
  16726. None.
  16727. General Rules
  16728. 1) Let P be the contents of the <SQL statement variable>.
  16729. 2) If P is a <preparable dynamic delete statement: positioned> or a
  16730. <preparable dynamic update statement: positioned>, then P refers
  16731. to either a dynamic cursor with the same <cursor name> or to an
  16732. extended dynamic cursor whose <extended cursor name> value is
  16733. the same as the <cursor name>.
  16734. Case:
  16735. a) If both an extended dynamic cursor and a dynamic cursor with
  16736. the same name as the <cursor name> exist, then an exception
  16737. condition is raised: ambiguous cursor name.
  16738. b) If there is neither an extended dynamic cursor nor a dynamic
  16739. cursor with the name of <cursor name>, then an exception
  16740. condition is raised: invalid cursor name.
  16741. 3) If one or more of the following are true, then an exception
  16742. condition is raised: syntax error or access rule violation in
  16743. dynamic SQL statement.
  16744. a) P does not conform to the Format, Syntax Rules, and Access
  16745. Rules for a <preparable statement> or P is a <dynamic select
  16746. statement> or a <dynamic single row select statement>.
  16747. b) P contains a <comment>.
  16748. c) P contains a <dynamic parameter specification>.
  16749. 4) The <preparable statement> that is the value of the <SQL state-
  16750. ment variable> is prepared and executed.
  16751. 462 Database Language SQL
  16752. X3H2-92-154/DBL CBR-002
  16753. 17.11 <execute immediate statement>
  16754. Case:
  16755. a) If the <preparable statement> is a <preparable dynamic
  16756. delete statement: positioned>, then all General Rules in
  16757. Subclause 17.19, "<preparable dynamic delete statement: posi-
  16758. tioned>", apply to the <preparable statement>.
  16759. b) If the <preparable statement> is a <preparable dynamic up-
  16760. date statement: positioned>, then all General Rules in
  16761. Subclause 17.20, "<preparable dynamic update statement: posi-
  16762. tioned>", apply to the <preparable statement>.
  16763. c) Otherwise, the results of the execution are the same as if
  16764. the statement was contained in a <procedure> and executed;
  16765. these are described in Subclause 12.3, "<procedure>".
  16766. Leveling Rules
  16767. 1) The following restrictions apply for Intermediate SQL:
  16768. None.
  16769. 2) The following restrictions apply for Entry SQL in addition to
  16770. any Intermediate SQL restrictions:
  16771. a) Conforming Entry SQL language shall not contain any Dynamic
  16772. SQL language.
  16773. Dynamic SQL 463
  16774. X3H2-92-154/DBL CBR-002
  16775. 17.12 <dynamic declare cursor>
  16776. 17.12 <dynamic declare cursor>
  16777. Function
  16778. Declare a cursor to be associated with a <statement name>, which
  16779. may in turn be associated with a <cursor specification>.
  16780. Format
  16781. <dynamic declare cursor> ::=
  16782. DECLARE <cursor name> [ INSENSITIVE ] [ SCROLL ] CURSOR
  16783. FOR <statement name>
  16784. Syntax Rules
  16785. 1) The <cursor name> shall not be identical to the <cursor name>
  16786. specified in any other <declare cursor> or <dynamic declare
  16787. cursor> in the same <module>.
  16788. 2) The containing <module> shall contain a <prepare statement>
  16789. whose <statement name> is the same as the <statement name> of
  16790. the <dynamic declare cursor>.
  16791. Access Rules
  16792. None.
  16793. General Rules
  16794. 1) All General Rules of Subclause 13.1, "<declare cursor>" apply
  16795. to <dynamic declare cursor>, replacing "<open statement>" with
  16796. "<dynamic open statement>" and "<cursor specification>" with
  16797. "prepared statement".
  16798. Leveling Rules
  16799. 1) The following restrictions apply for Intermediate SQL:
  16800. a) Conforming Intermediate SQL language shall contain no <dy-
  16801. namic declare cursor> that specifies INSENSITIVE.
  16802. b) If an <updatability clause> of FOR UPDATE with or without
  16803. a <column name list> is specified, then neither SCROLL nor
  16804. ORDER BY shall be specified.
  16805. 2) The following restrictions apply for Entry SQL in addition to
  16806. any Intermediate SQL restrictions:
  16807. a) Conforming Entry SQL language shall not contain any Dynamic
  16808. SQL language.
  16809. 464 Database Language SQL
  16810. X3H2-92-154/DBL CBR-002
  16811. 17.13 <allocate cursor statement>
  16812. 17.13 <allocate cursor statement>
  16813. Function
  16814. Define a cursor based on a <prepare statement> for a <cursor speci-
  16815. fication>.
  16816. Format
  16817. <allocate cursor statement> ::=
  16818. ALLOCATE <extended cursor name> [ INSENSITIVE ] [ SCROLL ] CURSOR
  16819. FOR <extended statement name>
  16820. Syntax Rules
  16821. None.
  16822. Access Rules
  16823. None.
  16824. General Rules
  16825. 1) When the <allocate cursor statement> is executed, if the value
  16826. of the <extended statement name> does not identify a statement
  16827. previously prepared in the scope of the <extended statement
  16828. name>, then an exception condition is raised: invalid SQL state-
  16829. ment name.
  16830. 2) If the prepared statement associated with the <extended state-
  16831. ment name> is not a <cursor specification>, then an exception
  16832. condition is raised: dynamic SQL error-prepared statement not a
  16833. cursor specification.
  16834. 3) All General Rules of Subclause 13.1, "<declare cursor>" apply to
  16835. <allocate cursor statement>, replacing "<open statement>" with
  16836. "<dynamic open statement>" and "<cursor specification>" with
  16837. "prepared statement".
  16838. 4) Let S be the character string that is the value of the <simple
  16839. value specification> immediately contained in <extended cursor
  16840. name>. Let V be the character string that is the result of
  16841. TRIM ( BOTH ' ' FROM S )
  16842. If V does not conform to the Format and Syntax Rules of an
  16843. <identifier>, then an exception condition is raised: invalid
  16844. cursor name.
  16845. Dynamic SQL 465
  16846. X3H2-92-154/DBL CBR-002
  16847. 17.13 <allocate cursor statement>
  16848. 5) If the value of the <extended cursor name> is identical to the
  16849. value of the <extended cursor name> of any other cursor al-
  16850. located in the scope of the <extended cursor name>, then an
  16851. exception condition is raised: invalid cursor name.
  16852. 6) An association is made between the value of the <extended cursor
  16853. name> and the prepared statement in the scope of the <extended
  16854. cursor name>. The association is preserved until the prepared
  16855. statement is destroyed, at which time the cursor identified by
  16856. <extended cursor name> is also destroyed.
  16857. Leveling Rules
  16858. 1) The following restrictions apply for Intermediate SQL:
  16859. a) Conforming Intermediate SQL language shall not contain any
  16860. <allocate cursor statement>.
  16861. 2) The following restrictions apply for Entry SQL in addition to
  16862. any Intermediate SQL restrictions:
  16863. None.
  16864. 466 Database Language SQL
  16865. X3H2-92-154/DBL CBR-002
  16866. 17.14 <dynamic open statement>
  16867. 17.14 <dynamic open statement>
  16868. Function
  16869. Associate input parameters with a <cursor specification> and open
  16870. the cursor.
  16871. Format
  16872. <dynamic open statement> ::=
  16873. OPEN <dynamic cursor name> [ <using clause> ]
  16874. Syntax Rules
  16875. 1) If <dynamic cursor name> DCN is a <cursor name> CN, then the
  16876. containing <module> shall contain a <dynamic declare cursor>
  16877. whose <cursor name> is CN.
  16878. 2) Let CR be the cursor identified by DCN.
  16879. Access Rules
  16880. 1) The Access Rules for the <query expression> simply contained in
  16881. the prepared statement associated with the <dynamic cursor name>
  16882. are applied.
  16883. General Rules
  16884. 1) If <dynamic cursor name> is a <cursor name> and the <statement
  16885. name> of the associated <dynamic declare cursor> is not associ-
  16886. ated with a prepared statement, then an exception condition is
  16887. raised: invalid SQL statement name.
  16888. 2) If <dynamic cursor name> is an <extended cursor name> whose
  16889. value does not identify a cursor allocated in the scope of the
  16890. <extended cursor name>, then an exception condition is raised:
  16891. invalid cursor name.
  16892. 3) If the prepared statement associated with the <dynamic cursor
  16893. name> contains <dynamic parameter specification>s and a <using
  16894. clause> is not specified, then an exception condition is raised:
  16895. dynamic SQL error-using clause required for dynamic parameters.
  16896. 4) The cursor specified by <dynamic cursor name> is updatable if
  16897. and only if the associated <cursor specification> specified an
  16898. updatable cursor.
  16899. Note: updatable cursor is defined in Subclause 13.1, "<declare
  16900. cursor>".
  16901. 5) If a <using clause> is specified, then the General Rules spec-
  16902. ified in Subclause 17.9, "<using clause>", for <dynamic open
  16903. statement> are applied.
  16904. Dynamic SQL 467
  16905. X3H2-92-154/DBL CBR-002
  16906. 17.14 <dynamic open statement>
  16907. 6) All General Rules of Subclause 13.2, "<open statement>", apply
  16908. to the <dynamic open statement>.
  16909. Leveling Rules
  16910. 1) The following restrictions apply for Intermediate SQL:
  16911. None.
  16912. 2) The following restrictions apply for Entry SQL in addition to
  16913. any Intermediate SQL restrictions:
  16914. a) Conforming Entry SQL language shall not contain any Dynamic
  16915. SQL language.
  16916. 468 Database Language SQL
  16917. X3H2-92-154/DBL CBR-002
  16918. 17.15 <dynamic fetch statement>
  16919. 17.15 <dynamic fetch statement>
  16920. Function
  16921. Fetch a row for a cursor declared with a <dynamic declare cursor>.
  16922. Format
  16923. <dynamic fetch statement> ::=
  16924. FETCH [ [ <fetch orientation> ] FROM ] <dynamic cursor name>
  16925. <using clause>
  16926. Syntax Rules
  16927. 1) If <fetch orientation> is omitted, then NEXT is implicit.
  16928. 2) The <using clause> shall specify INTO.
  16929. 3) If <dynamic cursor name> DCN is a <cursor name> CN, then the
  16930. containing <module> shall contain a <dynamic declare cursor>
  16931. whose <cursor name> is CN.
  16932. 4) Let CR be the cursor identified by DCN and let T be the table
  16933. defined by the <cursor specification> of CR.
  16934. 5) If the implicit or explicit <fetch orientation> is not NEXT,
  16935. then the <dynamic declare cursor> or <allocate cursor statement>
  16936. associated with CR shall specify SCROLL.
  16937. 6) The number of <target specification>s in <using arguments> or
  16938. the number of item descriptor areas in the SQL descriptor area
  16939. referenced by <using descriptor>, as appropriate, shall be the
  16940. same as the degree of T. The i-th <target specification> in <us-
  16941. ing arguments> or the i-th item descriptor area of the SQL de-
  16942. scriptor area, as appropriate, corresponds with the i-th column
  16943. of T.
  16944. 7) The Syntax Rules of Subclause 9.1, "Retrieval assignment", apply
  16945. to each corresponding <target specification> in <using argu-
  16946. ments> and each column of T as TARGET and VALUE, respectively.
  16947. Access Rules
  16948. None.
  16949. General Rules
  16950. 1) The General Rules specified in Subclause 17.9, "<using clause>",
  16951. for <dynamic fetch statement> are applied.
  16952. Dynamic SQL 469
  16953. X3H2-92-154/DBL CBR-002
  16954. 17.15 <dynamic fetch statement>
  16955. 2) All General Rules of Subclause 13.3, "<fetch statement>", ap-
  16956. ply to the <dynamic fetch statement>, replacing "targets in
  16957. the <fetch target list>" and "targets identified by the <fetch
  16958. target list>" with "<target specification>s in the <using argu-
  16959. ments> or item descriptor areas of the SQL descriptor area, as
  16960. appropriate".
  16961. Leveling Rules
  16962. 1) The following restrictions apply for Intermediate SQL:
  16963. 2) The following restrictions apply for Entry SQL in addition to
  16964. any Intermediate SQL restrictions:
  16965. a) Conforming Entry SQL language shall not contain any Dynamic
  16966. SQL language.
  16967. 470 Database Language SQL
  16968. X3H2-92-154/DBL CBR-002
  16969. 17.16 <dynamic close statement>
  16970. 17.16 <dynamic close statement>
  16971. Function
  16972. Close a cursor.
  16973. Format
  16974. <dynamic close statement> ::=
  16975. CLOSE <dynamic cursor name>
  16976. Syntax Rules
  16977. 1) If <dynamic cursor name> DCN is a <cursor name> CN, then the
  16978. containing <module> shall contain a <dynamic declare cursor>
  16979. whose <cursor name> is CN.
  16980. 2) Let CR be the cursor identified by DCN.
  16981. Access Rules
  16982. None.
  16983. General Rules
  16984. 1) All General Rules of Subclause 13.4, "<close statement>", apply
  16985. to the <dynamic close statement>.
  16986. Leveling Rules
  16987. 1) The following restrictions apply for Intermediate SQL:
  16988. None.
  16989. 2) The following restrictions apply for Entry SQL in addition to
  16990. any Intermediate SQL restrictions:
  16991. a) Conforming Entry SQL language shall not contain any Dynamic
  16992. SQL language.
  16993. Dynamic SQL 471
  16994. X3H2-92-154/DBL CBR-002
  16995. 17.17 <dynamic delete statement: positioned>
  16996. 17.17 <dynamic delete statement: positioned>
  16997. Function
  16998. Delete a row of a table.
  16999. Format
  17000. <dynamic delete statement: positioned> ::=
  17001. DELETE FROM <table name>
  17002. WHERE CURRENT OF <dynamic cursor name>
  17003. Syntax Rules
  17004. 1) If <dynamic cursor name> DCN is a <cursor name> CN, then the
  17005. containing <module> shall contain a <dynamic declare cursor>
  17006. whose <cursor name> is CN.
  17007. 2) Let CR be the cursor identified by DCN.
  17008. 3) CR shall be an updatable cursor.
  17009. Note: updatable cursor is defined in Subclause 13.1, "<declare
  17010. cursor>".
  17011. 4) Let T be the table identified by the <table name>. Let QS be the
  17012. <query specification> that is the simply underlying table of the
  17013. simply underlying table of CR. The simply underlying table of QS
  17014. shall be T.
  17015. Note: The simply underlying table of a <cursor specification> is
  17016. defined in Subclause 13.1, "<declare cursor>".
  17017. Access Rules
  17018. 1) All Access Rules of Subclause 13.6, "<delete statement: posi-
  17019. tioned>", apply to the <dynamic delete statement: positioned>.
  17020. General Rules
  17021. 1) All General Rules of Subclause 13.6, "<delete statement: posi-
  17022. tioned>", apply to the <dynamic delete statement: positioned>,
  17023. replacing "<delete statement: positioned>" with "<dynamic delete
  17024. statement: positioned>".
  17025. Leveling Rules
  17026. 1) The following restrictions apply for Intermediate SQL:
  17027. None.
  17028. 472 Database Language SQL
  17029. X3H2-92-154/DBL CBR-002
  17030. 17.17 <dynamic delete statement: positioned>
  17031. 2) The following restrictions apply for Entry SQL in addition to
  17032. any Intermediate SQL restrictions:
  17033. a) Conforming Entry SQL language shall not contain any Dynamic
  17034. SQL language.
  17035. Dynamic SQL 473
  17036. X3H2-92-154/DBL CBR-002
  17037. 17.18 <dynamic update statement: positioned>
  17038. 17.18 <dynamic update statement: positioned>
  17039. Function
  17040. Update a row of a table.
  17041. Format
  17042. <dynamic update statement: positioned> ::=
  17043. UPDATE <table name>
  17044. SET <set clause> [ { <comma> <set clause> }... ]
  17045. WHERE CURRENT OF <dynamic cursor name>
  17046. Syntax Rules
  17047. 1) If <dynamic cursor name> DCN is a <cursor name> CN, then the
  17048. containing <module> shall contain a <dynamic declare cursor>
  17049. whose <cursor name> is CN.
  17050. 2) Let CR be the cursor identified by DCN.
  17051. 3) CR shall be an updatable cursor.
  17052. Note: updatable cursor is defined in Subclause 13.1, "<declare
  17053. cursor>".
  17054. 4) Let T be the table identified by the <table name>. Let QS be the
  17055. <query specification> that is the simply underlying table of the
  17056. simply underlying table of CR. The simply underlying table of QS
  17057. shall be T.
  17058. Note: The simply underlying table of a <cursor specification> is
  17059. defined in Subclause 13.1, "<declare cursor>".
  17060. 5) If CR is an ordered cursor, then for each <object column> OC,
  17061. the column of T identified by OC shall not be directly or in-
  17062. directly referenced in the <order by clause> of the defining
  17063. <cursor specification> for CR.
  17064. 6) No leaf generally underlying table of T shall be an underly-
  17065. ing table of any <query expression> generally contained in any
  17066. <value expression> immediately contained in any <update source>
  17067. contained in the <set clause list>.
  17068. 7) A <value expression> in a <set clause> shall not directly con-
  17069. tain a <set function specification>.
  17070. 8) The same <object column> shall not appear more than once in a
  17071. <set clause list>.
  17072. 9) If CR was specified using an explicit or implicit <updatability
  17073. clause> of FOR UPDATE, then each <column name> specified as
  17074. an <object column> shall identify a column in the explicit or
  17075. implicit <column name list> associated with the <updatability
  17076. clause>.
  17077. 474 Database Language SQL
  17078. X3H2-92-154/DBL CBR-002
  17079. 17.18 <dynamic update statement: positioned>
  17080. 10)The scope of the <table name> is the entire <update statement:
  17081. positioned>.
  17082. 11)For every <set clause>, the Syntax Rules of Subclause 9.2,
  17083. "Store assignment", apply to the column of T identified by the
  17084. <object column> and the <value expression> of the <set clause>
  17085. as TARGET and VALUE, respectively.
  17086. Access Rules
  17087. 1) All Access Rules of Subclause 13.9, "<update statement: posi-
  17088. tioned>", apply to the <dynamic update statement: positioned>.
  17089. General Rules
  17090. 1) All General Rules of Subclause 13.9, "<update statement: posi-
  17091. tioned>", apply to the <dynamic update statement: positioned>,
  17092. replacing "<cursor name>" with "<dynamic cursor name>" and "<up-
  17093. date statement: positioned>" with "<dynamic update statement:
  17094. positioned>".
  17095. Leveling Rules
  17096. 1) The following restrictions apply for Intermediate SQL:
  17097. None.
  17098. 2) The following restrictions apply for Entry SQL in addition to
  17099. any Intermediate SQL restrictions:
  17100. a) Conforming Entry SQL language shall not contain any Dynamic
  17101. SQL language.
  17102. Dynamic SQL 475
  17103. X3H2-92-154/DBL CBR-002
  17104. 17.19 <preparable dynamic delete statement: positioned>
  17105. 17.19 <preparable dynamic delete statement: positioned>
  17106. Function
  17107. Delete a row of a table through a dynamic cursor.
  17108. Format
  17109. <preparable dynamic delete statement: positioned> ::=
  17110. DELETE [ FROM <table name> ]
  17111. WHERE CURRENT OF <cursor name>
  17112. Syntax Rules
  17113. 1) If <table name> is not specified, then the name of the under-
  17114. lying table of the <cursor specification> identified by <cursor
  17115. name> is implicit.
  17116. 2) All Syntax Rules of Subclause 13.6, "<delete statement: posi-
  17117. tioned>", apply to the <preparable dynamic delete statement:
  17118. positioned>, replacing "<declare cursor>" with "<dynamic declare
  17119. cursor> or <allocate cursor statement>" and "<delete state-
  17120. ment: positioned>" with "<preparable dynamic delete statement:
  17121. positioned>".
  17122. Access Rules
  17123. 1) All Access Rules of Subclause 13.6, "<delete statement: posi-
  17124. tioned>", apply to the <preparable dynamic delete statement:
  17125. positioned>.
  17126. General Rules
  17127. 1) All General Rules of Subclause 13.6, "<delete statement: po-
  17128. sitioned>", apply to the <preparable dynamic delete statement:
  17129. positioned>, replacing "<delete statement: positioned>" with
  17130. "<preparable dynamic delete statement: positioned>".
  17131. Leveling Rules
  17132. 1) The following restrictions apply for Intermediate SQL:
  17133. a) Conforming Intermediate SQL language shall contain no
  17134. <preparable dynamic delete statement: positioned>.
  17135. 2) The following restrictions apply for Entry SQL in addition to
  17136. any Intermediate SQL restrictions:
  17137. None.
  17138. 476 Database Language SQL
  17139. X3H2-92-154/DBL CBR-002
  17140. 17.20 <preparable dynamic update statement: positioned>
  17141. 17.20 <preparable dynamic update statement: positioned>
  17142. Function
  17143. Update a row of a table through a dynamic cursor.
  17144. Format
  17145. <preparable dynamic update statement: positioned> ::=
  17146. UPDATE [ <table name> ]
  17147. SET <set clause list>
  17148. WHERE CURRENT OF <cursor name>
  17149. Syntax Rules
  17150. 1) If <table name> is not specified, then the name of the under-
  17151. lying table of the <cursor specification> identified by <cursor
  17152. name> is implicit.
  17153. 2) All Syntax Rules of Subclause 13.9, "<update statement: posi-
  17154. tioned>", apply to the <preparable dynamic update statement:
  17155. positioned>, replacing "<declare cursor>" with "<dynamic declare
  17156. cursor> or <allocate cursor statement>" and "<update state-
  17157. ment: positioned>" with "<preparable dynamic update statement:
  17158. positioned>".
  17159. Access Rules
  17160. 1) All Access Rules of Subclause 13.9, "<update statement: posi-
  17161. tioned>", apply to the <preparable dynamic update statement:
  17162. positioned>.
  17163. General Rules
  17164. 1) All General Rules of Subclause 13.9, "<update statement: po-
  17165. sitioned>", apply to the <preparable dynamic update statement:
  17166. positioned>, replacing "<update statement: positioned>" with
  17167. "<preparable dynamic update statement: positioned>".
  17168. Leveling Rules
  17169. 1) The following restrictions apply for Intermediate SQL:
  17170. a) Conforming Intermediate SQL language shall contain no
  17171. <preparable dynamic update statement: positioned>.
  17172. 2) The following restrictions apply for Entry SQL in addition to
  17173. any Intermediate SQL restrictions:
  17174. None.
  17175. Dynamic SQL 477
  17176. X3H2-92-154/DBL CBR-002
  17177. 478 Database Language SQL
  17178. X3H2-92-154/DBL CBR-002
  17179. 18 Diagnostics management
  17180. 18.1 <get diagnostics statement>
  17181. Function
  17182. Get exception or completion condition information from the diagnos-
  17183. tics area.
  17184. Format
  17185. <get diagnostics statement> ::=
  17186. GET DIAGNOSTICS <sql diagnostics information>
  17187. <sql diagnostics information> ::=
  17188. <statement information>
  17189. | <condition information>
  17190. <statement information> ::=
  17191. <statement information item> [ { <comma> <statement information item> }... ]
  17192. <statement information item> ::=
  17193. <simple target specification> <equals operator> <statement information item name>
  17194. <statement information item name> ::=
  17195. NUMBER
  17196. | MORE
  17197. | COMMAND_FUNCTION
  17198. | DYNAMIC_FUNCTION
  17199. | ROW_COUNT
  17200. <condition information> ::=
  17201. EXCEPTION <condition number>
  17202. <condition information item> [ { <comma> <condition information item> }... ]
  17203. <condition information item> ::=
  17204. <simple target specification> <equals operator> <condition information item name>
  17205. <condition information item name> ::=
  17206. CONDITION_NUMBER
  17207. | RETURNED_SQLSTATE
  17208. | CLASS_ORIGIN
  17209. | SUBCLASS_ORIGIN
  17210. | SERVER_NAME
  17211. Diagnostics management 479
  17212. X3H2-92-154/DBL CBR-002
  17213. 18.1 <get diagnostics statement>
  17214. | CONNECTION_NAME
  17215. | CONSTRAINT_CATALOG
  17216. | CONSTRAINT_SCHEMA
  17217. | CONSTRAINT_NAME
  17218. | CATALOG_NAME
  17219. | SCHEMA_NAME
  17220. | TABLE_NAME
  17221. | COLUMN_NAME
  17222. | CURSOR_NAME
  17223. | MESSAGE_TEXT
  17224. | MESSAGE_LENGTH
  17225. | MESSAGE_OCTET_LENGTH
  17226. <condition number> ::= <simple value specification>
  17227. Syntax Rules
  17228. 1) The data type of a <simple target specification> contained in
  17229. a <statement information item> or <condition information item>
  17230. shall be the data type specified in Table 21, "<identifier>s
  17231. for use with <get diagnostics statement>", for the corresponding
  17232. <statement information item name> or <condition information item
  17233. name>.
  17234. 2) The data type of <condition number> shall be exact numeric with
  17235. scale 0.
  17236. 480 Database Language SQL
  17237. X3H2-92-154/DBL CBR-002
  17238. 18.1 <get diagnostics statement>
  17239. __Table_21-<identifier>s_for_use_with_<get_diagnostics_statement>__
  17240. _<identifier>___________Data_Type__________________________________
  17241. |_________________<stat|ment_information_item_name>s_______________|
  17242. | | |
  17243. | NUMBER exact numeric with scale 0 |
  17244. | |
  17245. | MORE | character string (1) |
  17246. | | |
  17247. | COMMAND_FUNCTION | character varying (L) |
  17248. | | |
  17249. | DYNAMIC_FUNCTION | character varying (L) |
  17250. | | |
  17251. |_ROW_COUNT____________|_exact_numeric_with_scale_0________________|
  17252. | | |
  17253. |_________________<cond|tion_information_item_name>s_______________|
  17254. | | |
  17255. | CONDITION_NUMBER exact numeric with scale 0 |
  17256. | |
  17257. | RETURNED_SQLSTATE | character string (5) |
  17258. | | |
  17259. | CLASS_ORIGIN | character varying (L) |
  17260. | | |
  17261. | SUBCLASS_ORIGIN | character varying (L) |
  17262. | | |
  17263. | SERVER_NAME | character varying (L) |
  17264. | | |
  17265. | CONNECTION_NAME | character varying (L) |
  17266. | | |
  17267. | CONSTRAINT_CATALOG | character varying (L) |
  17268. | | |
  17269. | CONSTRAINT_SCHEMA | character varying (L) |
  17270. | | |
  17271. | CONSTRAINT_NAME | character varying (L) |
  17272. | | |
  17273. | CATALOG_NAME | character varying (L) |
  17274. | | |
  17275. | SCHEMA_NAME | character varying (L) |
  17276. | | |
  17277. | TABLE_NAME | character varying (L) |
  17278. | | |
  17279. | COLUMN_NAME | character varying (L) |
  17280. | | |
  17281. | CURSOR_NAME | character varying (L) |
  17282. | | |
  17283. | MESSAGE_TEXT | character varying (L) |
  17284. | | |
  17285. | MESSAGE_LENGTH | exact numeric with scale 0 |
  17286. | | |
  17287. |_MESSAGE_OCTET_LENGTH_|_exact_numeric_with_scale_0________________|
  17288. | | |
  17289. | Where L is an impleme|tation-defined integer not less than 128. |
  17290. |______________________|___________________________________________|
  17291. | |
  17292. Access Rules
  17293. None.
  17294. Diagnostics management 481
  17295. X3H2-92-154/DBL CBR-002
  17296. 18.1 <get diagnostics statement>
  17297. General Rules
  17298. 1) Specification of <statement information item> retrieves informa-
  17299. tion about the statement execution recorded in the diagnostics
  17300. area into <simple target specification>.
  17301. a) The value of NUMBER is the number of exception or completion
  17302. conditions that have been stored in the diagnostics area as a
  17303. result of executing the previous SQL-statement other than a
  17304. <get diagnostics statement>.
  17305. Note: The <get diagnostics statement> itself may return infor-
  17306. mation via the SQLCODE or SQLSTATE parameters, but does not
  17307. modify the previous contents of the diagnostics area.
  17308. b) The value of MORE is:
  17309. Y More conditions were raised during execution of the
  17310. SQL-statement than have been stored in the diagnostics
  17311. area.
  17312. N All of the conditions that were raised during execution
  17313. of the SQL-statement have been stored in the diagnostics
  17314. area.
  17315. c) The value of COMMAND_FUNCTION is the identification of the
  17316. SQL-statement executed. Table 22, "SQL-statement character
  17317. codes for use in the diagnostics area" specifies the identi-
  17318. fier of the SQL-statements.
  17319. d) The value of DYNAMIC_FUNCTION is the identification of the
  17320. prepared statement executed. Table 22, "SQL-statement char-
  17321. acter codes for use in the diagnostics area", specifies the
  17322. identifier of the SQL-statements.
  17323. Table 22-SQL-statement character
  17324. _______________codes_for_use_in_the_diagnostics_area_______________
  17325. _SQL-statement____________________Identifier_______________________
  17326. | <allocate cursor statement> | ALLOCATE CURSOR |
  17327. | | |
  17328. | <allocate descriptor state- | ALLOCATE DESCRIPTOR |
  17329. ment>
  17330. | <alter domain statement> | ALTER DOMAIN |
  17331. | | |
  17332. | <alter table statement> | ALTER TABLE |
  17333. | | |
  17334. | <assertion definition> | CREATE ASSERTION |
  17335. | | |
  17336. | <character set definition> | CREATE CHARACTER SET |
  17337. | | |
  17338. | <close statement> | CLOSE CURSOR |
  17339. | | |
  17340. | <collation definition> | CREATE COLLATION |
  17341. | | |
  17342. | <commit statement> | COMMIT WORK |
  17343. | | |
  17344. 482 Database Language SQL
  17345. X3H2-92-154/DBL CBR-002
  17346. 18.1 <get diagnostics statement>
  17347. Table 22-SQL-statement character codes
  17348. ______________for_use_in_the_diagnostics_area_(Cont.)______________
  17349. _SQL-statement____________________Identifier_______________________
  17350. | <connect statement> | CONNECT |
  17351. | | |
  17352. | <deallocate descriptor state- | DEALLOCATE DESCRIPTOR |
  17353. ment>
  17354. | <deallocate prepared state- | DEALLOCATE PREPARE |
  17355. | ment> | |
  17356. | | |
  17357. | <delete statement: positioned> | DELETE CURSOR |
  17358. | | |
  17359. | <delete statement: searched> | DELETE WHERE |
  17360. | | |
  17361. | <describe statement> | DESCRIBE |
  17362. | | |
  17363. | <direct select statement: | SELECT |
  17364. multiple rows>
  17365. | <disconnect statement> | DISCONNECT |
  17366. | | |
  17367. | <domain definition> | CREATE DOMAIN |
  17368. | | |
  17369. | <drop assertion statement> | DROP ASSERTION |
  17370. | | |
  17371. | <drop character set statement> | DROP CHARACTER SET |
  17372. | | |
  17373. | <drop collation statement> | DROP COLLATION |
  17374. | | |
  17375. | <drop domain statement> | DROP DOMAIN |
  17376. | | |
  17377. | <drop schema statement> | DROP SCHEMA |
  17378. | | |
  17379. | <drop table statement> | DROP TABLE |
  17380. | | |
  17381. | <drop translation statement> | DROP TRANSLATION |
  17382. | | |
  17383. | <drop view statement> | DROP VIEW |
  17384. | | |
  17385. | <dynamic close statement> | DYNAMIC CLOSE |
  17386. | | |
  17387. | <dynamic delete statement: | DYNAMIC DELETE CURSOR |
  17388. positioned>
  17389. | <dynamic fetch statement> | DYNAMIC FETCH |
  17390. | | |
  17391. | <dynamic open statement> | DYNAMIC OPEN |
  17392. | | |
  17393. | <dynamic single row select | SELECT |
  17394. statement>
  17395. | <dynamic update statement: | DYNAMIC UPDATE CURSOR |
  17396. | positioned> | |
  17397. | | |
  17398. | <execute immediate statement> | EXECUTE IMMEDIATE |
  17399. | | |
  17400. | <execute statement> | EXECUTE |
  17401. | | |
  17402. | <fetch statement> | FETCH |
  17403. | | |
  17404. | <get descriptor statement> | GET DESCRIPTOR |
  17405. | | |
  17406. Diagnostics management 483
  17407. X3H2-92-154/DBL CBR-002
  17408. 18.1 <get diagnostics statement>
  17409. Table 22-SQL-statement character codes
  17410. ______________for_use_in_the_diagnostics_area_(Cont.)______________
  17411. _SQL-statement____________________Identifier_______________________
  17412. | <get diagnostics statement> | GET DIAGNOSTICS |
  17413. | | |
  17414. | <grant statement> | GRANT |
  17415. | | |
  17416. | <insert statement> | INSERT |
  17417. | | |
  17418. | <open statement> | OPEN |
  17419. | | |
  17420. | <preparable dynamic delete | DYNAMIC DELETE CURSOR |
  17421. statement: positioned>
  17422. | <preparable dynamic update | DYNAMIC UPDATE CURSOR |
  17423. | statement: positioned> | |
  17424. | | |
  17425. | <prepare statement> | PREPARE |
  17426. | | |
  17427. | <revoke statement> | REVOKE |
  17428. | | |
  17429. | <rollback statement> | ROLLBACK WORK |
  17430. | | |
  17431. | <schema definition> | CREATE SCHEMA |
  17432. | | |
  17433. | <select statement: single row> | SELECT |
  17434. | | |
  17435. | <set catalog statement> | SET CATALOG |
  17436. | | |
  17437. | <set connection statement> | SET CONNECTION |
  17438. | | |
  17439. | <set constraints mode state- | SET CONSTRAINT |
  17440. ment>
  17441. | <set descriptor statement> | SET DESCRIPTOR |
  17442. | | |
  17443. | <set local time zone state- | SET TIME ZONE |
  17444. ment>
  17445. | <set names statement> | SET NAMES |
  17446. | | |
  17447. | <set schema statement> | SET SCHEMA |
  17448. | | |
  17449. | <set transaction statement> | SET TRANSACTION |
  17450. | | |
  17451. | <set session authorization | SET SESSION AUTHORIZATION |
  17452. identifier statement>
  17453. | <table definition> | CREATE TABLE |
  17454. | | |
  17455. | <translation definition> | CREATE TRANSLATION |
  17456. | | |
  17457. | <update statement: positioned> | UPDATE CURSOR |
  17458. | | |
  17459. | <update statement: searched> | UPDATE WHERE |
  17460. | | |
  17461. |_<view_definition>______________|_CREATE_VIEW_____________________|
  17462. | | |
  17463. e) The value of ROW_COUNT is the number of rows affected as the
  17464. result of executing a <delete statement: searched>, <insert
  17465. statement>, or <update statement: searched> as a direct re-
  17466. sult of executing the previous SQL-statement. Let S be the
  17467. <delete statement: searched>, <insert statement>, or <update
  17468. 484 Database Language SQL
  17469. X3H2-92-154/DBL CBR-002
  17470. 18.1 <get diagnostics statement>
  17471. statement: searched>. Let T be the table identified by the
  17472. <table name> directly contained in S.
  17473. Case:
  17474. i) If S is an <insert statement>, then the value of ROW_COUNT
  17475. is the number of rows inserted into T.
  17476. ii) If S is not an <insert statement> and does not contain a
  17477. <search condition>, then the value of ROW_COUNT is the
  17478. cardinality of T before the execution of S.
  17479. iii) Otherwise, let SC be the <search condition> directly con-
  17480. tained in S. The value of ROW_COUNT is effectively derived
  17481. by executing the statement:
  17482. SELECT COUNT(*) FROM T WHERE SC
  17483. before the execution of S.
  17484. The value of ROW_COUNT following the execution of an SQL-
  17485. statement that does not directly result in the execution of
  17486. a <delete statement: searched>, an <insert statement>, or an
  17487. <update statement: searched> is implementation-dependent.
  17488. 2) If <condition information> was specified, then let N be the
  17489. value of <condition number>. If N is less than 1 or greater than
  17490. the number of conditions stored in the diagnostics area, then
  17491. an exception condition is raised: invalid condition number. If
  17492. <condition number> has the value 1, then the diagnostics infor-
  17493. mation retrieved corresponds to the condition indicated by the
  17494. SQLSTATE or SQLCODE value actually returned by execution of the
  17495. previous SQL-statement other than a <get diagnostics statement>.
  17496. Otherwise, the association between <condition number> values
  17497. and specific conditions raised during evaluation of the General
  17498. Rules for that SQL-statement is implementation-dependent.
  17499. 3) Specification of <condition information item> retrieves informa-
  17500. tion about the N-th condition in the diagnostics area into the
  17501. <simple target specification>.
  17502. a) The value of CONDITION_NUMBER is the value of <condition
  17503. number>.
  17504. b) The value of CLASS_ORIGIN is the identification of the naming
  17505. authority that defined the class value of RETURNED_SQLSTATE.
  17506. That value shall be 'ISO 9075' for any RETURNED_SQLSTATE
  17507. whose class value is fully defined in Subclause 22.1,
  17508. "SQLSTATE", and shall be an implementation-defined charac-
  17509. ter string other than 'ISO 9075' for any RETURNED_SQLSTATE
  17510. whose class value is an implementation-defined class value.
  17511. c) The value of SUBCLASS_ORIGIN is the identification of
  17512. the naming authority that defined the subclass value of
  17513. RETURNED_SQLSTATE. That value shall be 'ISO 9075' for any
  17514. RETURNED_SQLSTATE whose subclass value is fully defined in
  17515. Diagnostics management 485
  17516. X3H2-92-154/DBL CBR-002
  17517. 18.1 <get diagnostics statement>
  17518. Subclause 22.1, "SQLSTATE", and shall be an implementation-
  17519. defined character string other than 'ISO 9075' for any
  17520. RETURNED_SQLSTATE whose subclass value is an implementation-
  17521. defined subclass value.
  17522. d) The value of RETURNED_SQLSTATE is the SQLSTATE parameter that
  17523. would have been returned if this were the only completion or
  17524. exception condition possible.
  17525. e) If the value of RETURNED_SQLSTATE corresponds to warning
  17526. with a subclass of cursor operation conflict, then the value
  17527. of CURSOR_NAME is the name of the cursor that caused the
  17528. completion condition to be raised.
  17529. f) If the value of RETURNED_SQLSTATE corresponds to integrity
  17530. constraint violation, transaction rollback-integrity con-
  17531. straint violation, or triggered data change violation, then:
  17532. i) The values of CONSTRAINT_CATALOG and CONSTRAINT_SCHEMA are
  17533. the <catalog name> and the <unqualified schema name> of the
  17534. <schema name> of the schema containing the constraint or
  17535. assertion. The value of CONSTRAINT_NAME is the <qualified
  17536. identifier> of the constraint or assertion.
  17537. ii) Case:
  17538. 1) If the violated integrity constraint is a table con-
  17539. straint, then the values of CATALOG_NAME, SCHEMA_NAME,
  17540. and TABLE_NAME are the <catalog name>, the <unqualified
  17541. schema name> of the <schema name>, and the <qualified
  17542. identifier> or <local table name>, respectively, of the
  17543. table in which the table constraint is contained.
  17544. 2) If the violated integrity constraint is an assertion and
  17545. if only one table referenced by the assertion has been
  17546. modified as a result of executing the SQL-statement,
  17547. then the values of CATALOG_NAME, SCHEMA_NAME, and TABLE_
  17548. NAME are the <catalog name>, the <unqualified schema
  17549. name> of the <schema name>, and the <qualified iden-
  17550. tifier> or <local table name>, respectively, of the
  17551. modified table.
  17552. 3) Otherwise, the values of CATALOG_NAME, SCHEMA_NAME, and
  17553. TABLE_NAME are <space>s.
  17554. If TABLE_NAME identifies a declared local temporary table,
  17555. then CATALOG_NAME is <space>s and SCHEMA_NAME is "MODULE".
  17556. g) If the value of RETURNED_SQLSTATE corresponds to syntax error
  17557. or access rule violation, syntax error or access rule viola-
  17558. tion in dynamic SQL statement, or syntax error or access rule
  17559. violation in direct SQL statement, then:
  17560. i) The values of CATALOG_NAME, SCHEMA_NAME, and TABLE_NAME
  17561. 486 Database Language SQL
  17562. X3H2-92-154/DBL CBR-002
  17563. 18.1 <get diagnostics statement>
  17564. are the <catalog name>, the <unqualified schema name> of
  17565. the <schema name> of the schema that contains the table
  17566. that caused the syntax error or the access rule viola-
  17567. tion and the <qualified identifier> or <local table name>,
  17568. respectively. If TABLE_NAME refers to a declared local tem-
  17569. porary table, then CATALOG_NAME is <space>s and SCHEMA_NAME
  17570. contains "MODULE".
  17571. ii) If the syntax error or the access rule violation was for
  17572. an inaccessible column, then the value of COLUMN_NAME is
  17573. the <column name> of that column. Otherwise, the value of
  17574. COLUMN_NAME is <space>s.
  17575. h) If the value of RETURNED_SQLSTATE corresponds to invalid
  17576. cursor state, then the value of CURSOR_NAME is the name of
  17577. the cursor that is in the invalid state.
  17578. i) If the value of RETURNED_SQLSTATE corresponds to with check
  17579. option violation, then the values of CATALOG_NAME, SCHEMA_
  17580. NAME, and TABLE_NAME are the <catalog name> and the <un-
  17581. qualified schema name> of the <schema name> of the schema
  17582. that contains the view that caused the violation of the WITH
  17583. CHECK OPTION, and the <qualified identifier> of that view,
  17584. respectively.
  17585. j) If the value of RETURNED_SQLSTATE does not correspond to
  17586. syntax error or access rule violation, syntax error or access
  17587. rule violation in dynamic SQL statement, or syntax error or
  17588. access rule violation in direct SQL statement, then:
  17589. i) If the values of CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, and
  17590. COLUMN_NAME identify a column for which no privileges are
  17591. granted to the current <authorization identifier>, then the
  17592. value of COLUMN_NAME is replaced by a zero-length string.
  17593. ii) If the values of CATALOG_NAME, SCHEMA_NAME, and TABLE_NAME
  17594. identify a table for which no privileges are granted to
  17595. the current <authorization identifier>, then the values of
  17596. CATALOG_NAME, SCHEMA_NAME, and TABLE_NAME are replaced by a
  17597. zero-length string.
  17598. iii) If the values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA,
  17599. and CONSTRAINT_NAME identify a <table constraint> for
  17600. some table T and if no privileges for T are granted to
  17601. the current <authorization identifier>, then the values of
  17602. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and CONSTRAINT_NAME
  17603. are replaced by a zero-length string.
  17604. iv) If the values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA,
  17605. and CONSTRAINT_NAME identify an assertion contained in some
  17606. schema S and if the owner of S is not the <authorization
  17607. identifier> of the current SQL-session, then the values of
  17608. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and CONSTRAINT_NAME
  17609. are replaced by a zero-length string.
  17610. Diagnostics management 487
  17611. X3H2-92-154/DBL CBR-002
  17612. 18.1 <get diagnostics statement>
  17613. k) The value of MESSAGE_TEXT is an implementation-defined char-
  17614. acter string.
  17615. Note: An implementation may set this to <space>s, to a zero-
  17616. length string, or to a character string describing the condi-
  17617. tion indicated by RETURNED_SQLSTATE.
  17618. l) The value of MESSAGE_LENGTH is the length in characters of
  17619. the character string value in MESSAGE_TEXT.
  17620. m) The value of MESSAGE_OCTET_LENGTH is the length in octets of
  17621. the character string value in MESSAGE_TEXT.
  17622. n) The values of CONNECTION_NAME and SERVER_NAME are
  17623. Case:
  17624. i) If COMMAND_FUNCTION or DYNAMIC_FUNCTION identifies an <SQL
  17625. connection statement>, then the explicit or implicit <con-
  17626. nection name> and the associated <SQL server specifica-
  17627. tion>, respectively, referenced by the <SQL connection
  17628. statement>.
  17629. ii) Otherwise, the explicit or implicit <connection name> and
  17630. the associated <SQL-server name>, respectively, corre-
  17631. sponding to the most-recently executed explicit or implicit
  17632. <connect statement> or <set connection statement>.
  17633. o) The values of character string items where not otherwise
  17634. specified by the preceding rules are set to a zero-length
  17635. string.
  17636. Note: There are no numeric items that are not set by these
  17637. rules.
  17638. Leveling Rules
  17639. 1) The following restrictions apply for Intermediate SQL;
  17640. None.
  17641. 2) The following restrictions apply for Entry SQL;
  17642. a) Conforming Entry SQL language shall not contain any <get
  17643. diagnostics statement>.
  17644. 488 Database Language SQL
  17645. X3H2-92-154/DBL CBR-002
  17646. 19 Embedded SQL
  17647. 19.1 <embedded SQL host program>
  17648. Function
  17649. Specify an <embedded SQL host program>.
  17650. Format
  17651. <embedded SQL host program> ::=
  17652. <embedded SQL Ada program>
  17653. | <embedded SQL C program>
  17654. | <embedded SQL COBOL program>
  17655. | <embedded SQL Fortran program>
  17656. | <embedded SQL MUMPS program>
  17657. | <embedded SQL Pascal program>
  17658. | <embedded SQL PL/I program>
  17659. <embedded SQL statement> ::=
  17660. <SQL prefix>
  17661. <statement or declaration>
  17662. [ <SQL terminator> ]
  17663. <statement or declaration> ::=
  17664. <declare cursor>
  17665. | <dynamic declare cursor>
  17666. | <temporary table declaration>
  17667. | <embedded exception declaration>
  17668. | <SQL procedure statement>
  17669. <SQL prefix> ::=
  17670. EXEC SQL
  17671. | <ampersand>SQL<left paren>
  17672. <SQL terminator> ::=
  17673. END-EXEC
  17674. | <semicolon>
  17675. | <right paren>
  17676. <embedded SQL declare section> ::=
  17677. <embedded SQL begin declare>
  17678. [ <embedded character set declaration> ]
  17679. [ <host variable definition>... ]
  17680. <embedded SQL end declare>
  17681. | <embedded SQL MUMPS declare>
  17682. <embedded character set declaration> ::=
  17683. Embedded SQL 489
  17684. X3H2-92-154/DBL CBR-002
  17685. 19.1 <embedded SQL host program>
  17686. SQL NAMES ARE <character set specification>
  17687. <embedded SQL begin declare> ::=
  17688. <SQL prefix> BEGIN DECLARE SECTION [ <SQL terminator> ]
  17689. <embedded SQL end declare> ::=
  17690. <SQL prefix> END DECLARE SECTION [ <SQL terminator> ]
  17691. <embedded SQL MUMPS declare> ::=
  17692. <SQL prefix>
  17693. BEGIN DECLARE SECTION
  17694. [ <embedded character set declaration> ]
  17695. [ <host variable definition>... ]
  17696. END DECLARE SECTION
  17697. <SQL terminator>
  17698. <host variable definition> ::=
  17699. <Ada variable definition>
  17700. | <C variable definition>
  17701. | <COBOL variable definition>
  17702. | <Fortran variable definition>
  17703. | <MUMPS variable definition>
  17704. | <Pascal variable definition>
  17705. | <PL/I variable definition>
  17706. <embedded variable name> ::=
  17707. <colon><host identifier>
  17708. <host identifier> ::=
  17709. <Ada host identifier>
  17710. | <C host identifier>
  17711. | <COBOL host identifier>
  17712. | <Fortran host identifier>
  17713. | <MUMPS host identifier>
  17714. | <Pascal host identifier>
  17715. | <PL/I host identifier>
  17716. Syntax Rules
  17717. 1) An <embedded SQL host program> is a compilation unit that con-
  17718. sists of programming language text and SQL text. The programming
  17719. language text shall conform to the requirements of a specific
  17720. standard programming language. The SQL text shall consist of
  17721. one or more <embedded SQL statement>s and, optionally, one
  17722. or more <embedded SQL declare section>s, as defined in this
  17723. International Standard.
  17724. Note: Compilation unit is defined in Subclause 4.16, "Modules".
  17725. 2) Case:
  17726. a) An <embedded SQL statement> or <embedded SQL MUMPS declare>
  17727. that is contained in an <embedded SQL MUMPS program> shall
  17728. 490 Database Language SQL
  17729. X3H2-92-154/DBL CBR-002
  17730. 19.1 <embedded SQL host program>
  17731. contain an <SQL prefix> that is "<ampersand>SQL<left paren>".
  17732. There shall be no <separator> between the <ampersand> and
  17733. "SQL" nor between "SQL" and the <left paren>.
  17734. b) An <embedded SQL statement>, <embedded SQL begin declare>,
  17735. or <embedded SQL end declare> that is not contained in an
  17736. <embedded SQL MUMPS program> shall contain an <SQL prefix>
  17737. that is "EXEC SQL".
  17738. 3) Case:
  17739. a) An <embedded SQL statement>, <embedded SQL begin declare>,
  17740. or <embedded SQL end declare> contained in an <embedded SQL
  17741. COBOL program> shall contain an <SQL terminator> that is
  17742. END-EXEC.
  17743. b) An <embedded SQL statement>, <embedded SQL begin declare>,
  17744. or <embedded SQL end declare> contained in an <embedded SQL
  17745. Fortran program> shall not contain an <SQL terminator>.
  17746. c) An <embedded SQL statement>, <embedded SQL begin declare>,
  17747. or <embedded SQL end declare> contained in an <embedded SQL
  17748. Ada program>, <embedded SQL C program>, <embedded SQL Pascal
  17749. program>, or <embedded SQL PL/I program> shall contain an
  17750. <SQL terminator> that is a <semicolon>.
  17751. d) An <embedded SQL statement> or <embedded SQL MUMPS declare>
  17752. that is contained in an <embedded SQL MUMPS program> shall
  17753. contain an <SQL terminator> that is a <right paren>.
  17754. 4) Case:
  17755. a) An <embedded SQL declare section> that is contained in an
  17756. <embedded SQL MUMPS program> shall be an <embedded SQL MUMPS
  17757. declare>.
  17758. b) An <embedded SQL declare section> that is not contained in
  17759. an <embedded SQL MUMPS program> shall not be an <embedded SQL
  17760. MUMPS declare>.
  17761. Note: There is no restriction on the number of <embedded SQL
  17762. declare section>s that may be contained in an <embedded SQL host
  17763. program>.
  17764. 5) The <token>s comprising an <SQL prefix>, <embedded SQL begin
  17765. declare>, or <embedded SQL end declare> shall be separated
  17766. by <space> characters and shall be specified on one line.
  17767. Otherwise, the rules for the continuation of lines and tokens
  17768. from one line to the next and for the placement of host language
  17769. comments are those of the programming language of the containing
  17770. <embedded SQL host program>.
  17771. Embedded SQL 491
  17772. X3H2-92-154/DBL CBR-002
  17773. 19.1 <embedded SQL host program>
  17774. 6) If an <embedded character set declaration> is not specified,
  17775. then an <embedded character set declaration> that specifies
  17776. an implementation-defined character set that contains at least
  17777. every character that is in <SQL language character> is implicit.
  17778. 7) A <temporary table declaration> that is contained in an <em-
  17779. bedded SQL host program> shall precede in the text of that
  17780. <embedded SQL host program> any SQL-statement or <declare cur-
  17781. sor> that references the <table name> of the <temporary table
  17782. declaration>.
  17783. 8) A <declare cursor> that is contained in an <embedded SQL host
  17784. program> shall precede in the text of that <embedded SQL host
  17785. program> any SQL-statement that references the <cursor name> of
  17786. the <declare cursor>.
  17787. 9) A <dynamic declare cursor> that is contained in an <embedded
  17788. SQL host program> shall precede in the text of that <embedded
  17789. SQL host program> any SQL-statement that references the <cursor
  17790. name> of the <dynamic declare cursor>.
  17791. 10)Any <host identifier> that is contained in an <embedded SQL
  17792. statement> in an <embedded SQL host program> shall be defined
  17793. in exactly one <host variable definition> contained in that <em-
  17794. bedded SQL host program>. In programming languages that support
  17795. <host variable definition>s in subprograms, two <host variable
  17796. definition>s with different, non-overlapping scope in the host
  17797. language are to be regarded as defining different host vari-
  17798. ables, even if they specify the same variable name. That <host
  17799. variable definition> shall appear in the text of the <embedded
  17800. SQL host program> prior to any <embedded SQL statement> that
  17801. references the <host identifier>. The <host variable definition>
  17802. shall be such that a host language reference to the <host iden-
  17803. tifier> is valid at every <embedded SQL statement> that contains
  17804. the <host identifier>.
  17805. 11)A <host variable definition> defines the host language data type
  17806. of the <host identifier>. For every such host language data type
  17807. an equivalent SQL <data type> is specified in Subclause 19.3,
  17808. "<embedded SQL Ada program>", Subclause 19.4, "<embedded
  17809. SQL C program>", Subclause 19.5, "<embedded SQL COBOL pro-
  17810. gram>", Subclause 19.6, "<embedded SQL Fortran program>",
  17811. Subclause 19.7, "<embedded SQL MUMPS program>", Subclause 19.8,
  17812. "<embedded SQL Pascal program>", and Subclause 19.9, "<embedded
  17813. SQL PL/I program>".
  17814. 12)If one or more <host variable definition>s that specify SQLSTATE
  17815. or SQLCODE appear in an <embedded SQL host program>, then the
  17816. <host variable definition>s shall be such that a host language
  17817. reference to SQLSTATE or SQLCODE, respectively, is valid at
  17818. every <embedded SQL statement>, including <embedded SQL state-
  17819. ment>s that appear in any subprograms contained in that <embed-
  17820. ded SQL host program>. No <embedded SQL statement> shall precede
  17821. 492 Database Language SQL
  17822. X3H2-92-154/DBL CBR-002
  17823. 19.1 <embedded SQL host program>
  17824. any of its applicable status code definitions in the text of the
  17825. main program or subprograms that comprise the <embedded SQL host
  17826. program>.
  17827. 13)Given an <embedded SQL host program> H, there is an implied
  17828. standard-conforming SQL <module> M and an implied standard-
  17829. conforming host program P derived from H. The derivation of the
  17830. implied program P and the implied <module> M of an <embedded SQL
  17831. host program> H effectively precedes the processing of any host
  17832. language program text manipulation commands such as inclusion or
  17833. copying of text.
  17834. Given an <embedded SQL host program> H with an implied <module>
  17835. M and an implied program P defined as above:
  17836. a) The implied <module> M of H shall be a standard-conforming
  17837. SQL <module>.
  17838. b) If H is an <embedded SQL Ada program>, an <embedded SQL C
  17839. program>, an <embedded SQL COBOL program>, an <embedded SQL
  17840. Fortran program>, an <embedded SQL MUMPS program>, an <embed-
  17841. ded SQL Pascal program>, or an <embedded SQL PL/I program>,
  17842. then the implied program P shall be a standard-conforming
  17843. Ada program, a standard-conforming C program, a standard-
  17844. conforming COBOL program, a standard-conforming Fortran
  17845. program, a standard-conforming MUMPS program, a standard-
  17846. conforming Pascal program, or standard-conforming PL/I pro-
  17847. gram, respectively.
  17848. 14)M is derived from H as follows:
  17849. a) M contains a <module name clause> whose <module name> is
  17850. either implementation-dependent or is omitted.
  17851. b) M contains a <module character set specification> that is
  17852. identical to the explicit or implicit <embedded character set
  17853. declaration> with the keyword "SQL" removed.
  17854. c) M contains a <language clause> that specifies either ADA,
  17855. C, COBOL, FORTRAN, MUMPS, PASCAL, or PLI, where H is re-
  17856. spectively an <embedded SQL Ada program>, an <embedded SQL C
  17857. program>, an <embedded SQL COBOL program>, an <embedded SQL
  17858. Fortran program>, an <embedded SQL MUMPS program>, an <embed-
  17859. ded SQL Pascal program>, or an <embedded SQL PL/I program>.
  17860. d) M contains a <module authorization clause> that specifies
  17861. SCHEMA <schema name>, where the value of <schema name> is
  17862. implementation-dependent.
  17863. e) For every <declare cursor> EC contained in H, M contains one
  17864. <declare cursor> PC and one <procedure> PS that contains an
  17865. <open statement> that references PC. The <procedure name> of
  17866. PS is implementation-dependent. PC is a copy of EC in which
  17867. each distinct <embedded variable name> has been replaced with
  17868. Embedded SQL 493
  17869. X3H2-92-154/DBL CBR-002
  17870. 19.1 <embedded SQL host program>
  17871. a distinct implementation-dependent <parameter name>. PS con-
  17872. tains a <parameter declaration> for each <parameter name>
  17873. contained in PC. The <parameter declaration> that corresponds
  17874. to a given <embedded variable name> V that is contained in EC
  17875. specifies the <parameter name> with which V was replaced, and
  17876. the SQL data type that corresponds to the host language data
  17877. type of V. If H contains a <host variable definition> that
  17878. specifies SQLSTATE or SQLCODE, then PS contains a <parameter
  17879. declaration> that specifies SQLSTATE or SQLCODE, respec-
  17880. tively. If H contains neither a <host variable definition>
  17881. that specifies SQLSTATE nor a <host variable definition> that
  17882. specifies SQLCODE, then PS contains a <parameter declaration>
  17883. that specifies SQLCODE. The order of <parameter declaration>s
  17884. in PS is implementation-dependent.
  17885. f) For every <dynamic declare cursor> EC in H, M contains one
  17886. <dynamic declare cursor> PC that is a copy of EC.
  17887. g) M contains one <temporary table declaration> for each <tempo-
  17888. rary table declaration> contained in H. Each <temporary table
  17889. declaration> of M is a copy of the corresponding <temporary
  17890. table declaration> of H.
  17891. h) M contains a <procedure> for each <SQL procedure statement>
  17892. contained in H. The <procedure> PS of M corresponding with an
  17893. <SQL procedure statement> ES of H is defined as follows:
  17894. Case:
  17895. i) If ES is not an <open statement>, then:
  17896. 1) The <procedure name> of PS is implementation-dependent.
  17897. 2) The <SQL procedure statement> of PS is a copy of ES in
  17898. which each distinct <embedded variable name> has been
  17899. replaced with the same distinct implementation-dependent
  17900. <parameter name>.
  17901. 3) PS contains a <parameter declaration> for each dis-
  17902. tinct <parameter name> contained in the <SQL procedure
  17903. statement> of PS.
  17904. 4) The <parameter declaration> corresponding to a given
  17905. <embedded variable name> V that is contained in ES spec-
  17906. ifies the <parameter name> with which V was replaced
  17907. and the SQL <data type> that corresponds to the host
  17908. language data type of V.
  17909. 5) Whether one <procedure> of M can correspond to more than
  17910. one <SQL procedure statement> of H is implementation-
  17911. dependent.
  17912. 494 Database Language SQL
  17913. X3H2-92-154/DBL CBR-002
  17914. 19.1 <embedded SQL host program>
  17915. 6) If H contains a <host variable definition> that spec-
  17916. ifies SQLSTATE or SQLCODE, then PS contains a <param-
  17917. eter declaration> that specifies SQLSTATE or SQLCODE,
  17918. respectively. If H contains neither a <host variable
  17919. definition> that specifies SQLSTATE nor a <host variable
  17920. definition> that specifies SQLCODE, then PS contains a
  17921. <parameter declaration> that specifies SQLCODE.
  17922. 7) The order of the <parameter declaration>s is implementation-
  17923. dependent.
  17924. ii) If ES is an <open statement>, then:
  17925. 1) Let EC be the <declare cursor> in H referenced by ES.
  17926. 2) PS is the procedure in M that contains an <open state-
  17927. ment> that references the <declare cursor> in M corre-
  17928. sponding to EC.
  17929. 15)P is derived from H as follows:
  17930. a) Each <embedded SQL begin declare>, <embedded SQL end de-
  17931. clare>, and <embedded character set declaration> has been
  17932. deleted. If the embedded host language is MUMPS, then each
  17933. <embedded SQL MUMPS declare> has been deleted.
  17934. b) Each <host variable definition> in an <embedded SQL declare
  17935. section> has been replaced by a valid data definition in the
  17936. target host language according to the Syntax Rules specified
  17937. in an <embedded SQL Ada program>, <embedded SQL C program>,
  17938. <embedded SQL COBOL program>, <embedded SQL Fortran pro-
  17939. gram>, <embedded SQL Pascal program>, or an <embedded SQL
  17940. PL/I program> clause.
  17941. c) Each <embedded SQL statement> that contains a <declare
  17942. cursor>, a <dynamic declare cursor>, or a <temporary ta-
  17943. ble declaration> has been deleted, and every <embedded SQL
  17944. statement> that contains an <embedded exception declara-
  17945. tion> has been replaced with statements of the host language
  17946. that will have the effect specified by the General Rules of
  17947. Subclause 19.2, "<embedded exception declaration>".
  17948. d) Each <embedded SQL statement> that contains an <SQL procedure
  17949. statement> has been replaced by host language statements that
  17950. perform the following actions:
  17951. i) A host language procedure or subroutine call of the <proce-
  17952. dure> of the implied <module> M of H that corresponds with
  17953. the <SQL procedure statement>.
  17954. If the <SQL procedure statement> is not an <open state-
  17955. ment>, then the arguments of the call include each distinct
  17956. <host identifier> contained in the <SQL procedure state-
  17957. ment> together with the SQLCODE <host identifier>, or the
  17958. Embedded SQL 495
  17959. X3H2-92-154/DBL CBR-002
  17960. 19.1 <embedded SQL host program>
  17961. SQLSTATE <host identifier>, or both. If H contains nei-
  17962. ther a <host variable definition> that specifies SQLSTATE
  17963. nor a <host variable definition> that specifies SQLCODE,
  17964. then the arguments of the call include SQLCODE. If the
  17965. <SQL procedure statement> is an <open statement>, then the
  17966. arguments of the call include each distinct <host iden-
  17967. tifier> contained in the corresponding <declare cursor>
  17968. of H together with the SQLCODE <host identifier>, or the
  17969. SQLSTATE <host identifier>, or both. If H contains neither
  17970. a <host variable definition> that specifies SQLSTATE nor a
  17971. <host variable definition> that specifies SQLCODE, then the
  17972. arguments of the call include SQLCODE.
  17973. The order of the arguments in the call corresponds with the
  17974. order of the corresponding <parameter declaration>s in the
  17975. corresponding <procedure>.
  17976. Note: In an <embedded SQL Fortran program>, the "SQLCODE"
  17977. variable is abbreviated to "SQLCOD" and the "SQLSTATE"
  17978. variable may be abbreviated to "SQLSTA". See the Syntax
  17979. Rules of Subclause 19.6, "<embedded SQL Fortran program>".
  17980. ii) Exception actions, as specified in Subclause 19.2, "<embed-
  17981. ded exception declaration>".
  17982. Note: SQLSTATE is the preferred status parameter. The SQLCODE sta-
  17983. tus parameter is a deprecated feature that is supported for compat-
  17984. ibility with earlier versions of this International Standard. See
  17985. Annex D, "Deprecated features".
  17986. Access Rules
  17987. None.
  17988. General Rules
  17989. 1) The interpretation of an <embedded SQL host program> H is de-
  17990. fined to be equivalent to the interpretation of the implied
  17991. program P of H and the implied <module> M of H.
  17992. Leveling Rules
  17993. 1) The following restrictions apply for Intermediate SQL:
  17994. None.
  17995. 2) The following restrictions apply for Entry SQL in addition to
  17996. any Intermediate SQL restrictions:
  17997. a) An <embedded SQL declare section> shall not contain an <em-
  17998. bedded character set declaration>.
  17999. b) No two <host variable definition>s shall specify the same
  18000. variable name.
  18001. 496 Database Language SQL
  18002. X3H2-92-154/DBL CBR-002
  18003. 19.2 <embedded exception declaration>
  18004. 19.2 <embedded exception declaration>
  18005. Function
  18006. Specify the action to be taken when an SQL-statement causes a spe-
  18007. cific class of condition to be raised.
  18008. Format
  18009. <embedded exception declaration> ::=
  18010. WHENEVER <condition> <condition action>
  18011. <condition> ::=
  18012. SQLERROR | NOT FOUND
  18013. <condition action> ::=
  18014. CONTINUE | <go to>
  18015. <go to> ::=
  18016. { GOTO | GO TO } <goto target>
  18017. <goto target> ::=
  18018. <host label identifier>
  18019. | <unsigned integer>
  18020. | <host PL/I label variable>
  18021. <host label identifier> ::= !!See the Syntax Rules.
  18022. <host PL/I label variable> ::= !!See the Syntax Rules.
  18023. Syntax Rules
  18024. 1) An <embedded exception declaration> contained in an <embed-
  18025. ded SQL host program> applies to an <SQL procedure statement>
  18026. contained in that <embedded SQL host program> if and only if
  18027. the <SQL procedure statement> appears after the <embedded ex-
  18028. ception declaration> in the text sequence of the <embedded SQL
  18029. host program> and no other <embedded exception declaration> that
  18030. specifies the same <condition> appears between the <embedded
  18031. exception declaration> and the <SQL procedure statement> in the
  18032. text sequence of the <embedded SQL host program>.
  18033. 2) If an <embedded exception declaration> specifies a <go to>,
  18034. then the <host label identifier>, <host PL/I label variable>, or
  18035. <unsigned integer> of the <go to> shall be such that a host lan-
  18036. guage GO TO statement specifying that <host label identifier>,
  18037. <host PL/I label variable>, or <unsigned integer> is valid at
  18038. every <SQL procedure statement> to which the <embedded exception
  18039. declaration> applies.
  18040. Embedded SQL 497
  18041. X3H2-92-154/DBL CBR-002
  18042. 19.2 <embedded exception declaration>
  18043. Note:
  18044. - If an <embedded exception declaration> is contained in an
  18045. <embedded SQL Ada program>, then the <goto target> of a <go
  18046. to> should specify a <host label identifier> that is a label_
  18047. name in the containing <embedded SQL Ada program>.
  18048. - If an <embedded exception declaration> is contained in an
  18049. <embedded SQL C program>, then the <goto target> of a <go to>
  18050. should specify a <host label identifier> that is a label in
  18051. the containing <embedded SQL C program>.
  18052. - If an <embedded exception declaration> is contained in an
  18053. <embedded SQL COBOL program>, then the <goto target> of a
  18054. <go to> should specify a <host label identifier> that is a
  18055. section-name or an unqualified paragraph-name in the contain-
  18056. ing <embedded SQL COBOL program>.
  18057. - If an <embedded exception declaration> is contained in an
  18058. <embedded SQL Fortran program>, then the <goto target> of a
  18059. <go to> should be an <unsigned integer> that is the statement
  18060. label of an executable statement that appears in the same
  18061. program unit as the <go to>.
  18062. - If an <embedded exception declaration> is contained in an
  18063. <embedded SQL MUMPS program>, then the <goto target> of a <go
  18064. to> should be a gotoargument that is the statement label of
  18065. an executable statement that appears in the same <embedded
  18066. SQL MUMPS program>.
  18067. - If an <embedded exception declaration> is contained in an
  18068. <embedded SQL Pascal program>, then the <goto target> of a
  18069. <go to> should be an <unsigned integer> that is a label.
  18070. - If an <embedded exception declaration> is contained in an
  18071. <embedded SQL PL/I program>, then the <goto target> of a
  18072. <go to> should specify either a <host label identifier> or a
  18073. <host PL/I label variable>.
  18074. Case:
  18075. o If <host label identifier> is specified, then the <host
  18076. label identifier> should be a label constant in the con-
  18077. taining <embedded SQL PL/I program>.
  18078. o If <host PL/I label variable> is specified, then the <host
  18079. PL/I label variable> should be a PL/I label variable de-
  18080. clared in the containing <embedded SQL PL/I program>.
  18081. Access Rules
  18082. None.
  18083. 498 Database Language SQL
  18084. X3H2-92-154/DBL CBR-002
  18085. 19.2 <embedded exception declaration>
  18086. General Rules
  18087. 1) Immediately after the execution of an <SQL procedure statement>
  18088. in an <embedded SQL host program>:
  18089. Case:
  18090. a) If the value of the status variable(s) indicates the comple-
  18091. tion condition no data and the <embedded SQL host program>
  18092. contains an <embedded exception declaration> that applies to
  18093. the <SQL procedure statement> and whose <condition> is NOT
  18094. FOUND and whose <condition action> is a <go to>, then a GO
  18095. TO statement of the host language is performed, specifying
  18096. the <host label identifier>, <host PL/I label variable>, or
  18097. <unsigned integer> of the <go to>.
  18098. b) If the value of the status variable(s) indicates an excep-
  18099. tion condition and the <embedded SQL host program> contains
  18100. an <embedded exception declaration> that applies to the <SQL
  18101. procedure statement> and whose <condition> is SQLERROR and
  18102. whose <condition action> is a <go to>, then a GO TO state-
  18103. ment of the host language is performed, specifying the <host
  18104. label identifier>, <host PL/I label variable>, or <unsigned
  18105. integer> of the <go to>.
  18106. c) If the <embedded SQL host program> contains no <embedded
  18107. exception declaration> that applies to the <SQL procedure
  18108. statement>, or if it contains an <embedded exception declara-
  18109. tion> that applies to the <SQL procedure statement> and that
  18110. specifies CONTINUE, then no further action is performed for
  18111. the <SQL procedure statement>.
  18112. Leveling Rules
  18113. 1) The following restrictions apply for Intermediate SQL:
  18114. None.
  18115. 2) The following restrictions apply for Entry SQL in addition to
  18116. any Intermediate SQL restrictions:
  18117. None.
  18118. Embedded SQL 499
  18119. X3H2-92-154/DBL CBR-002
  18120. 19.3 <embedded SQL Ada program>
  18121. 19.3 <embedded SQL Ada program>
  18122. Function
  18123. Specify an <embedded SQL Ada program>.
  18124. Format
  18125. <embedded SQL Ada program> ::= !! See the Syntax Rules.
  18126. <Ada variable definition> ::=
  18127. <Ada host identifier> [ { <comma> <Ada host identifier> }... ] :
  18128. <Ada type specification> [ <Ada initial value> ]
  18129. <Ada initial value> ::=
  18130. <Ada assignment operator> <character representation>...
  18131. <Ada assignment operator> ::= <colon><equals operator>
  18132. <Ada host identifier> ::= !! See the Syntax Rules.
  18133. <Ada type specification> ::=
  18134. <Ada qualified type specification>
  18135. | <Ada unqualified type specification>
  18136. <Ada qualified type specification> ::=
  18137. SQL_STANDARD.CHAR [ CHARACTER SET [ IS ] <character set specification> ]
  18138. <left paren> 1 <double period> <length> <right paren>
  18139. | SQL_STANDARD.BIT <left paren> 1 <double period> <length> <right paren>
  18140. | SQL_STANDARD.SMALLINT
  18141. | SQL_STANDARD.INT
  18142. | SQL_STANDARD.REAL
  18143. | SQL_STANDARD.DOUBLE_PRECISION
  18144. | SQL_STANDARD.SQLCODE_TYPE
  18145. | SQL_STANDARD.SQLSTATE_TYPE
  18146. | SQL_STANDARD.INDICATOR_TYPE
  18147. <Ada unqualified type specification> ::=
  18148. CHAR <left paren> 1 <double period> <length> <right paren>
  18149. | BIT <left paren> 1 <double period> <length> <right paren>
  18150. | SMALLINT
  18151. | INT
  18152. | REAL
  18153. | DOUBLE_PRECISION
  18154. | SQLCODE_TYPE
  18155. | SQLSTATE_TYPE
  18156. | INDICATOR_TYPE
  18157. 500 Database Language SQL
  18158. X3H2-92-154/DBL CBR-002
  18159. 19.3 <embedded SQL Ada program>
  18160. Syntax Rules
  18161. 1) An <embedded SQL Ada program> is a compilation unit that con-
  18162. sists of Ada text and SQL text. The Ada text shall conform to
  18163. the Ada standard ISO/IEC 8652. The SQL text shall consist of one
  18164. or more <embedded SQL statement>s and, optionally, one or more
  18165. <embedded SQL declare section>s.
  18166. 2) An <embedded SQL statement> may be specified wherever an Ada
  18167. statement may be specified. An <embedded SQL statement> may be
  18168. prefixed by an Ada label.
  18169. 3) An <Ada host identifier> is any valid Ada identifier. An <Ada
  18170. host identifier> shall be contained in an <embedded SQL Ada
  18171. program>.
  18172. 4) An <Ada variable definition> defines one or more host variables.
  18173. 5) An <Ada variable definition> shall be modified as follows before
  18174. it is placed into the program derived from the <embedded SQL Ada
  18175. program> (see the Syntax Rules of Subclause 19.1, "<embedded SQL
  18176. host program>"):
  18177. a) Any optional CHARACTER SET specification shall be removed
  18178. from an <Ada qualified type specification>.
  18179. b) The <length> specified in a CHAR declaration of any <Ada
  18180. qualified type specification> that contains a CHARACTER SET
  18181. specification shall be replaced by a length equal to the
  18182. length in octets of PN, where PN is the <Ada host identifier>
  18183. specified in the containing <Ada variable definition>.
  18184. The modified <Ada variable definition> shall be a valid Ada
  18185. object-declaration in the program derived from the <embedded SQL
  18186. Ada program>.
  18187. 6) An <Ada variable definition> shall be specified within the scope
  18188. of Ada with and use clauses that specify the following:
  18189. with SQL_STANDARD;
  18190. use SQL_STANDARD;
  18191. use SQL_STANDARD.CHARACTER_SET;
  18192. 7) The <character representation> sequence in an <Ada initial
  18193. value> specifies an initial value to be assigned to the Ada
  18194. variable. It shall be a valid Ada specification of an initial
  18195. value.
  18196. 8) CHAR describes a character string variable whose equivalent SQL
  18197. data type is CHARACTER with the same length and character set
  18198. specified by <character set specification>. If <character set
  18199. specification> is not specified, then an implementation-defined
  18200. <character set specification> is implicit.
  18201. Embedded SQL 501
  18202. X3H2-92-154/DBL CBR-002
  18203. 19.3 <embedded SQL Ada program>
  18204. 9) BIT describes a bit string variable. The equivalent SQL data
  18205. type is BIT with the same length.
  18206. 10)INT and SMALLINT describe exact numeric variables. The equiv-
  18207. alent SQL data types are INTEGER and SMALLINT, respectively.
  18208. 11)REAL and DOUBLE_PRECISION describe approximate numeric vari-
  18209. ables. The equivalent SQL data types are REAL and DOUBLE
  18210. PRECISION, respectively.
  18211. 12)SQLCODE_TYPE describes an exact numeric variable whose preci-
  18212. sion is the implementation-defined precision defined for the
  18213. SQLCODE parameter. SQLSTATE_TYPE describes a character string
  18214. variable whose length is the length of the SQLSTATE parameter
  18215. (five characters).
  18216. 13)INDICATOR_TYPE describes an exact numeric variable whose spe-
  18217. cific data type is any <exact numeric type> with a scale of 0.
  18218. 14)If an <embedded SQL Ada program> contains neither an <Ada
  18219. variable definition> that specifies SQLSTATE and that is de-
  18220. fined with an <Ada type specification> that specifies SQL_
  18221. STANDARD.CHAR or CHAR with <length> 5, nor an <Ada variable
  18222. definition> that specifies SQLCODE and that is defined with an
  18223. <Ada type specification> that specifies SQL_STANDARD.INTEGER or
  18224. INTEGER, then it is assumed that the <embedded SQL Ada program>
  18225. contains a variable named SQLCODE defined with a data type of
  18226. INTEGER.
  18227. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18228. status parameter is a deprecated feature that is supported
  18229. for compatibility with earlier versions of this International
  18230. Standard. See Annex D, "Deprecated features".
  18231. Access Rules
  18232. None.
  18233. General Rules
  18234. 1) See Subclause 19.1, "<embedded SQL host program>".
  18235. Leveling Rules
  18236. 1) The following restrictions apply for Intermediate SQL:
  18237. a) An <Ada variable definition> shall not specify a bit string
  18238. variable.
  18239. 502 Database Language SQL
  18240. X3H2-92-154/DBL CBR-002
  18241. 19.3 <embedded SQL Ada program>
  18242. 2) The following restrictions apply for Entry SQL in addition to
  18243. any Intermediate SQL restrictions:
  18244. a) An <Ada qualified type specification> shall not contain a
  18245. <character set specification>.
  18246. Embedded SQL 503
  18247. X3H2-92-154/DBL CBR-002
  18248. 19.4 <embedded SQL C program>
  18249. 19.4 <embedded SQL C program>
  18250. Function
  18251. Specify an <embedded SQL C program>.
  18252. Format
  18253. <embedded SQL C program> ::= !! See the Syntax Rules.
  18254. <C variable definition> ::=
  18255. [ <C storage class> ]
  18256. [ <C class modifier> ]
  18257. <C variable specification>
  18258. <semicolon>
  18259. <C variable specification> ::=
  18260. <C numeric variable>
  18261. | <C character variable>
  18262. | <C derived variable>
  18263. <C storage class> ::=
  18264. auto
  18265. | extern
  18266. | static
  18267. <C class modifier> ::= const | volatile
  18268. <C numeric variable> ::=
  18269. { long | short | float | double }
  18270. <C host identifier> [ <C initial value> ]
  18271. [ { <comma> <C host identifier> [ <C initial value> ] }... ]
  18272. <C character variable> ::=
  18273. char [ CHARACTER SET [ IS ] <character set specification> ]
  18274. <C host identifier> <C array specification> [ <C initial value> ]
  18275. [ { <comma> <C host identifier> <C array specification>
  18276. [ <C initial value> ] }... ]
  18277. <C array specification> ::=
  18278. <left bracket> <length> <right bracket>
  18279. <C host identifier> ::= !! See the Syntax Rules.
  18280. <C derived variable> ::=
  18281. <C VARCHAR variable>
  18282. | <C bit variable>
  18283. <C VARCHAR variable> ::=
  18284. VARCHAR [ CHARACTER SET [ IS ] <character set specification> ]
  18285. 504 Database Language SQL
  18286. X3H2-92-154/DBL CBR-002
  18287. 19.4 <embedded SQL C program>
  18288. <C host identifier> <C array specification> [ <C initial value> ]
  18289. [ { <comma> <C host identifier> <C array specification>
  18290. [ <C initial value> ] }... ]
  18291. <C bit variable> ::=
  18292. BIT <C host identifier> <C array specification> [ <C initial value> ]
  18293. [ { <comma> <C host identifier> <C array specification>
  18294. [ <C initial value> ] }... ]
  18295. <C initial value> ::=
  18296. <equals operator> <character representation>...
  18297. Syntax Rules
  18298. 1) An <embedded SQL C program> is a compilation unit that consists
  18299. of C text and SQL text. The C text shall conform to the C stan-
  18300. dard ISO/IEC 9899. The SQL text shall consist of one or more
  18301. <embedded SQL statement>s and, optionally, one or more <embedded
  18302. SQL declare section>s.
  18303. 2) An <embedded SQL statement> may be specified wherever a C
  18304. statement may be specified within a function block. If the C
  18305. statement could include a label prefix, then the <embedded SQL
  18306. statement> may be immediately preceded by a label prefix.
  18307. 3) A <C host identifier> is any valid C variable identifier. A
  18308. <C host identifier> shall be contained in an <embedded SQL C
  18309. program>.
  18310. 4) A <C variable definition> defines one or more host variables.
  18311. 5) A <C variable definition> shall be modified as follows before
  18312. it is placed into the program derived from the <embedded SQL C
  18313. program> (see the Syntax Rules of Subclause 19.1, "<embedded SQL
  18314. host program>"):
  18315. a) Any optional CHARACTER SET specification shall be removed
  18316. from a <C VARCHAR variable> or a <C character variable>.
  18317. b) The syntax "VARCHAR" shall be replaced by "char" in any <C
  18318. VARCHAR variable>.
  18319. c) The syntax "BIT" shall be replaced by "char" in any <C bit
  18320. variable>.
  18321. d) The <length> specified in a <C array specification> in any
  18322. <C bit variable> shall be replaced by a length equal to the
  18323. smallest integer not less than L/B, as defined in the Syntax
  18324. Rules of this Subclause.
  18325. Embedded SQL 505
  18326. X3H2-92-154/DBL CBR-002
  18327. 19.4 <embedded SQL C program>
  18328. e) The <length> specified in a <C array specification> in any
  18329. <C character variable> or in any <C VARCHAR variable> that
  18330. contained a CHARACTER SET specification shall be replaced by
  18331. a length equal to the length in octets of PN, where PN is the
  18332. <C host identifier> specified in the containing <C variable
  18333. definition>.
  18334. The modified <C variable definition> shall be a valid C data
  18335. declaration in the program derived from the <embedded SQL C
  18336. program>.
  18337. 6) The <character representation> sequence contained in a <C ini-
  18338. tial value> specifies an initial value to be assigned to the
  18339. C variable. It shall be a valid C specification of an initial
  18340. value.
  18341. 7) Except for array specifications for character strings and bit
  18342. strings, a <C variable definition> shall specify a scalar type.
  18343. 8) In a <C variable definition>, the words "VARCHAR", "CHARACTER",
  18344. "SET", "IS", "BIT", and "VARYING" may be specified in any com-
  18345. bination of upper case and lower case letters (see the Syntax
  18346. Rules of Subclause 5.2, "<token> and <separator>").
  18347. 9) In a <C character variable> or a <C VARCHAR variable>, if a
  18348. <character set specification> is specified, then the equivalent
  18349. SQL data type is CHARACTER or CHARACTER VARYING whose charac-
  18350. ter repertoire is the same as the repertoire specified by the
  18351. <character set specification>. If <character set specification>
  18352. is not specified, then an implementation-defined <character set
  18353. specification> is implicit.
  18354. 10)Each <C host identifier> specified in a <C character variable>
  18355. describes a fixed-length character string. The length is speci-
  18356. fied by the <length> of the <C array specification>. The value
  18357. in the host variable is terminated by a null character and the
  18358. position occupied by this null character is included in the
  18359. length of the host variable. The equivalent SQL data type is
  18360. CHARACTER whose length is one less than the <length> of the
  18361. <C array specification> and whose value does not include the
  18362. terminating null character. The <length> shall be greater than
  18363. 1.
  18364. 11)Each <C host identifier> specified in a <C VARCHAR variable>
  18365. describes a variable-length character string. The maximum length
  18366. is specified by the <length> of the <C array specification>.
  18367. The value in the host variable is terminated by a null character
  18368. and the position occupied by this null character is included in
  18369. the maximum length of the host variable. The equivalent SQL data
  18370. type is CHARACTER VARYING whose maximum length is 1 less than
  18371. the <length> of the <C array specification> and whose value does
  18372. not include the terminating null character. The <length> shall
  18373. be greater than 1.
  18374. 506 Database Language SQL
  18375. X3H2-92-154/DBL CBR-002
  18376. 19.4 <embedded SQL C program>
  18377. 12)Each <C host identifier> specified in a <C bit variable> de-
  18378. scribes a fixed-length bit string. The value in the host vari-
  18379. able has a BIT_LENGTH of <length>. Let B be the number of bits
  18380. in a C char and let L be the <length> of the <C array speci-
  18381. fication>. The length of an equivalent C char variable is the
  18382. smallest integer that is not less than the result of L/B. The
  18383. equivalent SQL data type is BIT whose length is L.
  18384. 13)"long" describes an exact numeric variable. The equivalent SQL
  18385. data type is INTEGER.
  18386. 14)"short" describes an exact numeric variable. The equivalent SQL
  18387. data type is SMALLINT.
  18388. 15)"float" describes an approximate numeric variable. The equiva-
  18389. lent SQL data type is REAL.
  18390. 16)"double" describes an approximate numeric variable. The equiva-
  18391. lent SQL data type is DOUBLE PRECISION.
  18392. 17)If an <embedded SQL C program> contains neither a <C variable
  18393. definition> that specifies SQLSTATE and that is defined with
  18394. a <C character variable> that specifies "char" with a <C array
  18395. specification> that is 6, nor a <C variable definition> that
  18396. specifies SQLCODE and that is defined with a <C numeric vari-
  18397. able> that specifies "long", then it is assumed that the <em-
  18398. bedded SQL C program> contains a variable named SQLCODE defined
  18399. with a data type of "long".
  18400. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18401. status parameter is a deprecated feature that is supported
  18402. for compatibility with earlier versions of this International
  18403. Standard. See Annex D, "Deprecated features".
  18404. Access Rules
  18405. None.
  18406. General Rules
  18407. 1) See Subclause 19.1, "<embedded SQL host program>".
  18408. Leveling Rules
  18409. 1) The following restrictions apply for Intermediate SQL:
  18410. a) A <C derived variable> shall not be a <C bit variable>.
  18411. 2) The following restrictions apply for Entry SQL in addition to
  18412. any Intermediate SQL restrictions:
  18413. a) A <C derived variable> shall not be a <C VARCHAR variable>.
  18414. b) A <C variable definition> shall not contain a <character set
  18415. specification>.
  18416. Embedded SQL 507
  18417. X3H2-92-154/DBL CBR-002
  18418. 19.5 <embedded SQL COBOL program>
  18419. 19.5 <embedded SQL COBOL program>
  18420. Function
  18421. Specify an <embedded SQL COBOL program>.
  18422. Format
  18423. <embedded SQL COBOL program> ::= !! See the Syntax Rules.
  18424. <COBOL variable definition> ::=
  18425. {01|77} <COBOL host identifier> <COBOL type specification>
  18426. [ <character representation>... ] <period>
  18427. <COBOL host identifier> ::= !! See the Syntax Rules.
  18428. <COBOL type specification> ::=
  18429. <COBOL character type>
  18430. | <COBOL bit type>
  18431. | <COBOL numeric type>
  18432. | <COBOL integer type>
  18433. <COBOL character type> ::=
  18434. [ CHARACTER SET [ IS ] <character set specification> ]
  18435. { PIC | PICTURE } [ IS ] { X [ <left paren> <length> <right paren> ] }...
  18436. <COBOL bit type> ::=
  18437. { PIC | PICTURE } [ IS ] { B [ <left paren> <length> <right paren> ] }...
  18438. <COBOL numeric type> ::=
  18439. { PIC | PICTURE } [ IS ]
  18440. S <COBOL nines specification>
  18441. [ USAGE [ IS ] ] DISPLAY SIGN LEADING SEPARATE
  18442. <COBOL nines specification> ::=
  18443. <COBOL nines> [ V [ <COBOL nines> ] ]
  18444. | V <COBOL nines>
  18445. <COBOL integer type> ::=
  18446. <COBOL computational integer>
  18447. | <COBOL binary integer>
  18448. <COBOL computational integer> ::=
  18449. { PIC | PICTURE } [ IS ] S<COBOL nines>
  18450. [ USAGE [ IS ] ] { COMP | COMPUTATIONAL }
  18451. <COBOL binary integer> ::=
  18452. { PIC | PICTURE } [ IS ] S<COBOL nines>
  18453. [ USAGE [ IS ] ] BINARY
  18454. <COBOL nines> ::= { 9 [ <left paren> <length> <right paren> ] }...
  18455. 508 Database Language SQL
  18456. X3H2-92-154/DBL CBR-002
  18457. 19.5 <embedded SQL COBOL program>
  18458. Syntax Rules
  18459. 1) An <embedded SQL COBOL program> is a compilation unit that con-
  18460. sists of COBOL text and SQL text. The COBOL text shall conform
  18461. to the COBOL standard ISO 1989. The SQL text shall consist of
  18462. one or more <embedded SQL statement>s and, optionally, one or
  18463. more <embedded SQL declare section>s.
  18464. 2) An <embedded SQL statement> in an <embedded SQL COBOL program>
  18465. may be specified wherever a COBOL statement may be specified
  18466. in the Procedure Division of the <embedded SQL COBOL pro-
  18467. gram>. If the COBOL statement could be immediately preceded
  18468. by a paragraph-name, then the <embedded SQL statement> may be
  18469. immediately preceded by a paragraph-name.
  18470. 3) A <COBOL host identifier> is any valid COBOL data-name. A <COBOL
  18471. host identifier> shall be contained in an <embedded SQL COBOL
  18472. program>.
  18473. 4) A <COBOL variable definition> is a restricted form of COBOL data
  18474. description entry that defines a host variable.
  18475. 5) A <COBOL variable definition> shall be modified as follows be-
  18476. fore it is placed into the program derived from the <embedded
  18477. SQL COBOL program> (see the Syntax Rules of Subclause 19.1,
  18478. "<embedded SQL host program>".
  18479. a) Any optional CHARACTER SET specification shall be removed
  18480. from a <COBOL character type>.
  18481. b) The syntax "B" shall be replaced by "X" in any <COBOL bit
  18482. type>.
  18483. c) The <length> specified in any <COBOL bit type> shall be re-
  18484. placed by a length equal to the smallest integer not less
  18485. than L/B, as defined in the Syntax Rules of this Subclause.
  18486. d) The <length> specified in any <COBOL character type> that
  18487. contained a CHARACTER SET specification shall be replaced by
  18488. a length equal to the length in octets of PN, where PN is the
  18489. <COBOL host identifier> specified in the containing <COBOL
  18490. variable definition>.
  18491. The modified <COBOL variable definition> shall be a valid data
  18492. description entry in the Data Division of the program derived
  18493. from the <embedded SQL COBOL program>.
  18494. 6) The optional <character representation> sequence in a <COBOL
  18495. variable definition> may specify a VALUE clause. Whether other
  18496. clauses may be specified is implementation-defined. The <char-
  18497. acter representation> sequence shall be such that the <COBOL
  18498. variable definition> is a valid COBOL data description entry.
  18499. Embedded SQL 509
  18500. X3H2-92-154/DBL CBR-002
  18501. 19.5 <embedded SQL COBOL program>
  18502. 7) A <COBOL character type> describes a character string vari-
  18503. able whose equivalent SQL data type is CHARACTER with the same
  18504. length and character set specified by <character set specifi-
  18505. cation>. If <character set specification> is not specified,
  18506. then an implementation-defined <character set specification> is
  18507. implicit.
  18508. 8) A <COBOL bit type> describes a bit string variable. Let B be the
  18509. number of bits in a COBOL character and let L be the <length>
  18510. of the <COBOL bit type>. The length of an equivalent COBOL char-
  18511. acter variable is the smallest integer not less than L/B. The
  18512. equivalent SQL data type is BIT whose length is the <length> of
  18513. the <COBOL bit type>.
  18514. 9) A <COBOL numeric type> describes an exact numeric variable. The
  18515. equivalent SQL data type is NUMERIC of the same precision and
  18516. scale.
  18517. 10)A <COBOL computational integer> describes an exact numeric vari-
  18518. able.
  18519. Note: This <COBOL type specification> is supported only for
  18520. SQLCODE for compatibility with earlier versions of this
  18521. International Standard. The SQLCODE status parameter is a
  18522. deprecated feature that is supported for compatibility with
  18523. earlier versions of this International Standard. See Annex D,
  18524. "Deprecated features".
  18525. 11)A <COBOL binary integer> describes an exact numeric variable.
  18526. The equivalent SQL data type is SMALLINT or INTEGER.
  18527. 12)If an <embedded SQL COBOL program> contains neither a <COBOL
  18528. variable definition> that specifies SQLSTATE and that is defined
  18529. with a <COBOL character type> that specifies
  18530. {01|77} SQLSTATE PICTURE X(5)
  18531. nor a <COBOL variable definition> that specifies SQLCODE and
  18532. that is defined with a <COBOL type specification> that specifies
  18533. {01|77} SQLCODE PICTURE S9(PC) USAGE COMP
  18534. where PC is the implementation-defined precision specified for a
  18535. COBOL SQLCODE parameter in Subclause 12.4, "Calls to a <proce-
  18536. dure>", then it is assumed that the <embedded SQL COBOL program>
  18537. contains a variable named SQLCODE defined with a data type of
  18538. {01|77} SQLCODE PICTURE S9(PC) USAGE COMP
  18539. where PC is the implementation-defined precision specified for a
  18540. COBOL SQLCODE parameter in Subclause 12.4, "Calls to a <proce-
  18541. dure>".
  18542. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18543. status parameter is a deprecated feature that is supported
  18544. for compatibility with earlier versions of this International
  18545. Standard. See Annex D, "Deprecated features".
  18546. 510 Database Language SQL
  18547. X3H2-92-154/DBL CBR-002
  18548. 19.5 <embedded SQL COBOL program>
  18549. Access Rules
  18550. None.
  18551. General Rules
  18552. 1) See Subclause 19.1, "<embedded SQL host program>".
  18553. Leveling Rules
  18554. 1) The following restrictions apply for Intermediate SQL:
  18555. a) A <COBOL type specification> shall not be a <COBOL bit type>.
  18556. 2) The following restrictions apply for Entry SQL in addition to
  18557. any Intermediate SQL restrictions:
  18558. a) A <COBOL character type> shall not contain a <character set
  18559. specification>.
  18560. Embedded SQL 511
  18561. X3H2-92-154/DBL CBR-002
  18562. 19.6 <embedded SQL Fortran program>
  18563. 19.6 <embedded SQL Fortran program>
  18564. Function
  18565. Specify an <embedded SQL Fortran program>.
  18566. Format
  18567. <embedded SQL Fortran program> ::= !! See the Syntax Rules.
  18568. <Fortran variable definition> ::=
  18569. <Fortran type specification>
  18570. <Fortran host identifier> [ { <comma> <Fortran host identifier> }... ]
  18571. <Fortran host identifier> ::= !! See the Syntax Rules.
  18572. <Fortran type specification> ::=
  18573. CHARACTER [ <asterisk> <length> ]
  18574. [ CHARACTER SET [ IS ] <character set specification> ]
  18575. | BIT [ <asterisk> <length> ]
  18576. | INTEGER
  18577. | REAL
  18578. | DOUBLE PRECISION
  18579. Syntax Rules
  18580. 1) An <embedded SQL Fortran program> is a compilation unit that
  18581. consists of Fortran text and SQL text. The Fortran text shall
  18582. conform to the Fortran standard ISO/IEC 1539. The SQL text shall
  18583. consist of one or more <embedded SQL statement>s and, option-
  18584. ally, one or more <embedded SQL declare section>s.
  18585. 2) An <embedded SQL statement> may be specified wherever an exe-
  18586. cutable Fortran statement may be specified. An <embedded SQL
  18587. statement> that precedes any executable Fortran statement in
  18588. the containing <embedded SQL Fortran program> shall not have a
  18589. Fortran statement number. Otherwise, if the Fortran statement
  18590. could have a statement number then the <embedded SQL statement>
  18591. can have a statement number.
  18592. 3) Blanks are significant in <embedded SQL statement>s. The rules
  18593. for <separator>s in an <embedded SQL statement> are as specified
  18594. in Subclause 5.2, "<token> and <separator>".
  18595. 4) A <Fortran host identifier> is any valid Fortran variable name
  18596. with all <space> characters removed. A <Fortran host identifier>
  18597. shall be contained in an <embedded SQL Fortran program>.
  18598. 5) A <Fortran variable definition> is a restricted form of Fortran
  18599. type-statement that defines one or more host variables.
  18600. 512 Database Language SQL
  18601. X3H2-92-154/DBL CBR-002
  18602. 19.6 <embedded SQL Fortran program>
  18603. 6) A <Fortran variable definition> shall be modified as follows
  18604. before it is placed into the program derived from the <embed-
  18605. ded SQL Fortran program> (see the Syntax Rules Subclause 19.1,
  18606. "<embedded SQL host program>".
  18607. a) Any optional CHARACTER SET specification shall be removed
  18608. from the CHARACTER alternative in a <Fortran type specifica-
  18609. tion>.
  18610. b) The <length> specified in the CHARACTER alternative of any
  18611. <Fortran type specification> that contained a CHARACTER
  18612. SET specification shall be replaced by a length equal to
  18613. the length in octets of PN, where PN is the <Fortran host
  18614. identifier> specified in the containing <Fortran variable
  18615. definition>.
  18616. c) The syntax "BIT" shall be replaced by "CHARACTER" in any BIT
  18617. alternative of a <Fortran type specification>.
  18618. d) The <length> specified in any BIT alternative of a <Fortran
  18619. type specification> shall be replaced by a length equal to
  18620. the smallest integer not less than L/B, as defined in the
  18621. Syntax Rules of this Subclause.
  18622. The modified <Fortran variable definition> shall be a valid
  18623. Fortran type-statement in the program derived from the <embedded
  18624. SQL Fortran program>.
  18625. 7) CHARACTER describes a character string variable whose equivalent
  18626. SQL data type is CHARACTER with the same length and character
  18627. set specified by <character set specification>. If <character
  18628. set specification> is not specified, then an implementation-
  18629. defined <character set specification> is implicit.
  18630. 8) BIT describes a bit string variable. Let B be the number of
  18631. bits in a Fortran CHARACTER and let L be the <length> of the bit
  18632. string variable. The length of an equivalent Fortran character
  18633. variable is the smallest integer not less than L/B. The equiv-
  18634. alent SQL data type is BIT whose length is the <length> of the
  18635. bit string variable.
  18636. 9) INTEGER describes an exact numeric variable. The equivalent SQL
  18637. data type is INTEGER.
  18638. 10)REAL describes an approximate numeric variable. The equivalent
  18639. SQL data type is REAL.
  18640. 11)DOUBLE PRECISION describes an approximate numeric variable. The
  18641. equivalent SQL data type is DOUBLE PRECISION.
  18642. 12)If an <embedded SQL Fortran program> contains neither a <Fortran
  18643. variable definition> that specifies SQLSTATE or SQLSTA and that
  18644. is defined with a <Fortran type specification> that specifies
  18645. CHARACTER with <length> 5, nor a <Fortran variable definition>
  18646. that specifies SQLCOD and that is defined with a <Fortran type
  18647. Embedded SQL 513
  18648. X3H2-92-154/DBL CBR-002
  18649. 19.6 <embedded SQL Fortran program>
  18650. specification> that specifies INTEGER, then it is assumed that
  18651. the <embedded SQL Fortran program> contains a variable named
  18652. SQLCOD defined with a data type of INTEGER.
  18653. Note: SQLSTATE (which may be abbreviated "SQLSTA") is the pre-
  18654. ferred status parameter. The SQLCODE (SQLCOD) status parameter
  18655. is a deprecated feature that is supported for compatibility with
  18656. earlier versions of this International Standard. See Annex D,
  18657. "Deprecated features".
  18658. Access Rules
  18659. None.
  18660. General Rules
  18661. 1) See Subclause 19.1, "<embedded SQL host program>".
  18662. Leveling Rules
  18663. 1) The following restrictions apply for Intermediate SQL:
  18664. a) A <Fortran type specification> shall not specify BIT.
  18665. 2) The following restrictions apply for Entry SQL in addition to
  18666. any Intermediate SQL restrictions:
  18667. a) A <Fortran type specification> shall not contain a <character
  18668. set specification>.
  18669. 514 Database Language SQL
  18670. X3H2-92-154/DBL CBR-002
  18671. 19.7 <embedded SQL MUMPS program>
  18672. 19.7 <embedded SQL MUMPS program>
  18673. Function
  18674. Specify an <embedded SQL MUMPS program>.
  18675. Format
  18676. <embedded SQL MUMPS program> ::= !! See the Syntax Rules.
  18677. <MUMPS variable definition> ::=
  18678. { <MUMPS numeric variable> | <MUMPS character variable> }
  18679. <semicolon>
  18680. <MUMPS character variable> ::=
  18681. VARCHAR <MUMPS host identifier> <MUMPS length specification>
  18682. [ { <comma> <MUMPS host identifier> <MUMPS length specification> }... ]
  18683. <MUMPS host identifier> ::= !! See the Syntax Rules.
  18684. <MUMPS length specification> ::=
  18685. <left paren> <length> <right paren>
  18686. <MUMPS numeric variable> ::=
  18687. <MUMPS type specification>
  18688. <MUMPS host identifier> [ { <comma> <MUMPS host identifier> }... ]
  18689. <MUMPS type specification> ::=
  18690. INT
  18691. | DEC [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
  18692. | REAL
  18693. Syntax Rules
  18694. 1) An <embedded SQL MUMPS program> is a compilation unit that con-
  18695. sists of MUMPS text and SQL text. The MUMPS text shall conform
  18696. to the MUMPS standard ISO/IEC 11756. The SQL text shall consist
  18697. of one or more <embedded SQL statement>s and, optionally, one or
  18698. more <embedded SQL declare section>s.
  18699. 2) A <MUMPS host identifier> is any valid MUMPS variable name. A
  18700. <MUMPS host identifier> shall be contained in an <embedded SQL
  18701. MUMPS program>.
  18702. 3) An <embedded SQL statement> may be specified wherever a MUMPS
  18703. command may be specified.
  18704. 4) A <MUMPS variable definition> defines one or more host vari-
  18705. ables.
  18706. Embedded SQL 515
  18707. X3H2-92-154/DBL CBR-002
  18708. 19.7 <embedded SQL MUMPS program>
  18709. 5) The <MUMPS character variable> describes a variable-length char-
  18710. acter string. The equivalent SQL data type is CHARACTER VARYING
  18711. whose maximum length is the <length> of the <MUMPS length spec-
  18712. ification> and whose character set is implementation-defined.
  18713. 6) INT describes an exact numeric variable. The equivalent SQL data
  18714. type is INTEGER.
  18715. 7) DEC describes an exact numeric variable. The <scale> shall not
  18716. be greater than the <precision>. The equivalent SQL data type is
  18717. DECIMAL with the same <precision> and <scale>.
  18718. 8) REAL describes an approximate numeric variable. The equivalent
  18719. SQL data type is REAL.
  18720. 9) If an <embedded SQL MUMPS program> contains neither a <MUMPS
  18721. variable definition> that specifies SQLSTATE and that is defined
  18722. with a <MUMPS character variable > that specifies VARCHAR with
  18723. a <MUMPS length specification> that specifies 5, nor a <MUMPS
  18724. variable definition> that specifies SQLCODE and that is defined
  18725. with a <MUMPS numeric variable> that specifies INT, then it
  18726. is assumed that the <embedded SQL MUMPS program> contains a
  18727. variable named SQLCODE defined with a data type of INT.
  18728. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18729. status parameter is a deprecated feature that is supported
  18730. for compatibility with earlier versions of this International
  18731. Standard. See Annex D, "Deprecated features".
  18732. Access Rules
  18733. None.
  18734. General Rules
  18735. 1) See Subclause 19.1, "<embedded SQL host program>".
  18736. Leveling Rules
  18737. 1) The following restrictions apply for Intermediate SQL:
  18738. None.
  18739. 2) The following restrictions apply for Entry SQL in addition to
  18740. any Intermediate SQL restrictions:
  18741. a) Conforming Entry SQL language shall contain no <embedded SQL
  18742. MUMPS program>.
  18743. 516 Database Language SQL
  18744. X3H2-92-154/DBL CBR-002
  18745. 19.8 <embedded SQL Pascal program>
  18746. 19.8 <embedded SQL Pascal program>
  18747. Function
  18748. Specify an <embedded SQL Pascal program>.
  18749. Format
  18750. <embedded SQL Pascal program> ::= !! See the Syntax Rules.
  18751. <Pascal variable definition> ::=
  18752. <Pascal host identifier> [ { <comma> <Pascal host identifier> }... ] <colon>
  18753. <Pascal type specification> <semicolon>
  18754. <Pascal host identifier> ::= !! See the Syntax Rules.
  18755. <Pascal type specification> ::=
  18756. PACKED ARRAY <left bracket> 1 <double period> <length> <right bracket>
  18757. OF CHAR
  18758. [ CHARACTER SET [ IS ] <character set specification> ]
  18759. | PACKED ARRAY <left bracket> 1 <double period> <length> <right bracket>
  18760. OF BIT
  18761. | INTEGER
  18762. | REAL
  18763. | CHAR [ CHARACTER SET [ IS ] <character set specification> ]
  18764. | BIT
  18765. Syntax Rules
  18766. 1) An <embedded SQL Pascal program> is a compilation unit that
  18767. consists of Pascal text and SQL text. The Pascal text shall
  18768. conform to one of the Pascal standards ISO 7185 and ISO/IEC
  18769. 10206. The SQL text shall consist of one or more <embedded SQL
  18770. statement>s and, optionally, one or more <embedded SQL declare
  18771. section>s.
  18772. 2) An <embedded SQL statement> may be specified wherever a Pascal
  18773. statement may be specified. An <embedded SQL statement> may be
  18774. prefixed by a Pascal label.
  18775. 3) A <Pascal host identifier> is a Pascal variable-identifier whose
  18776. applied instance denotes a defining instance within an <embedded
  18777. SQL begin declare> and an <embedded SQL end declare>.
  18778. 4) A <Pascal variable definition> defines one or more <Pascal host
  18779. identifier>s.
  18780. Embedded SQL 517
  18781. X3H2-92-154/DBL CBR-002
  18782. 19.8 <embedded SQL Pascal program>
  18783. 5) A <Pascal variable definition> shall be modified as follows
  18784. before it is placed into the program derived from the <embedded
  18785. SQL Pascal program> (see the Syntax Rules of Subclause 19.1,
  18786. "<embedded SQL host program>").
  18787. a) Any optional CHARACTER SET specification shall be removed
  18788. from the PACKED ARRAY OF CHAR or CHAR alternatives of a
  18789. <Pascal type specification>.
  18790. b) The <length> specified in the PACKED ARRAY OF CHAR alter-
  18791. native of any <Pascal type specification> that contained a
  18792. CHARACTER SET specification shall be replaced by a length
  18793. equal to the length in octets of PN, where PN is the <Pascal
  18794. host identifier> specified in the containing <Pascal variable
  18795. definition>.
  18796. c) If any <Pascal type specification> specifies the syntax
  18797. "CHAR" and contains a CHARACTER SET specification, then let L
  18798. be a length equal to the length in octets of PN and PN be the
  18799. <Pascal host identifier> specified in the containing <Pascal
  18800. variable definition>. If L is greater than 1, then "CHAR"
  18801. shall be replaced by "PACKED ARRAY [1..L] OF CHAR".
  18802. d) The syntax "BIT" shall be replaced by "CHAR" in any PACKED
  18803. ARRAY OF BIT or BIT alternatives of a <Pascal type specifica-
  18804. tion>.
  18805. e) The <length> specified in any PACKED ARRAY OF BIT alterna-
  18806. tive in a <Pascal type specification> shall be replaced by
  18807. a length equal to the smallest integer not less than L/B, as
  18808. defined in the Syntax Rules of this Subclause.
  18809. The modified <Pascal variable definition> shall be a valid
  18810. Pascal variable-declaration in the program derived from the
  18811. <embedded SQL Pascal program>.
  18812. 6) CHAR specified without a CHARACTER SET specification is the
  18813. ordinal-type-identifier of PASCAL. The equivalent SQL data type
  18814. is CHARACTER with length 1.
  18815. 7) BIT describes a single-bit variable. It is mapped to a Pascal
  18816. CHAR ordinal-type-identifier whose most significant bit contains
  18817. either 0 or 1 and whose least significant bits contain 0. The
  18818. equivalent SQL data type is BIT with length 1.
  18819. 8) PACKED ARRAY [1..<length>] OF CHAR describes a character string
  18820. having 2 or more components of the simple type CHAR. The equiva-
  18821. lent SQL data type is CHARACTER with the same length and charac-
  18822. ter set specified by <character set specification>. If <charac-
  18823. ter set specification> is not specified, then an implementation-
  18824. defined <character set specification> is implicit.
  18825. 518 Database Language SQL
  18826. X3H2-92-154/DBL CBR-002
  18827. 19.8 <embedded SQL Pascal program>
  18828. 9) PACKED ARRAY [1..<length>] OF BIT describes a bit string vari-
  18829. able. Let B be the number of bits in a Pascal CHAR and let L be
  18830. the <length> of the bit string variable. The length of an equiv-
  18831. alent Pascal character variable is the smallest integer not less
  18832. than L/B. The equivalent SQL data type is BIT whose length is
  18833. the <length> of the bit string variable.
  18834. 10)INTEGER describes an exact numeric variable. The equivalent SQL
  18835. data type is INTEGER.
  18836. 11)REAL describes an approximate numeric variable. The equivalent
  18837. SQL data type is REAL.
  18838. 12)If an <embedded SQL Pascal program> contains neither a <Pascal
  18839. variable definition> that specifies SQLSTATE and that is defined
  18840. with a <Pascal type specification> that specifies PACKED ARRAY
  18841. [1..<length>] OF CHAR with <length> 5, nor a <Pascal variable
  18842. definition> that specifies SQLCODE and that is defined with a
  18843. <Pascal type specification> that specifies INTEGER, then it
  18844. is assumed that the <embedded SQL Pascal program> contains a
  18845. variable named SQLCODE defined with a data type of INTEGER.
  18846. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18847. status parameter is a deprecated feature that is supported
  18848. for compatibility with earlier versions of this International
  18849. Standard. See Annex D, "Deprecated features".
  18850. Access Rules
  18851. None.
  18852. General Rules
  18853. 1) See Subclause 19.1, "<embedded SQL host program>".
  18854. Leveling Rules
  18855. 1) The following restrictions apply for Intermediate SQL:
  18856. a) A <Pascal type specification> shall not specify BIT or PACKED
  18857. ARRAY [1..<length>] OF BIT.
  18858. 2) The following restrictions apply for Entry SQL in addition to
  18859. any Intermediate SQL restrictions:
  18860. a) A <Pascal type specification> shall not contain a <character
  18861. set specification>.
  18862. Embedded SQL 519
  18863. X3H2-92-154/DBL CBR-002
  18864. 19.9 <embedded SQL PL/I program>
  18865. 19.9 <embedded SQL PL/I program>
  18866. Function
  18867. Specify an <embedded SQL PL/I program>.
  18868. Format
  18869. <embedded SQL PL/I program> ::= !! See the Syntax Rules.
  18870. <PL/I variable definition> ::=
  18871. {DCL | DECLARE}
  18872. { <PL/I host identifier>
  18873. | <left paren> <PL/I host identifier>
  18874. [ { <comma> <PL/I host identifier> }... ] <right paren> }
  18875. <PL/I type specification>
  18876. [ <character representation>... ] <semicolon>
  18877. <PL/I host identifier> ::= !! See the Syntax Rules.
  18878. <PL/I type specification> ::=
  18879. { CHAR | CHARACTER } [ VARYING ] <left paren><length><right paren>
  18880. [ CHARACTER SET [ IS ] <character set specification> ]
  18881. | BIT [ VARYING ] <left paren><length><right paren>
  18882. | <PL/I type fixed decimal> <left paren> <precision>
  18883. [ <comma> <scale> ] <right paren>
  18884. | <PL/I type fixed binary> [ <left paren> <precision> <right paren> ]
  18885. | <PL/I type float binary> <left paren> <precision> <right paren>
  18886. <PL/I type fixed decimal> ::=
  18887. { DEC | DECIMAL } FIXED
  18888. | FIXED { DEC | DECIMAL }
  18889. <PL/I type fixed binary> ::=
  18890. { BIN | BINARY } FIXED
  18891. | FIXED { BIN | BINARY }
  18892. <PL/I type float binary> ::=
  18893. { BIN | BINARY } FLOAT
  18894. | FLOAT { BIN | BINARY }
  18895. 520 Database Language SQL
  18896. X3H2-92-154/DBL CBR-002
  18897. 19.9 <embedded SQL PL/I program>
  18898. Syntax Rules
  18899. 1) An <embedded SQL PL/I program> is a compilation unit that con-
  18900. sists of PL/I text and SQL text. The PL/I text shall conform to
  18901. the PL/I standard ISO 6160. The SQL text shall consist of one
  18902. or more <embedded SQL statement>s and, optionally, one or more
  18903. <embedded SQL declare section>s.
  18904. 2) An <embedded SQL statement> may be specified wherever a PL/I
  18905. statement may be specified within a procedure block. If the
  18906. PL/I statement could include a label prefix, the <embedded SQL
  18907. statement> may be immediately preceded by a label prefix.
  18908. 3) A <PL/I host identifier> is any valid PL/I variable identifier.
  18909. A <PL/I host identifier> shall be contained in an <embedded SQL
  18910. PL/I program>.
  18911. 4) A <PL/I variable definition> defines one or more host variables.
  18912. 5) A <PL/I variable definition> shall be modified as follows before
  18913. it is placed into the program derived from the <embedded SQL
  18914. PL/I program> (see the Syntax Rules of Subclause 19.1, "<embed-
  18915. ded SQL host program>").
  18916. a) Any optional CHARACTER SET specification shall be removed
  18917. from the CHARACTER or CHARACTER VARYING alternatives of a
  18918. <PL/I type specification>.
  18919. b) The <length> specified in the CHARACTER or CHARACTER VARYING
  18920. alternatives of any <PL/I type specification> that contains
  18921. a CHARACTER SET specification shall be replaced by a length
  18922. equal to the length in octets of PN, where PN is the <PL/I
  18923. host identifier> specified in the containing <PL/I variable
  18924. definition>.
  18925. The modified <PL/I variable definition> shall be a valid PL/I
  18926. data declaration in the program derived from the <embedded SQL
  18927. PL/I program>.
  18928. 6) A <PL/I variable definition> shall specify a scalar variable,
  18929. not an array or structure.
  18930. 7) The optional <character representation> sequence in a <PL/I
  18931. variable definition> may specify an INITIAL clause. Whether
  18932. other clauses may be specified is implementation-defined. The
  18933. <character representation> sequence shall be such that the <PL/I
  18934. variable definition> is a valid PL/I DECLARE statement.
  18935. 8) CHARACTER describes a character string variable whose equiva-
  18936. lent SQL data type has the character set specified by <char-
  18937. acter set specification>. If <character set specification> is
  18938. not specified, then an implementation-defined <character set
  18939. specification> is implicit.
  18940. Embedded SQL 521
  18941. X3H2-92-154/DBL CBR-002
  18942. 19.9 <embedded SQL PL/I program>
  18943. Case:
  18944. a) If VARYING is not specified, the length of the variable is
  18945. fixed. The equivalent SQL data type is CHARACTER with the
  18946. same length.
  18947. b) If VARYING is specified, the variable is of variable length,
  18948. with maximum size the value of <length>. The equivalent SQL
  18949. data type is CHARACTER VARYING with the same maximum length.
  18950. 9) BIT describes a bit string variable.
  18951. Case:
  18952. a) If VARYING is not specified, then the length of the variable
  18953. is fixed. The equivalent SQL data type is BIT with the same
  18954. length.
  18955. b) If VARYING is specified, then the variable is of variable
  18956. length with maximum size of the value of <length>. The equiv-
  18957. alent SQL data type is BIT VARYING with the same maximum
  18958. length.
  18959. 10)FIXED DECIMAL describes an exact numeric variable. The <scale>
  18960. shall not be greater than the <precision>. The equivalent SQL
  18961. data type is DECIMAL with the same <precision> and <scale>.
  18962. 11)FIXED BINARY describes an exact numeric variable. The equivalent
  18963. SQL data type is SMALLINT or INTEGER.
  18964. 12)FLOAT BINARY describes an approximate numeric variable. The
  18965. equivalent SQL data type is FLOAT with the same <precision>.
  18966. 13)If an <embedded SQL PL/I program> contains neither a <PL/I
  18967. variable definition> that specifies SQLSTATE and that is de-
  18968. fined with a <PL/I type specification> that specifies CHAR or
  18969. CHARACTER with <length> 5 and does not specify VARYING, nor a
  18970. <PL/I variable definition> that specifies SQLCODE and that is
  18971. defined with a <PL/I type specification> that specifies FIXED
  18972. BIN(PP) or FIXED BINARY(PP), where PP is the implementation-
  18973. defined precision specified for a PL/I SQLCODE parameter in
  18974. Subclause 12.4, "Calls to a <procedure>", then it is assumed
  18975. that the <embedded SQL PL/I program> contains a variable named
  18976. SQLCODE defined with a data type of FIXED BINARY(PP), where PP
  18977. is the implementation-defined precision specified for a PL/I
  18978. SQLCODE parameter in Subclause 12.4, "Calls to a <procedure>".
  18979. Note: SQLSTATE is the preferred status parameter. The SQLCODE
  18980. status parameter is a deprecated feature that is supported
  18981. for compatibility with earlier versions of this International
  18982. Standard. See Annex D, "Deprecated features".
  18983. Access Rules
  18984. None.
  18985. 522 Database Language SQL
  18986. X3H2-92-154/DBL CBR-002
  18987. 19.9 <embedded SQL PL/I program>
  18988. General Rules
  18989. 1) See Subclause 19.1, "<embedded SQL host program>"
  18990. Leveling Rules
  18991. 1) The following restrictions apply for Intermediate SQL:
  18992. a) A <PL/I type specification> shall not specify BIT or BIT
  18993. VARYING.
  18994. 2) The following restrictions apply for Entry SQL in addition to
  18995. any Intermediate SQL restrictions:
  18996. a) A <PL/I type specification> shall not specify CHARACTER
  18997. VARYING.
  18998. b) A <PL/I type specification> shall not contain a <character
  18999. set specification>.
  19000. Embedded SQL 523
  19001. X3H2-92-154/DBL CBR-002
  19002. 524 Database Language SQL
  19003. X3H2-92-154/DBL CBR-002
  19004. 20 Direct invocation of SQL
  19005. 20.1 <direct SQL statement>
  19006. Function
  19007. Specify direct execution of SQL.
  19008. Format
  19009. <direct SQL statement> ::=
  19010. <directly executable statement> <semicolon>
  19011. <directly executable statement> ::=
  19012. <direct SQL data statement>
  19013. | <SQL schema statement>
  19014. | <SQL transaction statement>
  19015. | <SQL connection statement>
  19016. | <SQL session statement>
  19017. | <direct implementation-defined statement>
  19018. <direct SQL data statement> ::=
  19019. <delete statement: searched>
  19020. | <direct select statement: multiple rows>
  19021. | <insert statement>
  19022. | <update statement: searched>
  19023. | <temporary table declaration>
  19024. <direct implementation-defined statement> ::= !!See the Syntax
  19025. Rules
  19026. Syntax Rules
  19027. 1) The <direct SQL data statement> shall not contain any <parameter
  19028. specification>, <dynamic parameter specification>, or <variable
  19029. specification>.
  19030. 2) The <value specification> that represents the null value is
  19031. implementation-defined.
  19032. 3) The Format and Syntax Rules for <direct implementation-defined
  19033. statement> are implementation-defined.
  19034. Access Rules
  19035. 1) The Access Rules for <direct implementation-defined statement>
  19036. are implementation-defined.
  19037. Direct invocation of SQL 525
  19038. X3H2-92-154/DBL CBR-002
  19039. 20.1 <direct SQL statement>
  19040. General Rules
  19041. 1) The following <direct SQL statement>s are transaction-initiating
  19042. <direct SQL statement>s:
  19043. a) <direct SQL statement>s that are transaction-initiating <SQL
  19044. procedure statement>s;
  19045. b) <direct select statement: multiple rows>; and
  19046. c) <direct implementation-defined statement>s that are transaction-
  19047. initiating.
  19048. 2) After the last invocation of an SQL-statement by an SQL-agent in
  19049. an SQL-session:
  19050. a) A <rollback statement> or a <commit statement> is effectively
  19051. executed. If an unrecoverable error has occurred, or if the
  19052. direct invocation of SQL terminated unexpectedly, or if any
  19053. constraint is not satisfied, then a <rollback statement>
  19054. is performed. Otherwise, the choice of which of these SQL-
  19055. statements to perform is implementation-dependent. The deter-
  19056. mination of whether a direct invocation of SQL has terminated
  19057. unexpectedly is implementation-dependent.
  19058. b) Let D be the <descriptor name> of any system descriptor area
  19059. that is currently allocated within the current SQL-session. A
  19060. <deallocate descriptor statement> that specifies
  19061. DEALLOCATE DESCRIPTOR D
  19062. is effectively executed.
  19063. c) All SQL-sessions associated with the SQL-agent are termi-
  19064. nated.
  19065. 3) Let S be the <direct SQL statement>.
  19066. 4) The current <authorization identifier> for privilege determi-
  19067. nation for the execution of S is the SQL-session <authorization
  19068. identifier>.
  19069. 5) If S does not conform to the Format, Syntax Rules, and Access
  19070. Rules for a <direct SQL statement>, then an exception condition
  19071. is raised: syntax error or access rule violation in direct SQL
  19072. statement.
  19073. 6) When S is invoked by the SQL-agent:
  19074. Case:
  19075. a) If S is an <SQL connection statement>, then:
  19076. i) The diagnostics area is emptied.
  19077. ii) S is executed.
  19078. 526 Database Language SQL
  19079. X3H2-92-154/DBL CBR-002
  19080. 20.1 <direct SQL statement>
  19081. iii) If S successfully initiated or resumed an SQL-session, then
  19082. subsequent invocations of a <direct SQL statement> by the
  19083. SQL-agent are associated with that SQL-session until the
  19084. SQL-agent terminates the SQL-session or makes it dormant.
  19085. b) Otherwise:
  19086. i) If no SQL-session is current for the SQL-agent, then
  19087. Case:
  19088. 1) If the SQL-agent has not executed an <SQL connection
  19089. statement> and there is no default SQL-session asso-
  19090. ciated with the SQL-agent, then the following <connect
  19091. statement> is effectively executed:
  19092. CONNECT TO DEFAULT
  19093. 2) If the SQL-agent has not executed an <SQL connection
  19094. statement> and there is a default SQL-session associated
  19095. with the SQL-agent, then the following <set connection
  19096. statement> is effectively executed:
  19097. SET CONNECTION DEFAULT
  19098. 3) Otherwise, an exception condition is raised: connection
  19099. exception-connection does not exist.
  19100. Subsequent calls to a <procedure> or invocations of a <di-
  19101. rect SQL statement> by the SQL-agent are associated with
  19102. the SQL-session until the SQL-agent terminates the SQL-
  19103. session or makes it dormant.
  19104. ii) If an SQL-transaction is active for the SQL-agent, then
  19105. S is associated with that SQL-transaction. If S is a
  19106. <direct implementation-defined statement>, then it is
  19107. implementation-defined whether or not S may be associated
  19108. with an active SQL-transaction; if not, then an exception
  19109. condition is raised: invalid transaction state.
  19110. iii) If no SQL-transaction is active for the SQL-agent, then
  19111. 1) Case:
  19112. A) If S is a transaction-initiating <direct SQL state-
  19113. ment>, then an SQL-transaction is initiated.
  19114. B) If S is a <direct implementation-defined statement>,
  19115. then it is implementation-defined whether or not S
  19116. initiates an SQL-transaction. If an implementation
  19117. defines S to be transaction-initiating, then an SQL-
  19118. transaction is initiated.
  19119. 2) If S initiated an SQL-transaction, then:
  19120. A) Let T be the SQL-transaction initiated by S.
  19121. Direct invocation of SQL 527
  19122. X3H2-92-154/DBL CBR-002
  19123. 20.1 <direct SQL statement>
  19124. B) T is associated with this invocation and any subse-
  19125. quent invocations of <direct SQL statement>s or calls
  19126. to a <procedure> by the SQL-agent until the SQL-agent
  19127. terminates T.
  19128. C) Case:
  19129. I) If a <set transaction statement> has been executed
  19130. since the termination of the last SQL-transaction
  19131. in the SQL-session (or if there has been no previ-
  19132. ous SQL-transaction in the SQL-session and a <set
  19133. transaction statement> has been executed), then the
  19134. access mode, constraint mode, and isolation level
  19135. of T are set as specified by the <set transaction
  19136. statement>.
  19137. II) Otherwise, the access mode, constraint mode for all
  19138. constraints, and isolation level for T are read-
  19139. write, immediate, and SERIALIZABLE, respectively.
  19140. D) T is associated with the SQL-session.
  19141. iv) If S contains an <SQL schema statement> and the access
  19142. mode of the current SQL-transaction is read-only, then an
  19143. exception condition is raised: invalid transaction state.
  19144. v) The diagnostics area is emptied.
  19145. vi) S is executed.
  19146. 7) If the execution of a <direct SQL data statement> occurs within
  19147. the same SQL-transaction as the execution of an SQL-schema
  19148. statement and this is not allowed by the SQL-implementation,
  19149. then an exception condition is raised: invalid transaction
  19150. state.
  19151. 8) Case:
  19152. a) If S executed successfully, then either a completion condi-
  19153. tion is raised: successful execution, or a completion condi-
  19154. tion is raised: warning, or a completion condition is raised:
  19155. no data, as determined by the General Rules in this and other
  19156. Subclauses of this International Standard.
  19157. b) If S did not execute successfully, then all changes made to
  19158. SQL-data or schemas by the execution of S are canceled and
  19159. an exception condition is raised as determined by the General
  19160. Rules in this and other Subclauses of this International
  19161. Standard.
  19162. Note: The method of raising a condition is implementation-
  19163. defined.
  19164. 528 Database Language SQL
  19165. X3H2-92-154/DBL CBR-002
  19166. 20.1 <direct SQL statement>
  19167. 9) Diagnostics information resulting from the execution of S is
  19168. placed into the diagnostics area as specified in Clause 18,
  19169. "Diagnostics management".
  19170. Note: The method of accessing the diagnostics information is
  19171. implementation-defined, but does not alter the contents of the
  19172. diagnostics area.
  19173. Leveling Rules
  19174. 1) The following restrictions apply for Intermediate SQL:
  19175. None.
  19176. 2) The following restrictions apply for Entry SQL in addition to
  19177. any Intermediate SQL restrictions:
  19178. a) A <direct SQL statement> shall not be an <SQL schema state-
  19179. ment>.
  19180. Direct invocation of SQL 529
  19181. X3H2-92-154/DBL CBR-002
  19182. 20.2 <direct select statement: multiple rows>
  19183. 20.2 <direct select statement: multiple rows>
  19184. Function
  19185. Specify a statement to retrieve multiple rows from a specified
  19186. table.
  19187. Format
  19188. <direct select statement: multiple rows> ::=
  19189. <query expression> [ <order by clause> ]
  19190. Syntax Rules
  19191. 1) All Syntax Rules of Subclause 7.10, "<query expression>", apply
  19192. to the <direct select statement: multiple rows>.
  19193. 2) The <query expression> or <order by clause> of a <direct select
  19194. statement: multiple rows> shall not contain any <value specifi-
  19195. cation> other than a <literal>, CURRENT_USER, SESSION_USER, or
  19196. SYSTEM_USER.
  19197. 3) Let T be the table specified by the <query expression>.
  19198. 4) If ORDER BY is specified, then each <sort specification> in the
  19199. <order by clause> shall identify a column of T.
  19200. Case:
  19201. a) If a <sort specification> contains a <column name>, then T
  19202. shall contain exactly one column with that <column name> and
  19203. the <sort specification> identifies that column.
  19204. b) If a <sort specification> contains an <unsigned integer>,
  19205. then the <unsigned integer> shall be greater than 0 and not
  19206. greater than the degree of T. The <sort specification> iden-
  19207. tifies the column of T with the ordinal position specified by
  19208. the <unsigned integer>.
  19209. Access Rules
  19210. None.
  19211. General Rules
  19212. 1) All General Rules of Subclause 7.10, "<query expression>", apply
  19213. to the <direct select statement: multiple rows>.
  19214. 2) Let Q be the result of the <query expression>.
  19215. 3) If Q is empty, then a completion condition is raised: no data.
  19216. 4) If an <order by clause> is not specified, then the ordering of
  19217. the rows of Q is implementation-dependent.
  19218. 530 Database Language SQL
  19219. X3H2-92-154/DBL CBR-002
  19220. 20.2 <direct select statement: multiple rows>
  19221. 5) If an <order by clause> is specified, then the ordering of rows
  19222. of the result is effectively determined by the <order by clause>
  19223. as follows:
  19224. a) Each <sort specification> specifies the sort direction for
  19225. the corresponding sort key Ki. If ASC is specified or implied
  19226. in the i-th <sort specification>, then the sort direction for
  19227. Ki is ascending and the applicable <comp op> is the <less
  19228. than operator>. Otherwise, the sort direction for Ki is de-
  19229. scending and the applicable <comp op> is the <greater than
  19230. operator>.
  19231. b) Let X and Y be distinct rows in the result table, and let
  19232. XVi and YVi be the values of Ki in these rows, respectively.
  19233. The relative position of rows X and Y in the result is de-
  19234. termined by comparing XVi and YVi according to the rules of
  19235. Subclause 8.2, "<comparison predicate>", where the <comp op>
  19236. is the applicable <comp op> for Ki, with the following spe-
  19237. cial treatment of null values. Whether a sort key value that
  19238. is null is considered greater or less than a non-null value
  19239. is implementation-defined, but all sort key values that are
  19240. null shall either be considered greater than all non-null
  19241. values or be considered less than all non-null values. XVi
  19242. is said to precede YVi if the value of the <comparison pred-
  19243. icate> "XVi <comp op> YVi" is true for the applicable <comp
  19244. op>.
  19245. c) In the result table, the relative position of row X is before
  19246. row Y if and only if XVn precedes YVn for some n greater than
  19247. 0 and less than the number of <sort specification>s and XVi =
  19248. YVi for all i < n. The relative order of two rows for which
  19249. XVi = YVi for all i is implementation-dependent.
  19250. 6) If Q is not empty, then Q is returned. The method of returning Q
  19251. is implementation-defined.
  19252. Leveling Rules
  19253. 1) The following restrictions apply for Intermediate SQL:
  19254. None.
  19255. 2) The following restrictions apply for Entry SQL in addition to
  19256. any Intermediate SQL restrictions:
  19257. None.
  19258. Direct invocation of SQL 531
  19259. X3H2-92-154/DBL CBR-002
  19260. 532 Database Language SQL
  19261. X3H2-92-154/DBL CBR-002
  19262. 21 Information Schema and Definition Schema
  19263. 21.1 Introduction
  19264. The views of the Information Schema are defined in terms of base
  19265. tables. The only purpose of the Definition Schema is to provide a
  19266. data model to support the Information Schema and to assist under-
  19267. standing. An implementation need do no more than simulate the exis-
  19268. tence of the Definition Schema, as viewed through the Information
  19269. Schema views.
  19270. The Information Schema views are defined as being in a schema named
  19271. INFORMATION_SCHEMA, enabling these views to be accessed in the same
  19272. way as any other tables in any other schema. SELECT on all of these
  19273. views is granted to PUBLIC WITH GRANT OPTION, so that they can be
  19274. queried by any user and so that SELECT privilege can be further
  19275. granted on views that reference these Information Schema views. No
  19276. other privilege is granted on them, so they cannot be updated.
  19277. The Information Schema also contains a small number of domains on
  19278. which the columns of the Definition Schema are based. USAGE on all
  19279. these domains is granted to PUBLIC WITH GRANT OPTION, so that they
  19280. can be used by any user.
  19281. An implementation may define objects that are associated with
  19282. INFORMATION_SCHEMA that are not defined in this Clause. An im-
  19283. plementation may also add columns to tables that are defined in
  19284. this Clause.
  19285. The base tables are defined as being in a schema named DEFINITION_
  19286. SCHEMA. Because <unqualified schema name>s are prohibited from
  19287. specifying DEFINITION_SCHEMA, the Definition Schema cannot be ac-
  19288. cessed in an SQL-statement.
  19289. Note: The Information Schema tables may be supposed to be rep-
  19290. resented in the Definition Schema in the same way as any other
  19291. tables, and are hence self-describing.
  19292. Note: The Information Schema is a definition of the SQL data model,
  19293. specified as an SQL-schema, in terms of <SQL schema statement>s as
  19294. defined in this International Standard. Constraints defined in this
  19295. Clause are not actual SQL constraints.
  19296. <identifier>s are represented in the tables of the Information
  19297. Schema by <string value expression>s corresponding to their <iden-
  19298. tifier body>s (in the case of <regular identifier>s) or their <de-
  19299. limited identifier body>s (in the case of <delimited identifier>s).
  19300. Comparison of <identifier>s is defined in Subclause 8.2, "<compar-
  19301. ison predicate>". Where an <identifier> has many equivalent forms,
  19302. the one encountered at definition time is stored (of course, any
  19303. lower case letters appearing in a <regular identifier> will have
  19304. Information Schema and Definition Schema 533
  19305. X3H2-92-154/DBL CBR-002
  19306. 21.1 Introduction
  19307. been converted to the corresponding upper case letter before the
  19308. <identifier> is stored in any table of the Information Schema).
  19309. 534 Database Language SQL
  19310. X3H2-92-154/DBL CBR-002
  19311. 21.2 Information Schema
  19312. 21.2 Information Schema
  19313. 21.2.1 INFORMATION_SCHEMA Schema
  19314. Function
  19315. Identify the schema that is to contain the Information Schema ta-
  19316. bles.
  19317. Definition
  19318. CREATE SCHEMA INFORMATION_SCHEMA
  19319. AUTHORIZATION INFORMATION_SCHEMA
  19320. Leveling Rules
  19321. 1) The following restrictions apply for Intermediate SQL:
  19322. None.
  19323. 2) The following restrictions apply for Entry SQL in addition to
  19324. any Intermediate SQL restrictions:
  19325. a) Conforming Entry SQL language shall not reference the
  19326. Information Schema.
  19327. Information Schema and Definition Schema 535
  19328. X3H2-92-154/DBL CBR-002
  19329. 21.2 Information Schema
  19330. 21.2.2 INFORMATION_SCHEMA_CATALOG_NAME base table
  19331. Function
  19332. Identify the catalog that contains the Information Schema.
  19333. Definition
  19334. CREATE TABLE INFORMATION_SCHEMA_CATALOG_NAME
  19335. ( CATALOG_NAME SQL_IDENTIFIER,
  19336. CONSTRAINT INFORMATION_SCHEMA_CATALOG_NAME_PRIMARY_KEY
  19337. PRIMARY KEY ( CATALOG_NAME ) )
  19338. Definition
  19339. 1) The value of CATALOG_NAME is the name of the catalog in which
  19340. this Information Schema resides.
  19341. Leveling Rules
  19342. 1) The following restrictions apply for Intermediate SQL:
  19343. None.
  19344. 2) The following restrictions apply for Entry SQL in addition to
  19345. any Intermediate SQL restrictions:
  19346. a) Conforming Entry SQL language shall not reference the
  19347. Information Schema.
  19348. 536 Database Language SQL
  19349. X3H2-92-154/DBL CBR-002
  19350. 21.2 Information Schema
  19351. 21.2.3 INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY assertion
  19352. Function
  19353. The assertion INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY ensures
  19354. that there is exactly one row in the INFORMATION_SCHEMA_CATALOG_
  19355. NAME table.
  19356. Definition
  19357. CREATE ASSERTION INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY
  19358. CHECK ( 1 = ( SELECT COUNT(*)
  19359. FROM INFORMATION_SCHEMA_CATALOG_NAME ) )
  19360. Description
  19361. 1) The INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY assertion en-
  19362. sures that there is exactly one row in the INFORMATION_SCHEMA_
  19363. CATALOG_NAME table.
  19364. Information Schema and Definition Schema 537
  19365. X3H2-92-154/DBL CBR-002
  19366. 21.2 Information Schema
  19367. 21.2.5 SCHEMATA view
  19368. Function
  19369. Identify the schemata that are owned by a given user.
  19370. Definition
  19371. CREATE VIEW SCHEMATA
  19372. AS SELECT
  19373. CATALOG_NAME, SCHEMA_NAME, SCHEMA_OWNER,
  19374. DEFAULT_CHARACTER_SET_CATALOG, DEFAULT_CHARACTER_SET_
  19375. SCHEMA,
  19376. DEFAULT_CHARACTER_SET_NAME
  19377. FROM DEFINITION_SCHEMA.SCHEMATA
  19378. WHERE SCHEMA_OWNER = CURRENT_USER
  19379. AND CATALOG_NAME
  19380. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19381. CATALOG_NAME )
  19382. Leveling Rules
  19383. 1) The following restrictions apply for Intermediate SQL:
  19384. None.
  19385. 2) The following restrictions apply for Entry SQL in addition to
  19386. any Intermediate SQL restrictions:
  19387. a) Conforming Entry SQL language shall not reference the
  19388. Information Schema.
  19389. 538 Database Language SQL
  19390. X3H2-92-154/DBL CBR-002
  19391. 21.2 Information Schema
  19392. 21.2.5 DOMAINS view
  19393. Function
  19394. Identify the domains defined in this catalog that are accessible to
  19395. a given user.
  19396. Definition
  19397. CREATE VIEW DOMAINS
  19398. AS SELECT DISTINCT
  19399. DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME,
  19400. DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_
  19401. LENGTH,
  19402. COLLATION_CATALOG, COLLATION_SCHEMA,COLLATION_NAME,
  19403. CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_
  19404. NAME,
  19405. NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE,
  19406. DATETIME_PRECISION, DOMAIN_DEFAULT
  19407. FROM DEFINITION_SCHEMA.DOMAINS
  19408. JOIN
  19409. DEFINITION_SCHEMA.DATA_TYPE_DESCRIPTOR AS D
  19410. LEFT JOIN
  19411. DEFINITION_SCHEMA.COLLATIONS AS S
  19412. USING ( COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  19413. NAME )
  19414. ON
  19415. ( ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, '' )
  19416. = ( TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_SCHEMA,
  19417. TABLE_OR_DOMAIN_NAME, COLUMN_NAME ) )
  19418. WHERE
  19419. ( ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, 'DOMAIN' )
  19420. IN
  19421. ( SELECT OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_
  19422. NAME, OBJECT_TYPE
  19423. FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES
  19424. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19425. OR
  19426. ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME ) IN
  19427. ( SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_
  19428. NAME
  19429. FROM COLUMNS ) )
  19430. AND DOMAIN_CATALOG
  19431. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19432. CATALOG_NAME )
  19433. Information Schema and Definition Schema 539
  19434. X3H2-92-154/DBL CBR-002
  19435. 21.2 Information Schema
  19436. Leveling Rules
  19437. 1) The following restrictions apply for Intermediate SQL:
  19438. None.
  19439. 2) The following restrictions apply for Entry SQL in addition to
  19440. any Intermediate SQL restrictions:
  19441. a) Conforming Entry SQL language shall not reference the
  19442. Information Schema.
  19443. 540 Database Language SQL
  19444. X3H2-92-154/DBL CBR-002
  19445. 21.2 Information Schema
  19446. 21.2.6 DOMAIN_CONSTRAINTS view
  19447. Function
  19448. Identify the domain constraints of domains in this catalog that are
  19449. accessible to a given user.
  19450. Definition
  19451. CREATE VIEW DOMAIN_CONSTRAINTS
  19452. AS SELECT DISTINCT
  19453. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  19454. DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME,
  19455. IS_DEFERRABLE, INITIALLY_DEFERRED
  19456. FROM DEFINITION_SCHEMA.DOMAIN_CONSTRAINTS
  19457. JOIN
  19458. DEFINITION_SCHEMA.SCHEMATA AS S
  19459. ON
  19460. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19461. = ( S.CATALOG_NAME, SCHEMA_NAME S) )
  19462. WHERE
  19463. SCHEMA_OWNER = CURRENT_USER
  19464. AND CONSTRAINT_CATALOG
  19465. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19466. CATALOG_NAME )
  19467. Leveling Rules
  19468. 1) The following restrictions apply for Intermediate SQL:
  19469. None.
  19470. 2) The following restrictions apply for Entry SQL in addition to
  19471. any Intermediate SQL restrictions:
  19472. a) Conforming Entry SQL language shall not reference the
  19473. Information Schema.
  19474. Information Schema and Definition Schema 541
  19475. X3H2-92-154/DBL CBR-002
  19476. 21.2 Information Schema
  19477. 21.2.7 TABLES view
  19478. Function
  19479. Identify the tables defined in this catalog that are accessible to
  19480. a given user.
  19481. Definition
  19482. CREATE VIEW TABLES
  19483. AS SELECT
  19484. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE
  19485. FROM DEFINITION_SCHEMA.TABLES
  19486. WHERE ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME )
  19487. IN (
  19488. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  19489. FROM DEFINITION_SCHEMA.TABLE_PRIVILEGES
  19490. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER )
  19491. UNION
  19492. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  19493. FROM DEFINITION_SCHEMA.COLUMN_PRIVILEGES
  19494. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19495. AND TABLE_CATALOG
  19496. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19497. CATALOG_NAME )
  19498. Leveling Rules
  19499. 1) The following restrictions apply for Intermediate SQL:
  19500. None.
  19501. 2) The following restrictions apply for Entry SQL in addition to
  19502. any Intermediate SQL restrictions:
  19503. a) Conforming Entry SQL language shall not reference the
  19504. Information Schema.
  19505. 542 Database Language SQL
  19506. X3H2-92-154/DBL CBR-002
  19507. 21.2 Information Schema
  19508. 21.2.8 VIEWS view
  19509. Function
  19510. Identify the viewed tables defined in this catalog that are acces-
  19511. sible to a given user.
  19512. Definition
  19513. CREATE VIEW VIEWS
  19514. AS SELECT
  19515. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  19516. CASE WHEN ( TABLE_CATALOG, TABLE_SCHEMA, CURRENT_USER )
  19517. IN ( SELECT CATALOG_NAME, SCHEMA_NAME, SCHEMA_
  19518. OWNER
  19519. FROM DEFINITION_SCHEMA.SCHEMATA )
  19520. THEN VIEW_DEFINITION
  19521. ELSE NULL
  19522. END AS VIEW_DEFINITION,
  19523. CHECK_OPTION, IS_UPDATABLE
  19524. FROM DEFINITION_SCHEMA.VIEWS
  19525. WHERE ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME )
  19526. IN ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  19527. FROM TABLES )
  19528. AND TABLE_CATALOG
  19529. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19530. CATALOG_NAME )
  19531. Leveling Rules
  19532. 1) The following restrictions apply for Intermediate SQL:
  19533. None.
  19534. 2) The following restrictions apply for Entry SQL in addition to
  19535. any Intermediate SQL restrictions:
  19536. a) Conforming Entry SQL language shall not reference the
  19537. Information Schema.
  19538. Information Schema and Definition Schema 543
  19539. X3H2-92-154/DBL CBR-002
  19540. 21.2 Information Schema
  19541. 21.2.9 COLUMNS view
  19542. Function
  19543. Identify the columns of tables defined in this catalog that are
  19544. accessible to a given user.
  19545. Definition
  19546. CREATE VIEW COLUMNS
  19547. AS SELECT DISTINCT
  19548. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  19549. C.COLUMN_NAME, ORDINAL_POSITION,
  19550. CASE WHEN EXISTS ( SELECT *
  19551. FROM DEFINITION_SCHEMA.SCHEMATA AS S
  19552. WHERE ( TABLE_CATALOG, TABLE_SCHEMA )
  19553. = (S.CATALOG_NAME, S.SCHEMA_NAME )
  19554. AND SCHEMA_OWNER = USER )
  19555. THEN COLUMN_DEFAULT
  19556. ELSE NULL
  19557. END AS COLUMN_DEFAULT,
  19558. IS_NULLABLE,
  19559. COALESCE (D1.DATA_TYPE, D2.DATA_TYPE) AS DATA_TYPE,
  19560. COALESCE (D1.CHARACTER_MAXIMUM_LENGTH, D2.CHARACTER_
  19561. MAXIMUM_LENGTH)
  19562. AS CHARACTER_MAXIMUM_LENGTH,
  19563. COALESCE (D1.CHARACTER_OCTET_LENGTH, D2.CHARACTER_OCTET_
  19564. LENGTH)
  19565. AS CHARACTER_OCTET_LENGTH,
  19566. COALESCE (D1.NUMERIC_PRECISION, D2.NUMERIC_PRECISION)
  19567. AS NUMERIC_PRECISION,
  19568. COALESCE (D1.NUMERIC_PRECISION_RADIX, D2.NUMERIC_PRECISION_
  19569. RADIX)
  19570. AS NUMERIC_PRECISION_RADIX,
  19571. COALESCE (D1.NUMERIC_SCALE, D2.NUMERIC_SCALE) AS NUMERIC_
  19572. SCALE,
  19573. COALESCE (D1.DATETIME_PRECISION, D2.DATETIME_PRECISION) AS
  19574. DATETIME_PRECISION,
  19575. COALESCE (C1.CHARACTER_SET_CATALOG, C2.CHARACTER_SET_
  19576. CATALOG)
  19577. AS CHARACTER_SET_CATALOG,
  19578. COALESCE (C1.CHARACTER_SET_SCHEMA, C2.CHARACTER_SET_SCHEMA)
  19579. AS CHARACTER_SET_SCHEMA,
  19580. COALESCE (C1.CHARACTER_SET_NAME, C2.CHARACTER_SET_NAME) AS
  19581. CHARACTER_SET_NAME,
  19582. COALESCE (D1.COLLATION_CATALOG, D2.COLLATION_CATALOG) AS
  19583. COLLATION_CATALOG,
  19584. COALESCE (D1.COLLATION_SCHEMA, D2.COLLATION_SCHEMA) AS
  19585. COLLATION_SCHEMA,
  19586. COALESCE (D1.COLLATION_NAME, D2.COLLATION_NAME) AS
  19587. COLLATION_NAME,
  19588. DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME
  19589. 544 Database Language SQL
  19590. X3H2-92-154/DBL CBR-002
  19591. 21.2 Information Schema
  19592. FROM DEFINITION_SCHEMA.COLUMNS AS C
  19593. LEFT JOIN
  19594. DEFINITION_SCHEMA.DATA_TYPE_DESCRIPTOR AS D1
  19595. LEFT JOIN
  19596. DEFINITION_SCHEMA.COLLATIONS AS C1
  19597. ON
  19598. ( ( C1.COLLATION_CATALOG, C1.COLLATION_SCHEMA, C1.COLLATION_
  19599. NAME )
  19600. = ( D1.COLLATION_CATALOG, D1.COLLATION_SCHEMA, D1.COLLATION_
  19601. NAME ) )
  19602. ON
  19603. ( ( C.TABLE_CATALOG, C.TABLE_SCHEMA, C.TABLE_NAME, C.COLUMN_
  19604. NAME )
  19605. = ( D1.TABLE_OR_DOMAIN_CATALOG, D1.TABLE_OR_DOMAIN_
  19606. SCHEMA,
  19607. D1.TABLE_OR_DOMAIN_NAME, D1.COLUMN_NAME ) )
  19608. LEFT JOIN
  19609. DEFINITION_SCHEMA.DATA_TYPE_DESCRIPTOR AS D2
  19610. LEFT JOIN
  19611. DEFINITION_SCHEMA.COLLATIONS AS C2
  19612. ON
  19613. ( ( C2.COLLATION_CATALOG, C2.COLLATION_SCHEMA, C2.COLLATION_
  19614. NAME )
  19615. = ( D2.COLLATION_CATALOG, D2.COLLATION_SCHEMA, D2.COLLATION_
  19616. NAME ) )
  19617. ON
  19618. ( ( C.DOMAIN_CATALOG, C.DOMAIN_SCHEMA, C.DOMAIN_NAME )
  19619. = ( D2.TABLE_OR_DOMAIN_CATALOG, D2.TABLE_OR_DOMAIN_
  19620. SCHEMA,
  19621. D2.TABLE_OR_DOMAIN_NAME ) )
  19622. WHERE ( C.TABLE_CATALOG, C.TABLE_SCHEMA, C.TABLE_
  19623. NAME, C.COLUMN_NAME )
  19624. IN
  19625. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  19626. NAME, COLUMN_NAME
  19627. FROM DEFINITION_SCHEMA.COLUMN_PRIVILEGES
  19628. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19629. AND C.TABLE_CATALOG
  19630. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19631. CATALOG_NAME )
  19632. Leveling Rules
  19633. 1) The following restrictions apply for Intermediate SQL:
  19634. None.
  19635. 2) The following restrictions apply for Entry SQL in addition to
  19636. any Intermediate SQL restrictions:
  19637. a) Conforming Entry SQL language shall not reference the
  19638. Information Schema.
  19639. Information Schema and Definition Schema 545
  19640. X3H2-92-154/DBL CBR-002
  19641. 21.2 Information Schema
  19642. 21.2.10 TABLE_PRIVILEGES view
  19643. Function
  19644. Identify the privileges on tables defined in this catalog that are
  19645. available to or granted by a given user.
  19646. Definition
  19647. CREATE VIEW TABLE_PRIVILEGES
  19648. AS SELECT
  19649. GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  19650. PRIVILEGE_TYPE, IS_GRANTABLE
  19651. FROM DEFINITION_SCHEMA.TABLE_PRIVILEGES
  19652. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER )
  19653. OR GRANTOR = CURRENT_USER
  19654. AND TABLE_CATALOG
  19655. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19656. CATALOG_NAME )
  19657. Leveling Rules
  19658. 1) The following restrictions apply for Intermediate SQL:
  19659. None.
  19660. 2) The following restrictions apply for Entry SQL in addition to
  19661. any Intermediate SQL restrictions:
  19662. a) Conforming Entry SQL language shall not reference the
  19663. Information Schema.
  19664. 546 Database Language SQL
  19665. X3H2-92-154/DBL CBR-002
  19666. 21.2 Information Schema
  19667. 21.2.11 COLUMN_PRIVILEGES view
  19668. Function
  19669. Identify the privileges on columns of tables defined in this cata-
  19670. log that are available to or granted by a given user.
  19671. Definition
  19672. CREATE VIEW COLUMN_PRIVILEGES
  19673. AS SELECT
  19674. GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  19675. NAME, COLUMN_NAME,
  19676. PRIVILEGE_TYPE, IS_GRANTABLE
  19677. FROM DEFINITION_SCHEMA.COLUMN_PRIVILEGES
  19678. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER )
  19679. OR GRANTOR = CURRENT_USER
  19680. AND TABLE_CATALOG
  19681. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19682. CATALOG_NAME )
  19683. Leveling Rules
  19684. 1) The following restrictions apply for Intermediate SQL:
  19685. None.
  19686. 2) The following restrictions apply for Entry SQL in addition to
  19687. any Intermediate SQL restrictions:
  19688. a) Conforming Entry SQL language shall not reference the
  19689. Information Schema.
  19690. Information Schema and Definition Schema 547
  19691. X3H2-92-154/DBL CBR-002
  19692. 21.2 Information Schema
  19693. 21.2.12 USAGE_PRIVILEGES view
  19694. Function
  19695. Identify the USAGE privileges on objects defined in this catalog
  19696. that are available to or granted by a given user.
  19697. Definition
  19698. CREATE VIEW USAGE_PRIVILEGES
  19699. AS SELECT
  19700. GRANTOR, GRANTEE, OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_
  19701. NAME,
  19702. OBJECT_TYPE, 'USAGE' AS PRIVILEGE_TYPE, IS_GRANTABLE
  19703. FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES
  19704. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER )
  19705. OR GRANTOR = CURRENT_USER
  19706. AND OBJECT_CATALOG
  19707. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19708. CATALOG_NAME )
  19709. Leveling Rules
  19710. 1) The following restrictions apply for Intermediate SQL:
  19711. None.
  19712. 2) The following restrictions apply for Entry SQL in addition to
  19713. any Intermediate SQL restrictions:
  19714. a) Conforming Entry SQL language shall not reference the
  19715. Information Schema.
  19716. 548 Database Language SQL
  19717. X3H2-92-154/DBL CBR-002
  19718. 21.2 Information Schema
  19719. 21.2.13 TABLE_CONSTRAINTS view
  19720. Function
  19721. Identify the table constraints defined in this catalog that are
  19722. owned by a given user.
  19723. Definition
  19724. CREATE VIEW TABLE_CONSTRAINTS
  19725. AS SELECT
  19726. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  19727. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  19728. CONSTRAINT_TYPE, IS_DEFERRABLE, INITIALLY_DEFERRED
  19729. FROM DEFINITION_SCHEMA.TABLE_CONSTRAINTS
  19730. JOIN
  19731. DEFINITION_SCHEMA.SCHEMATA S
  19732. ON
  19733. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19734. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19735. WHERE SCHEMA_OWNER = CURRENT_USER
  19736. AND CONSTRAINT_CATALOG
  19737. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19738. CATALOG_NAME )
  19739. Leveling Rules
  19740. 1) The following restrictions apply for Intermediate SQL:
  19741. None.
  19742. 2) The following restrictions apply for Entry SQL in addition to
  19743. any Intermediate SQL restrictions:
  19744. a) Conforming Entry SQL language shall not reference the
  19745. Information Schema.
  19746. Information Schema and Definition Schema 549
  19747. X3H2-92-154/DBL CBR-002
  19748. 21.2 Information Schema
  19749. 21.2.14 REFERENTIAL_CONSTRAINTS view
  19750. Function
  19751. Identify the referential constraints defined in this catalog that
  19752. are owned by a given user.
  19753. Definition
  19754. CREATE VIEW REFERENTIAL_CONSTRAINTS
  19755. AS SELECT
  19756. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  19757. UNIQUE_CONSTRAINT_CATALOG, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_
  19758. CONSTRAINT_NAME,
  19759. MATCH_OPTION, UPDATE_RULE, DELETE_RULE
  19760. FROM DEFINITION_SCHEMA.REFERENTIAL_CONSTRAINTS
  19761. JOIN
  19762. DEFINITION_SCHEMA.SCHEMATA S
  19763. ON
  19764. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19765. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19766. WHERE SCHEMA_OWNER = CURRENT_USER
  19767. AND CONSTRAINT_CATALOG
  19768. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19769. CATALOG_NAME )
  19770. Leveling Rules
  19771. 1) The following restrictions apply for Intermediate SQL:
  19772. None.
  19773. 2) The following restrictions apply for Entry SQL in addition to
  19774. any Intermediate SQL restrictions:
  19775. a) Conforming Entry SQL language shall not reference the
  19776. Information Schema.
  19777. 550 Database Language SQL
  19778. X3H2-92-154/DBL CBR-002
  19779. 21.2 Information Schema
  19780. 21.2.15 CHECK_CONSTRAINTS view
  19781. Function
  19782. Identify the check constraints defined in this catalog that are
  19783. owned by a given user.
  19784. Definition
  19785. CREATE VIEW CHECK_CONSTRAINTS
  19786. AS SELECT
  19787. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  19788. NAME, CHECK_CLAUSE
  19789. FROM DEFINITION_SCHEMA.CHECK_CONSTRAINTS
  19790. JOIN
  19791. DEFINITION_SCHEMA.SCHEMATA S
  19792. ON
  19793. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19794. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19795. WHERE SCHEMA_OWNER = CURRENT_USER
  19796. AND CONSTRAINT_CATALOG
  19797. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19798. CATALOG_NAME )
  19799. Leveling Rules
  19800. 1) The following restrictions apply for Intermediate SQL:
  19801. None.
  19802. 2) The following restrictions apply for Entry SQL in addition to
  19803. any Intermediate SQL restrictions:
  19804. a) Conforming Entry SQL language shall not reference the
  19805. Information Schema.
  19806. Information Schema and Definition Schema 551
  19807. X3H2-92-154/DBL CBR-002
  19808. 21.2 Information Schema
  19809. 21.2.16 KEY_COLUMN_USAGE view
  19810. Function
  19811. Identify the columns defined in this catalog that are constrained
  19812. as keys by a given user.
  19813. Definition
  19814. CREATE VIEW KEY_COLUMN_USAGE
  19815. AS SELECT
  19816. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  19817. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  19818. NAME, ORDINAL_POSITION
  19819. FROM DEFINITION_SCHEMA.KEY_COLUMN_USAGE
  19820. JOIN
  19821. DEFINITION_SCHEMA.SCHEMATA S
  19822. ON
  19823. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19824. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19825. WHERE SCHEMA_OWNER = CURRENT_USER
  19826. AND CONSTRAINT_CATALOG
  19827. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19828. CATALOG_NAME )
  19829. Leveling Rules
  19830. 1) The following restrictions apply for Intermediate SQL:
  19831. None.
  19832. 2) The following restrictions apply for Entry SQL in addition to
  19833. any Intermediate SQL restrictions:
  19834. a) Conforming Entry SQL language shall not reference the
  19835. Information Schema.
  19836. 552 Database Language SQL
  19837. X3H2-92-154/DBL CBR-002
  19838. 21.2 Information Schema
  19839. 21.2.17 ASSERTIONS view
  19840. Function
  19841. Identify the assertions defined in this catalog that are owned by a
  19842. given user.
  19843. Definition
  19844. CREATE VIEW ASSERTIONS
  19845. AS SELECT
  19846. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  19847. IS_DEFERRABLE, INITIALLY_DEFERRED
  19848. FROM DEFINITION_SCHEMA.ASSERTIONS
  19849. JOIN
  19850. DEFINITION_SCHEMA.SCHEMATA S
  19851. ON
  19852. ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  19853. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19854. WHERE SCHEMA_OWNER = CURRENT_USER
  19855. AND CONSTRAINT_CATALOG
  19856. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19857. CATALOG_NAME )
  19858. Leveling Rules
  19859. 1) The following restrictions apply for Intermediate SQL:
  19860. None.
  19861. 2) The following restrictions apply for Entry SQL in addition to
  19862. any Intermediate SQL restrictions:
  19863. a) Conforming Entry SQL language shall not reference the
  19864. Information Schema.
  19865. Information Schema and Definition Schema 553
  19866. X3H2-92-154/DBL CBR-002
  19867. 21.2 Information Schema
  19868. 21.2.18 CHARACTER_SETS view
  19869. Function
  19870. Identify the character sets defined in this catalog that are acces-
  19871. sible to a given user.
  19872. Definition
  19873. CREATE VIEW CHARACTER_SETS
  19874. AS SELECT
  19875. CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_
  19876. NAME,
  19877. FORM_OF_USE, NUMBER_OF_CHARACTERS,
  19878. DEFAULT_COLLATE_CATALOG, DEFAULT_COLLATE_SCHEMA, DEFAULT_
  19879. COLLATE_NAME
  19880. FROM DEFINITION_SCHEMA.CHARACTER_SETS
  19881. WHERE ( CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_
  19882. SET_NAME, 'CHARACTER SET')
  19883. IN
  19884. ( SELECT OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_
  19885. NAME, OBJECT_TYPE
  19886. FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES
  19887. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19888. AND CHARACTER_SET_CATALOG
  19889. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19890. CATALOG_NAME )
  19891. Leveling Rules
  19892. 1) The following restrictions apply for Intermediate SQL:
  19893. None.
  19894. 2) The following restrictions apply for Entry SQL in addition to
  19895. any Intermediate SQL restrictions:
  19896. a) Conforming Entry SQL language shall not reference the
  19897. Information Schema.
  19898. 554 Database Language SQL
  19899. X3H2-92-154/DBL CBR-002
  19900. 21.2 Information Schema
  19901. 21.2.19 COLLATIONS view
  19902. Function
  19903. Identify the character collations defined in this catalog that are
  19904. accessible to a given user.
  19905. Definition
  19906. CREATE VIEW COLLATIONS
  19907. AS SELECT
  19908. COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_NAME,
  19909. CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_
  19910. NAME,
  19911. PAD_ATTRIBUTE
  19912. FROM DEFINITION_SCHEMA.COLLATIONS
  19913. WHERE ( COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  19914. NAME, 'COLLATION')
  19915. IN
  19916. ( SELECT OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_
  19917. NAME, OBJECT_TYPE
  19918. FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES
  19919. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19920. AND COLLATION_CATALOG
  19921. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19922. CATALOG_NAME )
  19923. Leveling Rules
  19924. 1) The following restrictions apply for Intermediate SQL:
  19925. a) Conforming Intermediate SQL language shall not reference the
  19926. COLLATIONS view.
  19927. 2) The following restrictions apply for Entry SQL in addition to
  19928. any Intermediate SQL restrictions:
  19929. None.
  19930. Information Schema and Definition Schema 555
  19931. X3H2-92-154/DBL CBR-002
  19932. 21.2 Information Schema
  19933. 21.2.20 TRANSLATIONS view
  19934. Function
  19935. Identify the character translations defined in this catalog that
  19936. are accessible to a given user.
  19937. Definition
  19938. CREATE VIEW TRANSLATIONS
  19939. AS SELECT
  19940. TRANSLATION_CATALOG, TRANSLATION_SCHEMA, TRANSLATION_NAME,
  19941. SOURCE_CHARACTER_SET_CATALOG, SOURCE_CHARACTER_SET_SCHEMA,
  19942. SOURCE_CHARACTER_SET_NAME,
  19943. TARGET_CHARACTER_SET_CATALOG, TARGET_CHARACTER_SET_SCHEMA,
  19944. TARGET_CHARACTER_SET_NAME
  19945. FROM DEFINITION_SCHEMA.TRANSLATIONS
  19946. WHERE ( TRANSLATION_CATALOG, TRANSLATION_SCHEMA, TRANSLATION_
  19947. NAME, 'TRANSLATION')
  19948. IN
  19949. ( SELECT OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_
  19950. NAME, OBJECT_TYPE
  19951. FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES
  19952. WHERE GRANTEE IN ( 'PUBLIC', CURRENT_USER ) )
  19953. AND TRANSLATION_CATALOG
  19954. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19955. CATALOG_NAME )
  19956. Leveling Rules
  19957. 1) The following restrictions apply for Intermediate SQL:
  19958. a) Conforming Intermediate SQL language shall not reference the
  19959. TRANSLATIONS view.
  19960. 2) The following restrictions apply for Entry SQL in addition to
  19961. any Intermediate SQL restrictions:
  19962. None.
  19963. 556 Database Language SQL
  19964. X3H2-92-154/DBL CBR-002
  19965. 21.2 Information Schema
  19966. 21.2.21 VIEW_TABLE_USAGE view
  19967. Function
  19968. Identify the tables on which viewed tables defined in this catalog
  19969. and owned by a given user are dependent.
  19970. Definition
  19971. CREATE VIEW VIEW_TABLE_USAGE
  19972. AS SELECT
  19973. VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME,
  19974. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  19975. FROM DEFINITION_SCHEMA.VIEW_TABLE_USAGE
  19976. JOIN
  19977. DEFINITION_SCHEMA.SCHEMATA S
  19978. ON
  19979. ( ( TABLE_CATALOG, TABLE_SCHEMA ) =
  19980. ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  19981. WHERE SCHEMA_OWNER = CURRENT_USER
  19982. AND VIEW_CATALOG
  19983. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  19984. CATALOG_NAME )
  19985. Leveling Rules
  19986. 1) The following restrictions apply for Intermediate SQL:
  19987. None.
  19988. 2) The following restrictions apply for Entry SQL in addition to
  19989. any Intermediate SQL restrictions:
  19990. a) Conforming Entry SQL language shall not reference the
  19991. Information Schema.
  19992. Information Schema and Definition Schema 557
  19993. X3H2-92-154/DBL CBR-002
  19994. 21.2 Information Schema
  19995. 21.2.22 VIEW_COLUMN_USAGE view
  19996. Function
  19997. Identify the columns on which viewed tables defined in this catalog
  19998. and owned by a given user are dependent.
  19999. Definition
  20000. CREATE VIEW VIEW_COLUMN_USAGE AS
  20001. SELECT VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME,
  20002. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME
  20003. FROM DEFINITION_SCHEMA.VIEW_COLUMN_USAGE
  20004. JOIN
  20005. DEFINITION_SCHEMA.SCHEMATA S
  20006. ON
  20007. ( ( TABLE_CATALOG, TABLE_SCHEMA ) =
  20008. ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  20009. WHERE SCHEMA_OWNER = CURRENT_USER
  20010. AND VIEW_CATALOG
  20011. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  20012. CATALOG_NAME )
  20013. Leveling Rules
  20014. 1) The following restrictions apply for Intermediate SQL:
  20015. None.
  20016. 2) The following restrictions apply for Entry SQL in addition to
  20017. any Intermediate SQL restrictions:
  20018. a) Conforming Entry SQL language shall not reference the
  20019. Information Schema.
  20020. 558 Database Language SQL
  20021. X3H2-92-154/DBL CBR-002
  20022. 21.2 Information Schema
  20023. 21.2.23 CONSTRAINT_TABLE_USAGE view
  20024. Function
  20025. Identify the tables that are used by referential constraints,
  20026. unique constraints, check constraints, and assertions defined in
  20027. this catalog and owned by a given user.
  20028. Definition
  20029. CREATE VIEW CONSTRAINT_TABLE_USAGE
  20030. AS
  20031. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  20032. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20033. NAME FROM
  20034. (
  20035. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  20036. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20037. NAME
  20038. FROM DEFINITION_SCHEMA.CHECK_COLUMN_USAGE )
  20039. UNION
  20040. ( SELECT PK.TABLE_CATALOG, PK.TABLE_SCHEMA, PK.TABLE_NAME,
  20041. FK.CONSTRAINT_CATALOG, FK.CONSTRAINT_SCHEMA, FK.CONSTRAINT_
  20042. NAME
  20043. FROM
  20044. DEFINITION_SCHEMA.REFERENTIAL_CONSTRAINTS AS FK
  20045. JOIN
  20046. DEFINITION_SCHEMA.TABLE_CONSTRAINTS AS PK
  20047. ON
  20048. ( FK.UNIQUE_CONSTRAINT_CATALOG, FK.UNIQUE_
  20049. CONSTRAINT_SCHEMA,
  20050. FK.UNIQUE_CONSTRAINT_NAME )
  20051. = ( PK.CONSTRAINT_CATALOG, PK.CONSTRAINT_SCHEMA, PK.CONSTRAINT_
  20052. NAME )
  20053. )
  20054. )
  20055. JOIN
  20056. DEFINITION_SCHEMA.SCHEMATA S
  20057. ON
  20058. ( ( TABLE_CATALOG, TABLE_SCHEMA ) =
  20059. ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  20060. WHERE S.SCHEMA_OWNER = CURRENT_USER
  20061. AND CONSTRAINT_CATALOG
  20062. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  20063. CATALOG_NAME )
  20064. Information Schema and Definition Schema 559
  20065. X3H2-92-154/DBL CBR-002
  20066. 21.2 Information Schema
  20067. Leveling Rules
  20068. 1) The following restrictions apply for Intermediate SQL:
  20069. None.
  20070. 2) The following restrictions apply for Entry SQL in addition to
  20071. any Intermediate SQL restrictions:
  20072. a) Conforming Entry SQL language shall not reference the
  20073. Information Schema.
  20074. 560 Database Language SQL
  20075. X3H2-92-154/DBL CBR-002
  20076. 21.2 Information Schema
  20077. 21.2.24 CONSTRAINT_COLUMN_USAGE view
  20078. Function
  20079. Identify the columns used by referential constraints, unique con-
  20080. straints, check constraints, and assertions defined in this catalog
  20081. and owned by a given user.
  20082. Definition
  20083. CREATE VIEW CONSTRAINT_COLUMN_USAGE
  20084. AS
  20085. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20086. NAME,
  20087. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20088. NAME FROM
  20089. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20090. NAME,
  20091. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20092. NAME
  20093. FROM DEFINITION_SCHEMA.CHECK_COLUMN_USAGE )
  20094. UNION
  20095. ( SELECT K.TABLE_CATALOG, K.TABLE_SCHEMA, K.TABLE_
  20096. NAME, K.COLUMN_NAME,
  20097. CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20098. NAME
  20099. FROM DEFINITION_SCHEMA.TABLE_CONSTRAINTS
  20100. JOIN DEFINITION_SCHEMA.KEY_COLUMN_USAGE AS K
  20101. USING ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20102. NAME )
  20103. )
  20104. JOIN
  20105. DEFINITION_SCHEMA.SCHEMATA
  20106. ON
  20107. ( ( TABLE_CATALOG, TABLE_SCHEMA ) =
  20108. ( CATALOG_NAME, SCHEMA_NAME ) )
  20109. WHERE SCHEMA_OWNER = CURRENT_USER
  20110. AND CONSTRAINT_CATALOG
  20111. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  20112. CATALOG_NAME )
  20113. Leveling Rules
  20114. 1) The following restrictions apply for Intermediate SQL:
  20115. None.
  20116. 2) The following restrictions apply for Entry SQL in addition to
  20117. any Intermediate SQL restrictions:
  20118. a) Conforming Entry SQL language shall not reference the
  20119. Information Schema.
  20120. Information Schema and Definition Schema 561
  20121. X3H2-92-154/DBL CBR-002
  20122. 21.2 Information Schema
  20123. 21.2.25 COLUMN_DOMAIN_USAGE view
  20124. Function
  20125. Identify the columns defined in this catalog that are dependent on
  20126. a domain defined in this catalog and owned by a user.
  20127. Definition
  20128. CREATE VIEW COLUMN_DOMAIN_USAGE
  20129. AS SELECT
  20130. D.DOMAIN_CATALOG, D.DOMAIN_SCHEMA, D.DOMAIN_NAME,
  20131. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME
  20132. FROM DEFINITION_SCHEMA.COLUMNS C
  20133. JOIN
  20134. DEFINITION_SCHEMA.DOMAINS D
  20135. JOIN
  20136. DEFINITION_SCHEMA.SCHEMATA S
  20137. ON ( ( DOMAIN_CATALOG, DOMAIN_SCHEMA )
  20138. = ( S.CATALOG_NAME, S.SCHEMA_NAME ) )
  20139. ON ( ( D.DOMAIN_CATALOG, D.DOMAIN_SCHEMA, D.DOMAIN_
  20140. NAME )
  20141. = ( C.DOMAIN_CATALOG, C.DOMAIN_SCHEMA, C.DOMAIN_
  20142. NAME ) )
  20143. WHERE SCHEMA_OWNER = CURRENT_USER
  20144. AND C.DOMAIN_NAME IS NOT NULL
  20145. AND D.DOMAIN_CATALOG
  20146. = ( SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_
  20147. CATALOG_NAME )
  20148. Leveling Rules
  20149. 1) The following restrictions apply for Intermediate SQL:
  20150. None.
  20151. 2) The following restrictions apply for Entry SQL in addition to
  20152. any Intermediate SQL restrictions:
  20153. a) Conforming Entry SQL language shall not reference the
  20154. Information Schema.
  20155. 562 Database Language SQL
  20156. X3H2-92-154/DBL CBR-002
  20157. 21.2 Information Schema
  20158. 21.2.26 SQL_LANGUAGES view
  20159. Function
  20160. Identify the conformance levels, options, and dialects supported by
  20161. the SQL-implementation processing data defined in this catalog.
  20162. Definition
  20163. CREATE VIEW SQL_LANGUAGES
  20164. AS SELECT
  20165. SQL_LANGUAGE_SOURCE, SQL_LANGUAGE_YEAR, SQL_LANGUAGE_
  20166. CONFORMANCE,
  20167. SQL_LANGUAGE_INTEGRITY, SQL_LANGUAGE_IMPLEMENTATION,
  20168. SQL_LANGUAGE_BINDING_STYLE, SQL_LANGUAGE_PROGRAMMING_
  20169. LANGUAGE
  20170. FROM DEFINITION_SCHEMA.SQL_LANGUAGES
  20171. Leveling Rules
  20172. 1) The following restrictions apply for Intermediate SQL:
  20173. None.
  20174. 2) The following restrictions apply for Entry SQL in addition to
  20175. any Intermediate SQL restrictions:
  20176. a) Conforming Entry SQL language shall not reference the
  20177. Information Schema.
  20178. Information Schema and Definition Schema 563
  20179. X3H2-92-154/DBL CBR-002
  20180. 21.2 Information Schema
  20181. 21.2.27 SQL_IDENTIFIER domain
  20182. Function
  20183. Define a domain that contains all valid <identifier>s
  20184. Definition
  20185. CREATE DOMAIN SQL_IDENTIFIER AS CHARACTER VARYING (L)
  20186. CHARACTER SET SQL_TEXT
  20187. Description
  20188. 1) This domain specifies any variable-length character value that
  20189. conforms to the rules for an SQL <identifier>.
  20190. Note: There is no way in SQL to specify a <domain constraint>
  20191. that would be true for any valid SQL <identifier> and false for
  20192. all other values.
  20193. 2) L is the implementation-defined maximum length of <identifier>.
  20194. 21.2.28 CHARACTER_DATA domain
  20195. Function
  20196. Define a domain that contains any character data.
  20197. Definition
  20198. CREATE DOMAIN CHARACTER_DATA AS CHARACTER VARYING (ML)
  20199. CHARACTER SET SQL_TEXT
  20200. Description
  20201. 1) This domain specifies any character data.
  20202. 2) ML is the implementation-defined maximum length of a variable-
  20203. length character string.
  20204. 564 Database Language SQL
  20205. X3H2-92-154/DBL CBR-002
  20206. 21.2 Information Schema
  20207. 21.2.29 CARDINAL_NUMBER domain
  20208. Function
  20209. Define a domain that contains a non-negative number.
  20210. Definition
  20211. CREATE DOMAIN CARDINAL_NUMBER AS INTEGER
  20212. CONSTRAINT CARDINAL_NUMBER_DOMAIN_CHECK CHECK ( VALUE >= 0 )
  20213. Description
  20214. 1) The domain CARDINAL_NUMBER contains any non-negative number
  20215. that is less than the implementation-defined maximum for INTEGER
  20216. (i.e., the implementation-defined value of NUMERIC_PRECISION_
  20217. RADIX raised to the power of implementation-defined NUMERIC_
  20218. PRECISION).
  20219. Information Schema and Definition Schema 565
  20220. X3H2-92-154/DBL CBR-002
  20221. 21.3 Definition Schema
  20222. 21.3 Definition Schema
  20223. 21.3.1 Introduction
  20224. The base tables are all defined in a <schema definition> for the
  20225. schema named DEFINITION_SCHEMA. The table definitions are as com-
  20226. plete as the definitional power of SQL allows. The table defi-
  20227. nitions are supplemented with assertions where appropriate; see
  20228. Subclause 21.4, "Assertions on the base tables". Each description
  20229. comprises three parts:
  20230. 1) The function of the definition is stated.
  20231. 2) The SQL definition of the object is presented as a <table defi-
  20232. nition>.
  20233. 3) An explanation of the object.
  20234. The specification provides only a model of the base tables that are
  20235. required, and does not imply that an implementation shall provide
  20236. the functionality in the manner described in this clause.
  20237. An instance of a definition schema describes an instance of a clus-
  20238. ter of catalogs (see Subclause 4.13, "Clusters of catalogs").
  20239. 566 Database Language SQL
  20240. X3H2-92-154/DBL CBR-002
  20241. 21.3 Definition Schema
  20242. 21.3.2 DEFINITION_SCHEMA Schema
  20243. Function
  20244. Create the schema that is to contain the base tables that underlie
  20245. the Information Schema
  20246. Definition
  20247. CREATE SCHEMA DEFINITION_SCHEMA
  20248. AUTHORIZATION DEFINITION_SCHEMA
  20249. Description
  20250. None.
  20251. Information Schema and Definition Schema 567
  20252. X3H2-92-154/DBL CBR-002
  20253. 21.3 Definition Schema
  20254. 21.3.3 USERS base table
  20255. Function
  20256. The USERS table has one row for each <authorization identifier>
  20257. referenced in the Information Schema of the catalog. These are
  20258. all those <authorization identifier>s that may grant or receive
  20259. privileges as well as those that may create a schema, or currently
  20260. own a schema created through a <schema definition>.
  20261. Definition
  20262. CREATE TABLE USERS
  20263. (
  20264. USER_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  20265. CONSTRAINT USERS_PRIMARY_KEY PRIMARY KEY
  20266. )
  20267. Description
  20268. 1) The values of USER_NAME are <authorization identifier>s that are
  20269. known.
  20270. 568 Database Language SQL
  20271. X3H2-92-154/DBL CBR-002
  20272. 21.3 Definition Schema
  20273. 21.3.4 SCHEMATA base table
  20274. Function
  20275. The SCHEMATA table has one row for each schema.
  20276. Definition
  20277. CREATE TABLE SCHEMATA
  20278. (
  20279. CATALOG_NAME INFORMATION_SCHEMA.SQL_
  20280. IDENTIFIER,
  20281. SCHEMA_NAME INFORMATION_SCHEMA.SQL_
  20282. IDENTIFIER,
  20283. SCHEMA_OWNER INFORMATION_SCHEMA.SQL_
  20284. IDENTIFIER
  20285. CONSTRAINT SCHEMA_OWNER_NOT_NULL NOT NULL,
  20286. DEFAULT_CHARACTER_SET_CATALOG INFORMATION_SCHEMA.SQL_
  20287. IDENTIFIER,
  20288. DEFAULT_CHARACTER_SET_SCHEMA INFORMATION_SCHEMA.SQL_
  20289. IDENTIFIER,
  20290. DEFAULT_CHARACTER_SET_NAME INFORMATION_SCHEMA.SQL_
  20291. IDENTIFIER,
  20292. CONSTRAINT SCHEMATA_PRIMARY_KEY PRIMARY KEY ( CATALOG_
  20293. NAME, SCHEMA_NAME ),
  20294. CONSTRAINT SCHEMATA_FOREIGN_KEY FOREIGN KEY ( SCHEMA_OWNER )
  20295. REFERENCES USERS
  20296. )
  20297. Description
  20298. 1) All the values of CATALOG_NAME are the name of the catalog in
  20299. which the schemata are included.
  20300. 2) The values of SCHEMA_NAME are the unqualified schema names of
  20301. the schemata in the catalog.
  20302. 3) The values of SCHEMA_OWNER are the authorization identifiers
  20303. that own the schemata.
  20304. 4) The values of DEFAULT_CHARACTER_SET_CATALOG, DEFAULT_CHARACTER_
  20305. SET_SCHEMA, and DEFAULT_CHARACTER_SET_NAME are the catalog name,
  20306. unqualified schema name, and qualified identifier, respectively,
  20307. of the default character set for columns and domains in the
  20308. schemata.
  20309. Information Schema and Definition Schema 569
  20310. X3H2-92-154/DBL CBR-002
  20311. 21.3 Definition Schema
  20312. 21.3.5 DATA_TYPE_DESCRIPTOR base table
  20313. Function
  20314. The DATA_TYPE_DESCRIPTOR table has one row for each domain and
  20315. one row for each column (in each table) that is defined as hav-
  20316. ing a data type rather than a domain. It effectively contains a
  20317. representation of the data type descriptors.
  20318. Definition
  20319. CREATE TABLE DATA_TYPE_DESCRIPTOR
  20320. (
  20321. TABLE_OR_DOMAIN_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20322. TABLE_OR_DOMAIN_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20323. TABLE_OR_DOMAIN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20324. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20325. DATA_TYPE INFORMATION_SCHEMA.CHARACTER_DATA
  20326. CONSTRAINT TABLE_OR_DOMAIN_DATA_TYPE_NOT_NULL NOT NULL,
  20327. CHARACTER_MAXIMUM_LENGTH INFORMATION_SCHEMA.CARDINAL_
  20328. NUMBER,
  20329. CHARACTER_OCTET_LENGTH INFORMATION_SCHEMA.CARDINAL_
  20330. NUMBER,
  20331. COLLATION_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20332. COLLATION_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20333. COLLATION_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20334. NUMERIC_PRECISION INFORMATION_SCHEMA.CARDINAL_
  20335. NUMBER,
  20336. NUMERIC_PRECISION_RADIX INFORMATION_SCHEMA.CARDINAL_
  20337. NUMBER,
  20338. NUMERIC_SCALE INFORMATION_SCHEMA.CARDINAL_
  20339. NUMBER,
  20340. DATETIME_PRECISION INFORMATION_SCHEMA.CARDINAL_
  20341. NUMBER,
  20342. CONSTRAINT TABLE_OR_DOMAIN_CHECK_COMBINATIONS
  20343. CHECK ( DATA_TYPE IN ( 'CHARACTER', 'CHARACTER VARYING',
  20344. 'BIT', 'BIT VARYING' )
  20345. AND ( CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_
  20346. LENGTH,
  20347. COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20348. NAME )
  20349. IS NOT NULL
  20350. AND ( NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX,
  20351. NUMERIC_SCALE, DATETIME_PRECISION ) IS NULL
  20352. 570 Database Language SQL
  20353. X3H2-92-154/DBL CBR-002
  20354. 21.3 Definition Schema
  20355. OR
  20356. DATA_TYPE IN ( 'REAL', 'DOUBLE PRECISION', 'FLOAT' )
  20357. AND ( CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_
  20358. LENGTH,
  20359. COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20360. NAME )
  20361. IS NULL
  20362. AND NUMERIC_PRECISION IS NOT NULL
  20363. AND NUMERIC_PRECISION_RADIX = 2
  20364. AND NUMERIC_SCALE IS NULL
  20365. AND DATETIME_PRECISION IS NULL
  20366. OR
  20367. DATA_TYPE IN ( 'INTEGER', 'SMALLINT', 'NUMERIC',
  20368. 'DECIMAL' )
  20369. AND ( CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_
  20370. LENGTH,
  20371. COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20372. NAME )
  20373. IS NULL
  20374. AND NUMERIC_SCALE IS NOT NULL
  20375. AND ( NUMERIC_SCALE <> 0 AND NUMERIC_PRECISION_
  20376. RADIX = 10
  20377. OR
  20378. NUMERIC_SCALE = 0 AND NUMERIC_PRECISION_RADIX
  20379. IN ( 2, 10 ) )
  20380. AND DATETIME_PRECISION IS NULL
  20381. OR
  20382. DATA_TYPE IN ( 'DATE', 'TIME', 'TIMESTAMP',
  20383. 'TIME WITH TIME ZONE', 'TIMESTAMP
  20384. WITH TIME ZONE',
  20385. 'INTERVAL' )
  20386. AND ( CHARACTER_MAXIMUM_LENGTH,
  20387. CHARACTER_OCTET_LENGTH,
  20388. COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20389. NAME )
  20390. IS NULL
  20391. AND ( NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX )
  20392. IS NULL
  20393. AND NUMERIC_SCALE IS NULL
  20394. AND DATETIME_PRECISION IS NOT NULL
  20395. ),
  20396. CONSTRAINT DATA_TYPE_DESCRIPTOR_PRIMARY_KEY
  20397. PRIMARY KEY ( TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_
  20398. SCHEMA,
  20399. TABLE_OR_DOMAIN_NAME, COLUMN_NAME ),
  20400. CONSTRAINT DATA_TYPE_CHECK_REFERENCES_COLLATION
  20401. CHECK ( COLLATION_CATALOG
  20402. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20403. OR
  20404. ( COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20405. NAME ) IN
  20406. Information Schema and Definition Schema 571
  20407. X3H2-92-154/DBL CBR-002
  20408. 21.3 Definition Schema
  20409. ( SELECT COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20410. NAME
  20411. FROM COLLATIONS ) ),
  20412. CONSTRAINT DATA_TYPE_DESCRIPTOR_CHECK_USED
  20413. CHECK ( (TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_SCHEMA,
  20414. TABLE_OR_DOMAIN_NAME, COLUMN_NAME)
  20415. IN (
  20416. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20417. NAME
  20418. FROM COLUMNS
  20419. UNION
  20420. SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, ''
  20421. FROM DOMAINS )
  20422. )
  20423. )
  20424. Description
  20425. 1) The values of TABLE_OR_DOMAIN_CATALOG and TABLE_OR_DOMAIN_
  20426. SCHEMA are the catalog name and the unqualified schema name,
  20427. respectively, of the schema that contains the object (domain or
  20428. column) to which the data type descriptor belongs.
  20429. 2) Case:
  20430. a) If the length of COLUMN_NAME is 0, then the value of TABLE_
  20431. OR_DOMAIN_NAME is the name of the domain to which the data
  20432. type descriptor belongs.
  20433. b) Otherwise, TABLE_OR_DOMAIN_NAME is the name of the table and
  20434. COLUMN_NAME is the name of the column in that table to which
  20435. the data type descriptor belongs.
  20436. 3) The values of DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_
  20437. OCTET_LENGTH, COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  20438. NAME, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE,
  20439. and DATETIME_PRECISION contain the data type of the domain or
  20440. column being defined, the maximum length in characters or bits
  20441. of the column if it is a character or bit type respectively,
  20442. maximum length in octets of the column if it is a character
  20443. type, the qualified name of the applicable collation if it is
  20444. a character type, the precision and radix of the precision if
  20445. it is a numeric type, and the precision if it is a datetime or
  20446. interval type.
  20447. 572 Database Language SQL
  20448. X3H2-92-154/DBL CBR-002
  20449. 21.3 Definition Schema
  20450. 21.3.6 DOMAINS base table
  20451. Function
  20452. The DOMAINS table has one row for each domain. It effectively con-
  20453. tains a representation of the domain descriptors.
  20454. Definition
  20455. CREATE TABLE DOMAINS
  20456. (
  20457. DOMAIN_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20458. DOMAIN_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20459. DOMAIN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20460. DOMAIN_DEFAULT INFORMATION_SCHEMA.CHARACTER_DATA,
  20461. CONSTRAINT DOMAINS_PRIMARY_KEY
  20462. PRIMARY KEY ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME ),
  20463. CONSTRAINT DOMAINS_FOREIGN_KEY_SCHEMATA
  20464. FOREIGN KEY ( DOMAIN_CATALOG, DOMAIN_SCHEMA ) REFERENCES SCHEMATA,
  20465. CONSTRAINT DOMAINS_CHECK_DATA_TYPE
  20466. CHECK ( DOMAIN_CATALOG
  20467. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20468. OR
  20469. ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, '' ) IN
  20470. ( SELECT TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_
  20471. SCHEMA,
  20472. TABLE_OR_DOMAIN_NAME, COLUMN_NAME
  20473. FROM DATA_TYPE_DESCRIPTOR ) )
  20474. )
  20475. Description
  20476. 1) The values of DOMAIN_CATALOG and DOMAIN_SCHEMA are the catalog
  20477. name and unqualified schema name, respectively, of the schema in
  20478. which the domain is defined.
  20479. 2) The value of DOMAIN_NAME is the name of the domain.
  20480. 3) The value of DOMAIN_DEFAULT is null if the domain being de-
  20481. scribed has no default value. Otherwise, the value of DOMAIN_
  20482. DEFAULT is a character representation of the default value for
  20483. the domain that obeys the rules specified for <default option>
  20484. in Subclause 11.5, "<default clause>".
  20485. Information Schema and Definition Schema 573
  20486. X3H2-92-154/DBL CBR-002
  20487. 21.3 Definition Schema
  20488. 21.3.7 DOMAIN_CONSTRAINTS base table
  20489. Function
  20490. The DOMAIN_CONSTRAINTS table has one row for each domain constraint
  20491. associated with a domain. It effectively contains a representation
  20492. of the domain constraint descriptors.
  20493. Definition
  20494. CREATE TABLE DOMAIN_CONSTRAINTS
  20495. (
  20496. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20497. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20498. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20499. DOMAIN_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER
  20500. CONSTRAINT DOMAIN_CATALOG_NOT_NULL NOT NULL,
  20501. DOMAIN_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER
  20502. CONSTRAINT DOMAIN_SCHEMA_NOT_NULL NOT NULL,
  20503. DOMAIN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  20504. CONSTRAINT DOMAIN_NAME_NOT_NULL NOT NULL,
  20505. IS_DEFERRABLE INFORMATION_SCHEMA.CHARACTER_DATA
  20506. CONSTRAINT DOMAIN_CONSTRAINTS_DEFERRABLE_NOT_NULL NOT NULL,
  20507. INITIALLY_DEFERRED INFORMATION_SCHEMA.CHARACTER_DATA
  20508. CONSTRAINT DOMAIN_CONSTRAINTS_INITIALLY_DEFERRED_NOT_NULL
  20509. NOT NULL,
  20510. CONSTRAINT DOMAIN_CONSTRAINTS_PRIMARY_KEY
  20511. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20512. NAME ),
  20513. CONSTRAINT DOMAIN_CONSTRAINTS_FOREIGN_KEY_SCHEMATA
  20514. FOREIGN KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  20515. REFERENCES SCHEMATA,
  20516. CONSTRAINT DOMAIN_CONSTRAINTS_FOREIGN_KEY_CHECK_CONSTRAINTS
  20517. FOREIGN KEY ( DOMAIN_CATALOG, DOMAIN_SCHEMA, CONSTRAINT_
  20518. NAME )
  20519. REFERENCES CHECK_CONSTRAINTS,
  20520. CONSTRAINT DOMAIN_CONSTRAINTS_FOREIGN_KEY_DOMAINS
  20521. FOREIGN KEY ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME )
  20522. REFERENCES DOMAINS,
  20523. CONSTRAINT DOMAIN_CONSTRAINTS_CHECK_DEFERRABLE
  20524. CHECK ( ( IS_DEFERRABLE, INITIALLY_DEFERRED ) IN
  20525. ( VALUES ( 'NO', 'NO' ),
  20526. ( 'YES', 'NO' ),
  20527. ( 'YES', 'YES' ) ) )
  20528. )
  20529. 574 Database Language SQL
  20530. X3H2-92-154/DBL CBR-002
  20531. 21.3 Definition Schema
  20532. Description
  20533. 1) The values of CONSTRAINT_CATALOG and CONSTRAINT_SCHEMA are the
  20534. catalog name and unqualified schema name of the schema in which
  20535. the domain constraint is defined.
  20536. 2) The value of CONSTRAINT_NAME is the name of the domain con-
  20537. straint.
  20538. 3) The values of DOMAIN_CATALOG, DOMAIN_SCHEMA and DOMAIN_NAME
  20539. are the catalog name, unqualified schema name, and qualified
  20540. identifier, respectively, of the domain in which the domain
  20541. constraint is defined.
  20542. 4) The values of IS_DEFERRABLE have the following meanings:
  20543. YES The domain constraint is deferrable.
  20544. NO The domain constraint is not deferrable.
  20545. 5) The values of INITIALLY_DEFERRED have the following meanings:
  20546. YES The domain constraint is initially deferred.
  20547. NO The domain constraint is initially immediate.
  20548. Information Schema and Definition Schema 575
  20549. X3H2-92-154/DBL CBR-002
  20550. 21.3 Definition Schema
  20551. 21.3.8 TABLES base table
  20552. Function
  20553. The TABLES table contains one row for each table including views.
  20554. It effectively contains a representation of the table descriptors.
  20555. Definition
  20556. CREATE TABLE TABLES
  20557. (
  20558. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20559. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20560. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20561. TABLE_TYPE INFORMATION_SCHEMA.CHARACTER_DATA
  20562. CONSTRAINT TABLE_TYPE_NOT_NULL NOT NULL,
  20563. CONSTRAINT TABLE_TYPE_CHECK CHECK ( TABLE_TYPE IN
  20564. ( 'BASE TABLE', 'VIEW', 'GLOBAL TEMPORARY', 'LOCAL TEMPORARY' ) ),
  20565. CONSTRAINT CHECK_TABLE_IN_COLUMNS
  20566. CHECK ( ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  20567. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20568. FROM COLUMNS ) ),
  20569. CONSTRAINT TABLES_PRIMARY_KEY
  20570. PRIMARY KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ),
  20571. CONSTRAINT TABLES_FOREIGN_KEY_SCHEMATA
  20572. FOREIGN KEY ( TABLE_CATALOG, TABLE_SCHEMA )
  20573. REFERENCES SCHEMATA,
  20574. CONSTRAINT TABLES_CHECK_NOT_VIEW CHECK ( NOT EXCEPTIONEXISTS
  20575. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20576. FROM TABLES
  20577. WHERE TABLE_TYPE = 'VIEW'
  20578. EXCEPT
  20579. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20580. FROM VIEWS ) )
  20581. )
  20582. Description
  20583. 1) The values of TABLE_CATALOG and TABLE_SCHEMA are the catalog
  20584. name and unqualified schema name, respectively, of the schema in
  20585. which the table is defined.
  20586. 2) The value of TABLE_NAME is the name of the table.
  20587. 3) The values of TABLE_TYPE have the following meanings:
  20588. 576 Database Language SQL
  20589. X3H2-92-154/DBL CBR-002
  20590. 21.3 Definition Schema
  20591. BASE TABLE The table being described is a persistent base
  20592. table.
  20593. VIEW The table being described is a viewed table.
  20594. GLOBAL The table being described is a global temporary
  20595. TEMPORARY table.
  20596. LOCAL The table being described is a created local
  20597. TEMPORARY temporary table.
  20598. Information Schema and Definition Schema 577
  20599. X3H2-92-154/DBL CBR-002
  20600. 21.3 Definition Schema
  20601. 21.3.9 VIEWS base table
  20602. Function
  20603. The VIEWS table contains one row for each row in the TABLES ta-
  20604. ble with a TABLE_TYPE of 'VIEW'. Each row describes the query
  20605. expression that defines a view. The table effectively contains a
  20606. representation of the view descriptors.
  20607. Definition
  20608. CREATE TABLE VIEWS
  20609. (
  20610. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20611. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20612. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20613. VIEW_DEFINITION INFORMATION_SCHEMA.CHARACTER_DATA,
  20614. CHECK_OPTION INFORMATION_SCHEMA.CHARACTER_DATA
  20615. CONSTRAINT CHECK_OPTION_NOT_NULL NOT NULL
  20616. CONSTRAINT CHECK_OPTION_CHECK
  20617. CHECK ( CHECK_OPTION IN ( 'CASCADED', 'LOCAL', 'NONE' ) ),
  20618. IS_UPDATABLE INFORMATION_SCHEMA.CHARACTER_DATA
  20619. CONSTRAINT IS_UPDATABLE_NOT_NULL NOT NULL
  20620. CONSTRAINT IS_UPDATABLE_CHECK
  20621. CHECK ( IS_UPDATABLE IN ( 'YES', 'NO' ) ),
  20622. CONSTRAINT VIEWS_PRIMARY_KEY
  20623. PRIMARY KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ),
  20624. CONSTRAINT VIEWS_IN_TABLES_CHECK
  20625. CHECK ( ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  20626. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20627. FROM TABLES
  20628. WHERE TABLE_TYPE = 'VIEW' ) ),
  20629. CONSTRAINT VIEWS_IS_UPDATABLE_CHECK_OPTION_CHECK
  20630. CHECK ( ( IS_UPDATABLE, CHECK_OPTION ) NOT IN
  20631. ( VALUES ( 'NO', 'CASCADED' ), ( 'NO', 'LOCAL' ) ) )
  20632. )
  20633. Description
  20634. 1) The values of TABLE_CATALOG and TABLE_SCHEMA are the catalog
  20635. name and unqualified schema name, respectively, of the schema in
  20636. which the viewed table is defined.
  20637. 2) The value of TABLE_NAME is the name of the viewed table.
  20638. 578 Database Language SQL
  20639. X3H2-92-154/DBL CBR-002
  20640. 21.3 Definition Schema
  20641. 3) Case:
  20642. a) If the character representation of the <query expression>
  20643. contained in the <view definition> that defined the view be-
  20644. ing described can be represented without truncation, then the
  20645. value of VIEW_DEFINITION is that character representation.
  20646. b) Otherwise, the value of VIEW_DEFINITION is the null value.
  20647. Note: Any implicit <column reference>s that were contained in
  20648. the <query expression> associated with the <view definition> are
  20649. replaced by explicit <column reference>s in VIEW_DEFINITION.
  20650. 4) The values of CHECK_OPTION have the following meanings:
  20651. CASCADED The <view definition> contains WITH CASCADED CHECK
  20652. OPTION.
  20653. LOCAL The <view definition> contains WITH LOCAL CHECK OPTION.
  20654. NONE The <view definition> does not contain WITH CHECK
  20655. OPTION.
  20656. 5) The values of IS_UPDATABLE have the following meanings:
  20657. YES The <view definition> simply contains a <query expres-
  20658. sion> that is updatable.
  20659. NO The <view definition> simply contains a <query expres-
  20660. sion> that is not updatable.
  20661. Information Schema and Definition Schema 579
  20662. X3H2-92-154/DBL CBR-002
  20663. 21.3 Definition Schema
  20664. 21.3.10 COLUMNS base table
  20665. Function
  20666. The COLUMNS table has one row for each column. It effectively con-
  20667. tains a representation of the column descriptors.
  20668. Definition
  20669. CREATE TABLE COLUMNS
  20670. (
  20671. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20672. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20673. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20674. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20675. ORDINAL_POSITION INFORMATION_SCHEMA.CARDINAL_NUMBER
  20676. CONSTRAINT COLUMN_POSITION_NOT_NULL NOT NULL,
  20677. DOMAIN_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20678. DOMAIN_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20679. DOMAIN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20680. COLUMN_DEFAULT INFORMATION_SCHEMA.CHARACTER_DATA,
  20681. IS_NULLABLE INFORMATION_SCHEMA.CHARACTER_DATA,
  20682. CONSTRAINT COLUMNS_PRIMARY_KEY
  20683. PRIMARY KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20684. NAME ),
  20685. CONSTRAINT COLUMNS_UNIQUE
  20686. UNIQUE ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, ORDINAL_
  20687. POSITION ),
  20688. CONSTRAINT COLUMNS_FOREIGN_KEY_TABLES
  20689. FOREIGN KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME )
  20690. REFERENCES TABLES,
  20691. CONSTRAINT COLUMNS_CHECK_REFERENCES_DOMAIN
  20692. CHECK ( DOMAIN_CATALOG
  20693. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20694. OR
  20695. ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME ) IN
  20696. ( SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME
  20697. FROM DOMAINS ) ),
  20698. CONSTRAINT COLUMNS_CHECK_DATA_TYPE
  20699. CHECK ( DOMAIN_CATALOG
  20700. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20701. OR
  20702. ( ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME )
  20703. IS NOT NULL
  20704. AND
  20705. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20706. NAME ) NOT IN
  20707. 580 Database Language SQL
  20708. X3H2-92-154/DBL CBR-002
  20709. 21.3 Definition Schema
  20710. ( SELECT TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_
  20711. SCHEMA,
  20712. TABLE_OR_DOMAIN_NAME, COLUMN_NAME
  20713. FROM DATA_TYPE_DESCRIPTOR )
  20714. OR
  20715. ( DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME ) IS NULL
  20716. AND
  20717. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20718. NAME ) IN
  20719. ( SELECT TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_
  20720. SCHEMA,
  20721. TABLE_OR_DOMAIN_NAME, COLUMN_NAME
  20722. FROM DATA_TYPE_DESCRIPTOR )
  20723. ) )
  20724. )
  20725. Description
  20726. 1) Case:
  20727. a) If a column is described by a column descriptor included in
  20728. a table descriptor, then the table descriptor and the column
  20729. descriptor are associated with that column.
  20730. b) If a column is described by a column descriptor included in a
  20731. view descriptor, then the view descriptor and the correspond-
  20732. ing column descriptor of the table of the <query expression>
  20733. are associated with that column.
  20734. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are
  20735. the catalog name, unqualified schema name, and qualified iden-
  20736. tifier, respectively, of the table containing the column being
  20737. described.
  20738. 3) The value of COLUMN_NAME is the name of the column being de-
  20739. scribed.
  20740. 4) The values of DOMAIN_CATALOG, DOMAIN_SCHEMA, and DOMAIN_NAME
  20741. are null if the column being described is not defined using a
  20742. <domain name>. Otherwise, the values of DOMAIN_CATALOG, DOMAIN_
  20743. SCHEMA, and DOMAIN_NAME are the catalog name, unqualified schema
  20744. name, and qualified identifier, respectively, of the domain used
  20745. by the column being described.
  20746. 5) The value of ORDINAL_POSITION is the ordinal position of the
  20747. column in the table.
  20748. 6) The value of COLUMN_DEFAULT is null if the column being de-
  20749. scribed has no default value or if its default value comes
  20750. only from a domain. Otherwise, the value of COLUMN_DEFAULT is
  20751. a character representation of the default value for the col-
  20752. umn that obeys the rules specified for <default option> in
  20753. Subclause 11.5, "<default clause>".
  20754. Information Schema and Definition Schema 581
  20755. X3H2-92-154/DBL CBR-002
  20756. 21.3 Definition Schema
  20757. 7) The values of IS_NULLABLE have the following meanings:
  20758. YES The columns is possibly nullable.
  20759. NO The column is known not nullable.
  20760. 582 Database Language SQL
  20761. X3H2-92-154/DBL CBR-002
  20762. 21.3 Definition Schema
  20763. 21.3.11 VIEW_TABLE_USAGE base table
  20764. Function
  20765. The VIEW_TABLE_USAGE table has one row for each table referenced in
  20766. the <query expression> of a view.
  20767. Definition
  20768. CREATE TABLE VIEW_TABLE_USAGE
  20769. (
  20770. VIEW_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20771. VIEW_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20772. VIEW_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20773. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20774. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20775. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20776. CONSTRAINT VIEW_TABLE_USAGE_PRIMARY_KEY
  20777. PRIMARY KEY ( VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME,
  20778. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ),
  20779. CONSTRAINT VIEW_TABLE_USAGE_CHECK_REFERENCES_TABLES
  20780. CHECK ( TABLE_CATALOG
  20781. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20782. OR
  20783. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  20784. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20785. FROM TABLES ) ),
  20786. CONSTRAINT VIEW_TABLE_USAGE_FOREIGN_KEY_VIEWS
  20787. FOREIGN KEY ( VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME )
  20788. REFERENCES VIEWS
  20789. )
  20790. Description
  20791. 1) The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the
  20792. catalog name, unqualified schema name, and qualified identifier,
  20793. respectively, of the view being described.
  20794. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are
  20795. the catalog name, unqualified schema name, and qualified identi-
  20796. fier, respectively, of a table view requires.
  20797. Information Schema and Definition Schema 583
  20798. X3H2-92-154/DBL CBR-002
  20799. 21.3 Definition Schema
  20800. 21.3.12 VIEW_COLUMN_USAGE base table
  20801. Function
  20802. The VIEW_COLUMN_USAGE table has one row for each column referenced
  20803. by a view.
  20804. Definition
  20805. CREATE TABLE VIEW_COLUMN_USAGE
  20806. (
  20807. VIEW_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20808. VIEW_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20809. VIEW_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20810. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20811. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20812. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20813. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20814. CONSTRAINT VIEW_COLUMN_USAGE_PRIMARY_KEY
  20815. PRIMARY KEY ( VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME,
  20816. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20817. NAME ),
  20818. CONSTRAINT VIEW_COLUMN_USAGE_CHECK_REFERENCES_COLUMNS
  20819. CHECK ( TABLE_CATALOG
  20820. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20821. OR
  20822. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20823. NAME ) IN
  20824. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  20825. NAME, COLUMN_NAME
  20826. FROM COLUMNS ) ),
  20827. CONSTRAINT VIEW_COLUMN_USAGE_FOREIGN_KEY_VIEWS
  20828. FOREIGN KEY ( VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME )
  20829. REFERENCES VIEWS
  20830. )
  20831. Description
  20832. 1) The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the
  20833. catalog name, unqualified schema name, and qualified identifier,
  20834. respectively, of the view being described.
  20835. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and
  20836. COLUMN_NAME are the catalog name, unqualified schema name, qual-
  20837. ified identifier, and identifier, respectively, of a column that
  20838. is explicitly or implicitly referenced in the <query expression>
  20839. of the view being described.
  20840. 584 Database Language SQL
  20841. X3H2-92-154/DBL CBR-002
  20842. 21.3 Definition Schema
  20843. 21.3.13 TABLE_CONSTRAINTS base table
  20844. Function
  20845. The TABLE_CONSTRAINTS table has one row for each table constraint
  20846. associated with a table. It effectively contains a representation
  20847. of the table constraint descriptors.
  20848. Definition
  20849. CREATE TABLE TABLE_CONSTRAINTS
  20850. (
  20851. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20852. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20853. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20854. CONSTRAINT_TYPE INFORMATION_SCHEMA.CHARACTER_DATA
  20855. CONSTRAINT CONSTRAINT_TYPE_NOT_NULL NOT NULL
  20856. CONSTRAINT CONSTRAINT_TYPE_CHECK
  20857. CHECK ( CONSTRAINT_TYPE IN
  20858. ( 'UNIQUE',
  20859. 'PRIMARY KEY',
  20860. 'FOREIGN KEY',
  20861. 'CHECK' ) ),
  20862. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER
  20863. CONSTRAINT TABLE_CONSTRAINTS_TABLE_CATALOG_NOT_NULL NOT NULL,
  20864. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER
  20865. CONSTRAINT TABLE_CONSTRAINTS_TABLE_SCHEMA_NOT_NULL NOT NULL,
  20866. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  20867. CONSTRAINT TABLE_CONSTRAINTS_TABLE_NAME_NOT_NULL NOT NULL,
  20868. IS_DEFERRABLE INFORMATION_SCHEMA.CHARACTER_DATA
  20869. CONSTRAINT TABLE_CONSTRAINTS_IS_DEFERRABLE_NOT_NULL NOT NULL,
  20870. INITIALLY_DEFERRED INFORMATION_SCHEMA.CHARACTER_DATA
  20871. CONSTRAINT TABLE_CONSTRAINTS_INITIALLY_DEFERRED_NOT_
  20872. NULL NOT NULL,
  20873. CONSTRAINT TABLE_CONSTRAINTS_PRIMARY_KEY
  20874. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20875. NAME ),
  20876. CONSTRAINT TABLE_CONSTRAINTS_CHECK_REFERENCES_TABLES
  20877. CHECK ( TABLE_CATALOG
  20878. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20879. OR
  20880. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  20881. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20882. FROM TABLES ) ),
  20883. CONSTRAINT TABLE_CONSTRAINTS_DEFERRED_CHECK
  20884. CHECK ( ( IS_DEFERRABLE, INITIALLY_DEFERRED ) IN
  20885. Information Schema and Definition Schema 585
  20886. X3H2-92-154/DBL CBR-002
  20887. 21.3 Definition Schema
  20888. ( VALUES ( 'NO', 'NO' ),
  20889. ( 'YES', 'NO' ),
  20890. ( 'YES', 'YES' ) ) ),
  20891. CONSTRAINT TABLE_CONSTRAINTS_CHECK_VIEWS
  20892. CHECK ( TABLE_CATALOG
  20893. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  20894. OR
  20895. ( ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  20896. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  20897. FROM TABLES
  20898. WHERE TABLE_TYPE <> 'VIEW' ) ),
  20899. CONSTRAINT TABLE_CONSTRAINTS_UNIQUE_CHECK
  20900. CHECK ( 1 =
  20901. ( SELECT COUNT (*)
  20902. FROM ( SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20903. NAME
  20904. FROM TABLE_CONSTRAINTS
  20905. WHERE CONSTRAINT_TYPE IN
  20906. ( 'UNIQUE', 'PRIMARY KEY' )
  20907. UNION ALL
  20908. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20909. NAME
  20910. FROM REFERENTIAL_CONSTRAINTS
  20911. UNION ALL
  20912. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20913. NAME
  20914. FROM CHECK_CONSTRAINTS ) AS X
  20915. WHERE ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20916. NAME )
  20917. = ( X.CONSTRAINT_CATALOG, X.CONSTRAINT_SCHEMA, X.CONSTRAINT_
  20918. NAME )
  20919. ) ),
  20920. CONSTRAINT UNIQUE_TABLE_PRIMARY_KEY_CHECK
  20921. CHECK ( UNIQUE ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  20922. NAME
  20923. FROM TABLE_CONSTRAINTS
  20924. WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' ) )
  20925. )
  20926. Description
  20927. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  20928. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  20929. and qualified identifier, respectively, of the constraint being
  20930. described. If the <table constraint definition> or <add table
  20931. constraint definition> that defined the constraint did not spec-
  20932. ify a <constraint name>, then the values of CONSTRAINT_CATALOG,
  20933. CONSTRAINT_SCHEMA, and CONSTRAINT_NAME are implementation-
  20934. defined.
  20935. 586 Database Language SQL
  20936. X3H2-92-154/DBL CBR-002
  20937. 21.3 Definition Schema
  20938. 2) The values of CONSTRAINT_TYPE have the following meanings:
  20939. FOREIGN The constraint being described is a foreign key
  20940. KEY constraint.
  20941. UNIQUE The constraint being described is a unique con-
  20942. straint.
  20943. PRIMARY The constraint being described is a primary key
  20944. KEY constraint.
  20945. CHECK The constraint being described is a check con-
  20946. straint.
  20947. 3) The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are
  20948. the catalog name, the unqualified schema name, and the qual-
  20949. ified identifier of the name of the table to which the table
  20950. constraint being described applies.
  20951. 4) The values of IS_DEFERRABLE have the following meanings:
  20952. YES The table constraint is deferrable.
  20953. NO The table constraint is not deferrable.
  20954. 5) The values of INITIALLY_DEFERRED have the following meanings:
  20955. YES The table constraint is initially deferred.
  20956. NO The table constraint is initially immediate.
  20957. Information Schema and Definition Schema 587
  20958. X3H2-92-154/DBL CBR-002
  20959. 21.3 Definition Schema
  20960. 21.3.14 KEY_COLUMN_USAGE base table
  20961. Function
  20962. The KEY_COLUMN_USAGE table has one or more rows for each row in
  20963. the TABLE_CONSTRAINTS table that has a CONSTRAINT_TYPE of "UNIQUE",
  20964. "PRIMARY KEY", or "FOREIGN KEY". The rows list the columns that
  20965. constitute each unique constraint, and the referencing columns in
  20966. each foreign key constraint.
  20967. Definition
  20968. CREATE TABLE KEY_COLUMN_USAGE
  20969. (
  20970. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20971. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20972. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20973. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER
  20974. CONSTRAINT KEY_COLUMN_TABLE_CATALOG_NOT_NULL NOT NULL,
  20975. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER
  20976. CONSTRAINT KEY_COLUMN_TABLE_SCHEMA_NOT_NULL NOT NULL,
  20977. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  20978. CONSTRAINT KEY_COLUMN_TABLE_NAME_NOT_NULL NOT NULL,
  20979. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  20980. ORDINAL_POSITION INFORMATION_SCHEMA.CARDINAL_NUMBER
  20981. CONSTRAINT KEY_COLUMN_ORDINAL_POSITION_NOT_NULL NOT NULL,
  20982. CONSTRAINT KEY_COLUMN_USAGE_PRIMARY_KEY
  20983. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20984. NAME,
  20985. COLUMN_NAME ),
  20986. CONSTRAINT KEY_COLUMN_USAGE_UNIQUE
  20987. UNIQUE ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA,
  20988. CONSTRAINT_NAME, ORDINAL_POSITION ),
  20989. CONSTRAINT KEY_COLUMN_USAGE_FOREIGN_KEY_COLUMNS
  20990. FOREIGN KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  20991. NAME )
  20992. REFERENCES COLUMNS,
  20993. CONSTRAINT KEY_COLUMN_CONSTRAINT_TYPE_CHECK
  20994. CHECK ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20995. NAME )
  20996. IN ( SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  20997. NAME
  20998. FROM TABLE_CONSTRAINTS
  20999. WHERE CONSTRAINT_TYPE IN
  21000. ( 'UNIQUE', 'PRIMARY KEY', 'FOREIGN KEY' ) ) )
  21001. )
  21002. 588 Database Language SQL
  21003. X3H2-92-154/DBL CBR-002
  21004. 21.3 Definition Schema
  21005. Description
  21006. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  21007. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21008. and qualified identifier, respectively, of the constraint being
  21009. described.
  21010. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and
  21011. COLUMN_NAME are the catalog name, unqualified schema name, qual-
  21012. ified identifier of the table name, and the column name of the
  21013. column that participates in the unique, primary key, or foreign
  21014. key constraint being described.
  21015. 3) The value of ORDINAL_POSITION is the ordinal position of the
  21016. specific column in the constraint being described. If the con-
  21017. straint described is a key of cardinality 1, then the value of
  21018. ORDINAL_POSITION is always 1. If the constraint being described
  21019. is a foreign key constraint, then ORDINAL_POSITION also identi-
  21020. fies the position within the uniqueness constraint of the column
  21021. that this column references.
  21022. Information Schema and Definition Schema 589
  21023. X3H2-92-154/DBL CBR-002
  21024. 21.3 Definition Schema
  21025. 21.3.15 REFERENTIAL_CONSTRAINTS base table
  21026. Function
  21027. The REFERENTIAL_CONSTRAINTS table has one row for each row in
  21028. the TABLE_CONSTRAINTS table that has a CONSTRAINT_TYPE value of
  21029. "FOREIGN KEY".
  21030. Definition
  21031. CREATE TABLE REFERENTIAL_CONSTRAINTS
  21032. (
  21033. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_
  21034. IDENTIFIER,
  21035. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_
  21036. IDENTIFIER,
  21037. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_
  21038. IDENTIFIER,
  21039. UNIQUE_CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_
  21040. IDENTIFIER
  21041. CONSTRAINT UNIQUE_CONSTRAINT_CATALOG_NOT_NULL NOT NULL,
  21042. UNIQUE_CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_
  21043. IDENTIFIER
  21044. CONSTRAINT UNIQUE_CONSTRAINT_SCHEMA_NOT_NULL NOT NULL,
  21045. UNIQUE_CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_
  21046. IDENTIFIER
  21047. CONSTRAINT UNIQUE_CONSTRAINT_NAME_NOT_NULL NOT NULL,
  21048. MATCH_OPTION INFORMATION_SCHEMA.CHARACTER_
  21049. DATA
  21050. CONSTRAINT REFERENTIAL_MATCH_OPTION_NOT_NULL NOT NULL
  21051. CONSTRAINT REFERENTIAL_MATCH_OPTION_CHECK
  21052. CHECK ( MATCH_OPTION IN ( 'NONE', 'PARTIAL', 'FULL' ) ),
  21053. UPDATE_RULE INFORMATION_SCHEMA.CHARACTER_
  21054. DATA
  21055. CONSTRAINT REFERENTIAL_UPDATE_RULE_NOT_NULL NOT NULL
  21056. CONSTRAINT REFERENTIAL_UPDATE_RULE_CHECK
  21057. CHECK ( UPDATE_RULE IN ('CASCADE', 'SET NULL', 'SET DEFAULT',
  21058. 'NO ACTION' ) ),
  21059. DELETE_RULE INFORMATION_SCHEMA.CHARACTER_
  21060. DATA
  21061. CONSTRAINT REFERENTIAL_DELETE_RULE_NOT_NULL NOT NULL
  21062. CONSTRAINT REFERENTIAL_DELETE_RULE_CHECK
  21063. CHECK ( DELETE_RULE IN ('CASCADE', 'SET NULL', 'SET DEFAULT',
  21064. 'NO ACTION' ) ),
  21065. CONSTRAINT REFERENTIAL_CONSTRAINTS_PRIMARY_KEY
  21066. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21067. NAME ),
  21068. CONSTRAINT REFERENTIAL_CONSTRAINTS_CONSTRAINT_TYPE_CHECK
  21069. CHECK ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21070. NAME )
  21071. 590 Database Language SQL
  21072. X3H2-92-154/DBL CBR-002
  21073. 21.3 Definition Schema
  21074. IN ( SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21075. NAME
  21076. FROM TABLE_CONSTRAINTS
  21077. WHERE CONSTRAINT_TYPE = 'FOREIGN KEY' ) ),
  21078. CONSTRAINT UNIQUE_CONSTRAINT_CHECK_REFERENCES_UNIQUE_
  21079. CONSTRAINT
  21080. CHECK ( TABLE_CATALOG <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21081. OR
  21082. ( ( UNIQUE_CONSTRAINT_CATALOG, UNIQUE_CONSTRAINT_
  21083. SCHEMA,
  21084. UNIQUE_CONSTRAINT_NAME ) IN
  21085. ( SELECT CONSTRAINT_CATALOG, CONSTRAINT_
  21086. SCHEMA, CONSTRAINT_NAME
  21087. FROM TABLE_CONSTRAINTS
  21088. WHERE CONSTRAINT_TYPE
  21089. IN ( 'UNIQUE', 'PRIMARY KEY' ) ) ) )
  21090. )
  21091. Description
  21092. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  21093. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21094. and qualified identifier, respectively, of the constraint being
  21095. described.
  21096. 2) The values of UNIQUE_CONSTRAINT_CATALOG, UNIQUE_CONSTRAINT_
  21097. SCHEMA, and UNIQUE_CONSTRAINT_NAME are the catalog name, unqual-
  21098. ified schema name, and qualified identifier, respectively, of
  21099. the unique or primary key constraint applied to the referenced
  21100. column list being described.
  21101. 3) The values of MATCH_OPTION have the following meanings:
  21102. NONE No <match type> was specified.
  21103. PARTIAL A <match type> of PARTIAL was specified.
  21104. FULL A <match type> of FULL was specified.
  21105. 4) The values of UPDATE_RULE have the following meanings for a
  21106. referential constraint that has an update rule:
  21107. CASCADE A <referential action> of CASCADE was specified.
  21108. SET NULL A <referential action> of SET NULL was specified.
  21109. SET DEFAULT A <referential action> of SET DEFAULT was speci-
  21110. fied.
  21111. NO ACTION A <referential action> of NO ACTION was speci-
  21112. fied.
  21113. Information Schema and Definition Schema 591
  21114. X3H2-92-154/DBL CBR-002
  21115. 21.3 Definition Schema
  21116. 5) The values of DELETE_RULE have the following meanings for a
  21117. referential constraint that has a <delete rule>:
  21118. CASCADE A <referential action> of CASCADE was specified.
  21119. SET NULL A <referential action> of SET NULL was specified.
  21120. SET DEFAULT A <referential action> of SET DEFAULT was speci-
  21121. fied.
  21122. NO ACTION A <referential action> of NO ACTION was speci-
  21123. fied.
  21124. 592 Database Language SQL
  21125. X3H2-92-154/DBL CBR-002
  21126. 21.3 Definition Schema
  21127. 21.3.16 CHECK_CONSTRAINTS base table
  21128. Function
  21129. The CHECK_CONSTRAINTS table has one row for each domain constraint,
  21130. table check constraint, and assertion.
  21131. Definition
  21132. CREATE TABLE CHECK_CONSTRAINTS
  21133. (
  21134. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21135. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21136. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21137. CHECK_CLAUSE INFORMATION_SCHEMA.CHARACTER_DATA,
  21138. CONSTRAINT CHECK_CONSTRAINTS_PRIMARY_KEY
  21139. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21140. NAME ),
  21141. CONSTRAINT CHECK_CONSTRAINTS_SOURCE_CHECK
  21142. CHECK ( ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21143. NAME )
  21144. IN
  21145. ( SELECT * FROM (
  21146. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21147. NAME
  21148. FROM ASSERTIONS
  21149. UNION
  21150. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21151. NAME
  21152. FROM TABLE_CONSTRAINTS
  21153. UNION
  21154. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21155. NAME
  21156. FROM DOMAIN_CONSTRAINTS ) ) )
  21157. )
  21158. Description
  21159. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA and
  21160. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21161. and qualified identifier, respectively, of the constraint being
  21162. described.
  21163. 2) Case:
  21164. a) If the character representation of the <search condition>
  21165. contained in the <check constraint definition>, <domain
  21166. constraint definition>, or <assertion definition> that de-
  21167. fined the check constraint being described can be represented
  21168. without truncation, then the value of CHECK_CLAUSE is that
  21169. character representation.
  21170. Information Schema and Definition Schema 593
  21171. X3H2-92-154/DBL CBR-002
  21172. 21.3 Definition Schema
  21173. b) Otherwise, the value of CHECK_CLAUSE is the null value.
  21174. Note: Any implicit <column reference>s that were contained in
  21175. the <search condition> associated with a <check constraint def-
  21176. inition> or an <assertion definition> are replaced by explicit
  21177. <column reference>s in CHECK_CONSTRAINTS.
  21178. 594 Database Language SQL
  21179. X3H2-92-154/DBL CBR-002
  21180. 21.3 Definition Schema
  21181. 21.3.17 CHECK_TABLE_USAGE base table
  21182. Function
  21183. The CHECK_TABLE_USAGE table has one row for each table referenced
  21184. by the <search condition> of a check constraint, domain constraint,
  21185. or assertion.
  21186. Definition
  21187. CREATE TABLE CHECK_TABLE_USAGE
  21188. (
  21189. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21190. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21191. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21192. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21193. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21194. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21195. CONSTRAINT CHECK_TABLE_USAGE_PRIMARY_KEY
  21196. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21197. NAME,
  21198. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ),
  21199. CONSTRAINT CHECK_TABLE_USAGE_FOREIGN_KEY_CHECK_CONSTRAINTS
  21200. FOREIGN KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21201. NAME )
  21202. REFERENCES CHECK_CONSTRAINTS,
  21203. CONSTRAINT CHECK_TABLE_USAGE_CHECK_REFERENCES_TABLES
  21204. CHECK ( TABLE_CATALOG
  21205. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21206. OR
  21207. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ) IN
  21208. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
  21209. FROM TABLES ) )
  21210. )
  21211. Description
  21212. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  21213. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21214. and qualified identifier, respectively, of the constraint being
  21215. described.
  21216. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are
  21217. the catalog name, unqualified schema name, and qualified iden-
  21218. tifier, respectively, of a table that is referenced by the
  21219. constraint being described.
  21220. Information Schema and Definition Schema 595
  21221. X3H2-92-154/DBL CBR-002
  21222. 21.3 Definition Schema
  21223. 21.3.18 CHECK_COLUMN_USAGE base table
  21224. Function
  21225. The CHECK_COLUMN_USAGE table has one row for each column referenced
  21226. by the <search condition> of a check constraint, domain constraint,
  21227. or assertion.
  21228. Definition
  21229. CREATE TABLE CHECK_COLUMN_USAGE
  21230. (
  21231. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21232. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21233. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21234. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21235. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21236. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21237. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21238. CONSTRAINT CHECK_COLUMN_USAGE_PRIMARY_KEY
  21239. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21240. NAME,
  21241. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  21242. NAME ),
  21243. CONSTRAINT CHECK_COLUMN_USAGE_FOREIGN_KEY_CHECK_CONSTRAINTS
  21244. FOREIGN KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21245. NAME )
  21246. REFERENCES CHECK_CONSTRAINTS,
  21247. CONSTRAINT CHECK_COLUMN_USAGE_CHECK_REFERENCES_COLUMNS
  21248. CHECK ( TABLE_CATALOG
  21249. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21250. OR
  21251. ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  21252. NAME ) IN
  21253. ( SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  21254. NAME, COLUMN_NAME
  21255. FROM COLUMNS ) )
  21256. )
  21257. Description
  21258. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  21259. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21260. and qualified identifier, respectively, of the constraint being
  21261. described.
  21262. 596 Database Language SQL
  21263. X3H2-92-154/DBL CBR-002
  21264. 21.3 Definition Schema
  21265. 2) The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and
  21266. COLUMN_NAME are the catalog name, unqualified schema name,
  21267. and qualified identifier, respectively, of a column that is
  21268. referenced by the constraint being described.
  21269. Information Schema and Definition Schema 597
  21270. X3H2-92-154/DBL CBR-002
  21271. 21.3 Definition Schema
  21272. 21.3.19 ASSERTIONS base table
  21273. Function
  21274. The ASSERTIONS table has one row for each assertion. It effectively
  21275. contains a representation of the assertion descriptors.
  21276. Definition
  21277. CREATE TABLE ASSERTIONS
  21278. (
  21279. CONSTRAINT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21280. CONSTRAINT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21281. CONSTRAINT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21282. IS_DEFERRABLE INFORMATION_SCHEMA.CHARACTER_DATA
  21283. CONSTRAINT ASSERTIONS_IS_DEFERRABLE_NOT_NULL NOT NULL,
  21284. INITIALLY_DEFERRED INFORMATION_SCHEMA.CHARACTER_DATA
  21285. CONSTRAINT ASSERTIONS_INITIALLY_DEFERRED_NOT_NULL NOT NULL,
  21286. CONSTRAINT ASSERTIONS_PRIMARY_KEY
  21287. PRIMARY KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21288. NAME ),
  21289. CONSTRAINT ASSERTIONS_FOREIGN_KEY_CHECK_CONSTRAINTS
  21290. FOREIGN KEY (CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21291. NAME )
  21292. REFERENCES CHECK_CONSTRAINTS,
  21293. CONSTRAINT ASSERTIONS_FOREIGN_KEY_SCHEMATA
  21294. FOREIGN KEY ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA )
  21295. REFERENCES SCHEMATA,
  21296. CONSTRAINT ASSERTIONS_DEFERRED_CHECK
  21297. CHECK ( ( IS_DEFERRABLE, INITIALLY_DEFERRED ) IN
  21298. VALUES ( ( 'NO', 'NO' ),
  21299. ( 'YES', 'NO' ),
  21300. ( 'YES', 'YES' ) ) )
  21301. )
  21302. Description
  21303. 1) The values of CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, and
  21304. CONSTRAINT_NAME are the catalog name, unqualified schema name,
  21305. and qualified identifier, respectively, of the assertion being
  21306. described.
  21307. 2) The values of IS_DEFERRABLE have the following meanings:
  21308. YES The assertion is deferrable.
  21309. NO The assertion is not deferrable.
  21310. 598 Database Language SQL
  21311. X3H2-92-154/DBL CBR-002
  21312. 21.3 Definition Schema
  21313. 3) The values of INITIALLY_DEFERRED have the following meanings:
  21314. YES The assertion is initially deferred.
  21315. NO The assertion is initially immediate.
  21316. Information Schema and Definition Schema 599
  21317. X3H2-92-154/DBL CBR-002
  21318. 21.3 Definition Schema
  21319. 21.3.20 TABLE_PRIVILEGES base table
  21320. Function
  21321. The TABLE_PRIVILEGES table has one row for each table privilege
  21322. descriptor. It effectively contains a representation of the table
  21323. privilege descriptors.
  21324. Definition
  21325. CREATE TABLE TABLE_PRIVILEGES
  21326. (
  21327. GRANTOR INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21328. GRANTEE INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21329. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21330. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21331. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21332. PRIVILEGE_TYPE INFORMATION_SCHEMA.CHARACTER_DATA
  21333. CONSTRAINT TABLE_PRIVILEGES_TYPE_CHECK
  21334. CHECK ( PRIVILEGE_TYPE IN
  21335. ( 'SELECT', 'INSERT', 'DELETE', 'UPDATE'
  21336. 'REFERENCES' ) ),
  21337. IS_GRANTABLE INFORMATION_SCHEMA.CHARACTER_DATA
  21338. CONSTRAINT TABLE_PRIVILEGES_GRANTABLE_NOT_NULL NOT NULL
  21339. CONSTRAINT TABLE_PRIVILEGES_GRANTABLE_CHECK
  21340. CHECK ( IS_GRANTABLE IN ( 'YES', 'NO' ) ),
  21341. CONSTRAINT TABLE_PRIVILEGES_PRIMARY_KEY
  21342. PRIMARY KEY ( GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_
  21343. SCHEMA, TABLE_NAME,
  21344. PRIVILEGE_TYPE ),
  21345. CONSTRAINT TABLE_PRIVILEGES_FOREIGN_KEY_TABLES
  21346. FOREIGN KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME )
  21347. REFERENCES TABLES,
  21348. CONSTRAINT TABLE_PRIVILEGES_GRANTOR_FOREIGN_KEY_USERS
  21349. FOREIGN KEY ( GRANTOR )
  21350. REFERENCES USERS,
  21351. CONSTRAINT TABLE_PRIVILEGES_GRANTEE_FOREIGN_KEY_USERS
  21352. FOREIGN KEY ( GRANTEE )
  21353. REFERENCES USERS
  21354. )
  21355. Description
  21356. 1) The value of GRANTOR is the <authorization identifier> of the
  21357. user who granted table privileges, on the table identified by
  21358. TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME, to the user iden-
  21359. tified by the value of GRANTEE for the table privilege being
  21360. described.
  21361. 600 Database Language SQL
  21362. X3H2-92-154/DBL CBR-002
  21363. 21.3 Definition Schema
  21364. 2) The value of GRANTEE is the <authorization identifier> of some
  21365. user, or "PUBLIC" to indicate all users, to whom the table priv-
  21366. ilege being described is granted.
  21367. 3) The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are
  21368. the catalog name, unqualified schema name, and qualified iden-
  21369. tifier, respectively, of the table on which the privilege being
  21370. described has been granted.
  21371. 4) The values of PRIVILEGE_TYPE have the following meanings:
  21372. SELECT The user has SELECT privileges on the table identified
  21373. by TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME.
  21374. DELETE The user has DELETE privileges on the table identified
  21375. by TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME.
  21376. INSERT The user will automatically be granted INSERT priv-
  21377. ileges on any columns that may be added to the table
  21378. identified by TABLE_CATALOG, TABLE_SCHEMA, and TABLE_
  21379. NAME in the future.
  21380. UPDATE The user will automatically be granted UPDATE priv-
  21381. ileges on any columns that may be added to the table
  21382. identified by TABLE_CATALOG, TABLE_SCHEMA, and TABLE_
  21383. NAME in the future.
  21384. REFERENCESThe user will automatically be granted REFERENCES
  21385. privileges on any columns that may be added to the
  21386. table identified by TABLE_CATALOG, TABLE_SCHEMA, and
  21387. TABLE_NAME in the future.
  21388. 5) The values of IS_GRANTABLE have the following meanings:
  21389. YES The privilege being described was granted WITH GRANT
  21390. OPTION and is thus grantable.
  21391. NO The privilege being described was not granted WITH
  21392. GRANT OPTION and is thus not grantable.
  21393. Information Schema and Definition Schema 601
  21394. X3H2-92-154/DBL CBR-002
  21395. 21.3 Definition Schema
  21396. 21.3.21 COLUMN_PRIVILEGES base table
  21397. Function
  21398. The COLUMN_PRIVILEGES table has one row for each column privilege
  21399. descriptor. It effectively contains a representation of the column
  21400. privilege descriptors.
  21401. Definition
  21402. CREATE TABLE COLUMN_PRIVILEGES
  21403. (
  21404. GRANTOR INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21405. GRANTEE INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21406. TABLE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21407. TABLE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21408. TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21409. COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21410. PRIVILEGE_TYPE INFORMATION_SCHEMA.CHARACTER_DATA
  21411. CONSTRAINT COLUMN_PRIVILEGES_TYPE_CHECK
  21412. CHECK ( PRIVILEGE_TYPE IN ( 'SELECT', 'INSERT', 'UPDATE',
  21413. 'REFERENCES' ) ),
  21414. IS_GRANTABLE INFORMATION_SCHEMA.CHARACTER_DATA
  21415. CONSTRAINT COLUMN_PRIVILEGES_IS_GRANTABLE_NOT_NULL NOT NULL
  21416. CONSTRAINT COLUMN_PRIVILEGES_IS_GRANTABLE_CHECK
  21417. CHECK ( IS_GRANTABLE IN ( 'YES', 'NO' ) ),
  21418. CONSTRAINT COLUMN_PRIVILEGES_PRIMARY_KEY
  21419. PRIMARY KEY
  21420. ( GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_
  21421. NAME,
  21422. PRIVILEGE_TYPE, COLUMN_NAME ),
  21423. CONSTRAINT COLUMN_PRIVILEGES_FOREIGN_KEY_COLUMNS
  21424. FOREIGN KEY ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_
  21425. NAME )
  21426. REFERENCES COLUMNS,
  21427. CONSTRAINT COLUMN_PRIVILEGES_GRANTOR_FOREIGN_KEY_USERS
  21428. FOREIGN KEY ( GRANTOR )
  21429. REFERENCES USERS,
  21430. CONSTRAINT COLUMN_PRIVILEGES_GRANTEE_FOREIGN_KEY_USERS
  21431. FOREIGN KEY ( GRANTEE )
  21432. REFERENCES USERS
  21433. )
  21434. 602 Database Language SQL
  21435. X3H2-92-154/DBL CBR-002
  21436. 21.3 Definition Schema
  21437. Description
  21438. 1) The value of GRANTOR is the <authorization identifier> of the
  21439. user who granted column privileges, on the column identified by
  21440. TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and COLUMN_NAME, to the
  21441. user identified by the value of GRANTEE for the column privilege
  21442. being described.
  21443. 2) The value of GRANTEE is the <authorization identifier> of some
  21444. user, or "PUBLIC" to indicate all users, to whom the column
  21445. privilege being described is granted.
  21446. 3) The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and
  21447. COLUMN_NAME are the catalog name, unqualified schema name, and
  21448. qualified identifier, respectively, of the column to which the
  21449. privilege being described was granted.
  21450. 4) The values of PRIVILEGE_TYPE have the following meanings:
  21451. SELECT The user has SELECT privilege on the column identified
  21452. by TABLE_CATALOG.TABLE_SCHEMA.TABLE_NAME.COLUMN_NAME.
  21453. INSERT The user has INSERT privilege on the column identified
  21454. by TABLE_CATALOG.TABLE_SCHEMA.TABLE_NAME.COLUMN_NAME.
  21455. UPDATE The user has UPDATE privilege on the column identified
  21456. by TABLE_CATALOG.TABLE_SCHEMA.TABLE_NAME.COLUMN_NAME.
  21457. REFERENCE The user has REFERENCES privilege on the column
  21458. identified by TABLE_CATALOG.TABLE_SCHEMA.TABLE_
  21459. NAME.COLUMN_NAME.
  21460. 5) The values of IS_GRANTABLE have the following meanings:
  21461. YES The privilege being described was granted WITH GRANT
  21462. OPTION and is thus grantable.
  21463. NO The privilege being described was not granted WITH
  21464. GRANT OPTION and is thus not grantable.
  21465. Information Schema and Definition Schema 603
  21466. X3H2-92-154/DBL CBR-002
  21467. 21.3 Definition Schema
  21468. 21.3.22 USAGE_PRIVILEGES base table
  21469. Function
  21470. The USAGE_PRIVILEGES table has one row for each usage privilege
  21471. descriptor. It effectively contains a representation of the usage
  21472. privilege descriptors.
  21473. Definition
  21474. CREATE TABLE USAGE_PRIVILEGES
  21475. (
  21476. GRANTOR INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21477. GRANTEE INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21478. OBJECT_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21479. OBJECT_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21480. OBJECT_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21481. OBJECT_TYPE INFORMATION_SCHEMA.SQL_IDENTIFIER
  21482. CONSTRAINT USAGE_PRIVILEGES_OBJECT_TYPE_CHECK
  21483. CHECK ( OBJECT_TYPE IN
  21484. ( 'DOMAIN', 'CHARACTER SET', 'COLLATION', 'TRANSLATION' ) ),
  21485. IS_GRANTABLE INFORMATION_SCHEMA.CHARACTER_DATA
  21486. CONSTRAINT USAGE_PRIVILEGES_IS_GRANTABLE_NOT_NULL NOT NULL
  21487. CONSTRAINT USAGE_PRIVILEGES_IS_GRANTABLE_CHECK
  21488. CHECK ( IS_GRANTABLE IN ( 'YES', 'NO' ) ),
  21489. CONSTRAINT USAGE_PRIVILEGES_PRIMARY_KEY
  21490. PRIMARY KEY ( GRANTOR, GRANTEE, OBJECT_CATALOG, OBJECT_
  21491. SCHEMA,
  21492. OBJECT_NAME, OBJECT_TYPE ),
  21493. CONSTRAINT USAGE_PRIVILEGES_CHECK_REFERENCES_OBJECT
  21494. CHECK ( ( OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_NAME, OBJECT_
  21495. TYPE ) IN
  21496. ( SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME,'DOMAIN'
  21497. FROM DOMAINS
  21498. UNION
  21499. SELECT CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_
  21500. SET_NAME,
  21501. 'CHARACTER SET'
  21502. FROM CHARACTER_SETS
  21503. UNION
  21504. SELECT COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  21505. NAME, 'COLLATION'
  21506. FROM COLLATIONS
  21507. UNION
  21508. SELECT TRANSLATION_CATALOG, TRANSLATION_SCHEMA, TRANSLATION_
  21509. NAME,
  21510. 'TRANSLATION'
  21511. FROM TRANSLATIONS ) ),
  21512. 604 Database Language SQL
  21513. X3H2-92-154/DBL CBR-002
  21514. 21.3 Definition Schema
  21515. CONSTRAINT USAGE_PRIVILEGES_GRANTOR_FOREIGN_KEY_USERS
  21516. FOREIGN KEY ( GRANTOR )
  21517. REFERENCES USERS,
  21518. CONSTRAINT USAGE_PRIVILEGES_GRANTEE_FOREIGN_KEY_USERS
  21519. FOREIGN KEY ( GRANTEE )
  21520. REFERENCES USERS
  21521. )
  21522. Description
  21523. 1) The value of GRANTOR is the <authorization identifier> of the
  21524. user who granted usage privileges, on the object of the type
  21525. identified by OBJECT_TYPE that is identified by OBJECT_CATALOG,
  21526. OBJECT_SCHEMA, and OBJECT_NAME, to the user identified by the
  21527. value of GRANTEE for the usage privilege being described.
  21528. 2) The value of GRANTEE is the <authorization identifier> of some
  21529. user, or "PUBLIC" to indicate all users, to whom the usage priv-
  21530. ilege being described is granted.
  21531. 3) The values of OBJECT_CATALOG, OBJECT_SCHEMA, and OBJECT_NAME
  21532. are the catalog name, unqualified schema name, and qualified
  21533. identifier, respectively, of the object to which the privilege
  21534. applies.
  21535. 4) The values of OBJECT_TYPE has the following meanings:
  21536. DOMAIN The object to which the privilege applies is a
  21537. domain.
  21538. CHARACTER The object to which the privilege applies is a
  21539. SET character set.
  21540. COLLATION The object to which the privilege applies is a
  21541. collation.
  21542. TRANSLATION The object to which the privilege applies is a
  21543. translation.
  21544. 5) The values of IS_GRANTABLE have the following meanings:
  21545. YES The privilege being described was granted WITH GRANT
  21546. OPTION and is thus grantable.
  21547. NO The privilege being described was not granted WITH GRANT
  21548. OPTION and is thus not grantable.
  21549. Information Schema and Definition Schema 605
  21550. X3H2-92-154/DBL CBR-002
  21551. 21.3 Definition Schema
  21552. 21.3.23 CHARACTER_SETS base table
  21553. Function
  21554. The CHARACTER_SETS table has one row for each character set de-
  21555. scriptor.
  21556. Definition
  21557. CREATE TABLE CHARACTER_SETS
  21558. (
  21559. CHARACTER_SET_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21560. CHARACTER_SET_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21561. CHARACTER_SET_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21562. FORM_OF_USE INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21563. NUMBER_OF_CHARACTERS INFORMATION_SCHEMA.CARDINAL_
  21564. NUMBER,
  21565. DEFAULT_COLLATE_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER
  21566. CONSTRAINT CHARACTER_SETS_DEFAULT_COLLATE_CATALOG_NOT_
  21567. NULL NOT NULL,
  21568. DEFAULT_COLLATE_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER
  21569. CONSTRAINT CHARACTER_SETS_DEFAULT_COLLATE_SCHEMA_NOT_
  21570. NULL NOT NULL,
  21571. DEFAULT_COLLATE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  21572. CONSTRAINT CHARACTER_SETS_DEFAULT_COLLATE_NAME_NOT_
  21573. NULL NOT NULL,
  21574. CONSTRAINT CHARACTER_SETS_PRIMARY_KEY
  21575. PRIMARY KEY ( CHARACTER_SET_CATALOG, CHARACTER_SET_
  21576. SCHEMA, CHARACTER_SET_NAME ),
  21577. CONSTRAINT CHARACTER_SETS_FOREIGN_KEY_SCHEMATA
  21578. FOREIGN KEY ( CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA )
  21579. REFERENCES SCHEMATA,
  21580. CONSTRAINT CHARACTER_SETS_CHECK_REFERENCES_COLLATIONS
  21581. CHECK ( CHARACTER_SET_CATALOG
  21582. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21583. OR
  21584. ( DEFAULT_COLLATE_CATALOG, DEFAULT_COLLATE_SCHEMA,
  21585. DEFAULT_COLLATE_NAME ) IN
  21586. ( SELECT COLLATION_CATALOG, COLLATION_
  21587. SCHEMA, COLLATION_NAME
  21588. FROM COLLATIONS ) )
  21589. )
  21590. 606 Database Language SQL
  21591. X3H2-92-154/DBL CBR-002
  21592. 21.3 Definition Schema
  21593. Description
  21594. 1) The values of CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and
  21595. CHARACTER_SET_NAME are the catalog name, unqualified schema
  21596. name, and qualified identifier, respectively, of the character
  21597. set being described.
  21598. 2) The value of FORM_OF_USE is the name of the form-of-use of the
  21599. character set.
  21600. 3) The value of NUMBER_OF_CHARACTERS is the number of characters in
  21601. the character repertoire.
  21602. 4) Case:
  21603. a) If the default collation for the character repertoire is
  21604. the order of characters in the repertoire, then the val-
  21605. ues of DEFAULT_COLLATE_CATALOG and DEFAULT_COLLATE_SCHEMA
  21606. are the values of CHARACTER_SET_CATALOG and CHARACTER_SET_
  21607. SCHEMA, respectively, and the value of DEFAULT_COLLATE_NAME
  21608. is implementation-dependent.
  21609. b) Otherwise, the values of DEFAULT_COLLATE_CATALOG, DEFAULT_
  21610. COLLATE_SCHEMA, and DEFAULT_COLLATE_NAME are catalog name,
  21611. unqualified schema name, and qualified identifier, respec-
  21612. tively, of the default collation.
  21613. 5) There is a row in this table for the character set INFORMATION_
  21614. SCHEMA.SQL_TEXT. In that row:
  21615. a) CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and CHARACTER_
  21616. SET_NAME are the name of the catalog, 'INFORMATION_SCHEMA',
  21617. and 'SQL_TEXT', respectively.
  21618. b) FORM_OF_USE is implementation-defined.
  21619. c) NUMBER_OF_CHARACTERS is implementation-defined.
  21620. d) DEFAULT_COLLATE_CATALOG, DEFAULT_COLLATE_SCHEMA, and DEFAULT_
  21621. COLLATE_NAME are the name of the catalog, 'INFORMATION_
  21622. SCHEMA', and 'SQL_TEXT', respectively.
  21623. Information Schema and Definition Schema 607
  21624. X3H2-92-154/DBL CBR-002
  21625. 21.3 Definition Schema
  21626. 21.3.24 COLLATIONS base table
  21627. Function
  21628. The COLLATIONS table has one row for each character collation de-
  21629. scriptor.
  21630. Definition
  21631. CREATE TABLE COLLATIONS
  21632. (
  21633. COLLATION_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21634. COLLATION_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21635. COLLATION_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER,
  21636. CHARACTER_SET_CATALOG INFORMATION_SCHEMA.SQL_IDENTIFIER
  21637. CONSTRAINT COLLATIONS_CHARACTER_SET_CATALOG_NOT_NULL NOT NULL,
  21638. CHARACTER_SET_SCHEMA INFORMATION_SCHEMA.SQL_IDENTIFIER
  21639. CONSTRAINT COLLATIONS_CHARACTER_SET_SCHEMA_NOT_NULL NOT NULL,
  21640. CHARACTER_SET_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER
  21641. CONSTRAINT COLLATIONS_CHARACTER_SET_NAME_NOT_NULL NOT NULL,
  21642. PAD_ATTRIBUTE INFORMATION_SCHEMA.CHARACTER_DATA
  21643. CONSTRAINT COLLATIONS_PAD_ATTRIBUTE_CHECK
  21644. CHECK ( PAD_ATTRIBUTE IN ( 'NO PAD', 'PAD SPACE' ) ),
  21645. CONSTRAINT COLLATIONS_PRIMARY_KEY
  21646. PRIMARY KEY ( COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_
  21647. NAME ),
  21648. CONSTRAINT COLLATIONS_FOREIGN_KEY_SCHEMATA
  21649. FOREIGN KEY ( COLLATION_CATALOG, COLLATION_SCHEMA )
  21650. REFERENCES SCHEMATA,
  21651. CONSTRAINT COLLATIONS_CHECK_REFERENCES_CHARACTER_SETS
  21652. CHECK ( COLLATION_CATALOG
  21653. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21654. OR
  21655. ( CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_
  21656. SET_NAME )
  21657. IN
  21658. ( SELECT CHARACTER_SET_CATALOG, CHARACTER_
  21659. SET_SCHEMA,
  21660. CHARACTER_SET_NAME
  21661. FROM CHARACTER_SETS ) )
  21662. )
  21663. 608 Database Language SQL
  21664. X3H2-92-154/DBL CBR-002
  21665. 21.3 Definition Schema
  21666. Description
  21667. 1) The values of COLLATION_CATALOG, COLLATION_SCHEMA, and COLLATION_
  21668. NAME are the catalog name, unqualified schema name, and quali-
  21669. fied identifier, respectively, of the collation being defined.
  21670. 2) The values of CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and
  21671. CHARACTER_SET_NAME are the catalog name, unqualified schema
  21672. name, and qualified identifier, respectively, of the character
  21673. set on which the collation is defined.
  21674. 3) The values of PAD_ATTRIBUTE have the following meanings:
  21675. NO PAD The collation being described has the NO PAD at-
  21676. tribute.
  21677. PAD SPACE The collation being described has the PAD SPACE
  21678. attribute.
  21679. 4) A row always exists in this table for the collation SQL_TEXT.
  21680. That row contains the definition of the collation corresponding
  21681. to the default collation for the characters in the character set
  21682. SQL_TEXT. In that row:
  21683. a) COLLATION_CATALOG, COLLATION_SCHEMA, and COLLATION_NAME are
  21684. the name of the catalog, 'INFORMATION_SCHEMA', and 'SQL_
  21685. TEXT', respectively.
  21686. b) CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, and CHARACTER_
  21687. SET_NAME are the name of the catalog, 'INFORMATION_SCHEMA',
  21688. and 'SQL_TEXT', respectively.
  21689. c) PAD_ATTRIBUTE is implementation-defined.
  21690. Information Schema and Definition Schema 609
  21691. X3H2-92-154/DBL CBR-002
  21692. 21.3 Definition Schema
  21693. 21.3.25 TRANSLATIONS base table
  21694. Function
  21695. The TRANSLATIONS table has one row for each character translation
  21696. descriptor.
  21697. Definition
  21698. CREATE TABLE TRANSLATIONS
  21699. (
  21700. TRANSLATION_CATALOG INFORMATION_SCHEMA.SQL_
  21701. IDENTIFIER,
  21702. TRANSLATION_SCHEMA INFORMATION_SCHEMA.SQL_
  21703. IDENTIFIER,
  21704. TRANSLATION_NAME INFORMATION_SCHEMA.SQL_
  21705. IDENTIFIER,
  21706. SOURCE_CHARACTER_SET_CATALOG INFORMATION_SCHEMA.SQL_
  21707. IDENTIFIER
  21708. CONSTRAINT TRANSLATIONS_SOURCE_CHARACTER_SET_CATALOG_NOT_
  21709. NULL NOT NULL,
  21710. SOURCE_CHARACTER_SET_SCHEMA INFORMATION_SCHEMA.SQL_
  21711. IDENTIFIER
  21712. CONSTRAINT TRANSLATIONS_SOURCE_CHARACTER_SET_SCHEMA_NOT_
  21713. NULL NOT NULL,
  21714. SOURCE_CHARACTER_SET_NAME INFORMATION_SCHEMA.SQL_
  21715. IDENTIFIER
  21716. CONSTRAINT TRANSLATIONS_SOURCE_CHARACTER_SET_NAME_NOT_
  21717. NULL NOT NULL,
  21718. TARGET_CHARACTER_SET_CATALOG INFORMATION_SCHEMA.SQL_
  21719. IDENTIFIER
  21720. CONSTRAINT TRANSLATIONS_TARGET_CHARACTER_SET_CATALOG_NOT_
  21721. NULL NOT NULL,
  21722. TARGET_CHARACTER_SET_SCHEMA INFORMATION_SCHEMA.SQL_
  21723. IDENTIFIER
  21724. CONSTRAINT TRANSLATIONS_TARGET_CHARACTER_SET_SCHEMA_NOT_
  21725. NULL NOT NULL,
  21726. TARGET_CHARACTER_SET_NAME INFORMATION_SCHEMA.SQL_
  21727. IDENTIFIER
  21728. CONSTRAINT TRANSLATIONS_TARGET_CHARACTER_SET_NAME_NOT_
  21729. NULL NOT NULL,
  21730. CONSTRAINT TRANSLATIONS_PRIMARY_KEY
  21731. PRIMARY KEY ( TRANSLATION_CATALOG, TRANSLATION_SCHEMA, TRANSLATION_
  21732. NAME ),
  21733. CONSTRAINT TRANSLATIONS_FOREIGN_KEY_SCHEMATA
  21734. FOREIGN KEY ( TRANSLATION_CATALOG, TRANSLATION_SCHEMA )
  21735. REFERENCES SCHEMATA,
  21736. CONSTRAINT TRANSLATIONS_CHECK_REFERENCES_SOURCE
  21737. CHECK ( SOURCE_CHARACTER_SET_CATALOG
  21738. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21739. 610 Database Language SQL
  21740. X3H2-92-154/DBL CBR-002
  21741. 21.3 Definition Schema
  21742. OR
  21743. ( SOURCE_CHARACTER_SET_CATALOG, SOURCE_CHARACTER_
  21744. SET_SCHEMA,
  21745. SOURCE_CHARACTER_SET_NAME ) IN
  21746. ( SELECT CHARACTER_SET_CATALOG, CHARACTER_SET_
  21747. SCHEMA,
  21748. CHARACTER_SET_NAME
  21749. FROM CHARACTER_SETS ) ),
  21750. CONSTRAINT TRANSLATIONS_CHECK_REFERENCES_TARGET
  21751. CHECK ( TARGET_CHARACTER_SET_CATALOG
  21752. <> ANY ( SELECT CATALOG_NAME FROM SCHEMATA )
  21753. OR
  21754. ( TARGET_CHARACTER_SET_CATALOG, TARGET_CHARACTER_
  21755. SET_SCHEMA,
  21756. TARGET_CHARACTER_SET_NAME ) IN
  21757. ( SELECT CHARACTER_SET_CATALOG, CHARACTER_SET_
  21758. SCHEMA,
  21759. CHARACTER_SET_NAME
  21760. FROM CHARACTER_SETS ) )
  21761. )
  21762. Description
  21763. 1) The values of TRANSLATION_CATALOG, TRANSLATION_SCHEMA, and
  21764. TRANSLATION_NAME are the catalog name, unqualified schema name,
  21765. and qualified identifier, respectively, of the translation being
  21766. described.
  21767. 2) The values of SOURCE_CHARACTER_SET_CATALOG, SOURCE_CHARACTER_
  21768. SET_SCHEMA, and SOURCE_CHARACTER_SET_NAME are the catalog name,
  21769. unqualified schema name, and qualified identifier, respectively,
  21770. of the character set specified as the source for the transla-
  21771. tion.
  21772. 3) The values of TARGET_CHARACTER_SET_CATALOG, TARGET_CHARACTER_
  21773. SET_SCHEMA, and TARGET_CHARACTER_SET_NAME are the catalog name,
  21774. unqualified schema name, and qualified identifier, respectively,
  21775. of the character set specified as the target for the transla-
  21776. tion.
  21777. Information Schema and Definition Schema 611
  21778. X3H2-92-154/DBL CBR-002
  21779. 21.3 Definition Schema
  21780. 21.3.26 SQL_LANGUAGES base table
  21781. Function
  21782. The SQL_LANGUAGES table has one row for each ISO and implementation-
  21783. defined SQL language binding and programming language for which
  21784. conformance is claimed.
  21785. Definition
  21786. CREATE TABLE SQL_LANGUAGES
  21787. (
  21788. SQL_LANGUAGE_SOURCE INFORMATION_SCHEMA.CHARACTER_
  21789. DATA
  21790. CONSTRAINT SQL_LANGUAGES_SOURCE_NOT_NULL NOT NULL,
  21791. SQL_LANGUAGE_YEAR INFORMATION_SCHEMA.CHARACTER_
  21792. DATA,
  21793. SQL_LANGUAGE_CONFORMANCE INFORMATION_SCHEMA.CHARACTER_
  21794. DATA,
  21795. SQL_LANGUAGE_INTEGRITY INFORMATION_SCHEMA.CHARACTER_
  21796. DATA,
  21797. SQL_LANGUAGE_IMPLEMENTATION INFORMATION_SCHEMA.CHARACTER_
  21798. DATA,
  21799. SQL_LANGUAGE_BINDING_STYLE INFORMATION_SCHEMA.CHARACTER_
  21800. DATA,
  21801. SQL_LANGUAGE_PROGRAMMING_LANGUAGE INFORMATION_SCHEMA.CHARACTER_
  21802. DATA,
  21803. CONSTRAINT SQL_LANGUAGES_STANDARD_VALID_CHECK
  21804. CHECK ( ( SQL_LANGUAGE_SOURCE = 'ISO 9075' AND
  21805. SQL_LANGUAGE_YEAR IS NOT NULL AND
  21806. SQL_LANGUAGE_CONFORMANCE IS NOT NULL AND
  21807. SQL_LANGUAGE_IMPLEMENTATION IS NULL AND
  21808. ( ( SQL_LANGUAGE_YEAR = '1987' AND
  21809. SQL_LANGUAGE_CONFORMANCE IN ( '1', '2' ) AND
  21810. SQL_LANGUAGE_INTEGRITY IS NULL AND
  21811. ( ( SQL_LANGUAGE_BINDING_STYLE = 'DIRECT' AND
  21812. SQL_LANGUAGE_PROGRAMMING_LANGUAGE
  21813. IS NULL )
  21814. OR
  21815. ( SQL_LANGUAGE_BINDING_STYLE IN ( 'EMBEDDED', 'MODULE' )
  21816. AND
  21817. SQL_LANGUAGE_PROGRAMMING_LANGUAGE IN
  21818. ( 'COBOL', 'FORTRAN', 'PASCAL', 'PLI' ) ) ) )
  21819. OR
  21820. ( SQL_LANGUAGE_YEAR = '1989' AND AND
  21821. SQL_LANGUAGE_CONFORMANCE IN ( '1', '2' ) AND
  21822. SQL_LANGUAGE_INTEGRITY IN ( 'NO', 'YES' ) AND
  21823. 612 Database Language SQL
  21824. X3H2-92-154/DBL CBR-002
  21825. 21.3 Definition Schema
  21826. ( ( SQL_LANGUAGE_BINDING_STYLE = 'DIRECT' AND
  21827. SQL_LANGUAGE_PROGRAMMING_LANGUAGE
  21828. IS NULL )
  21829. OR
  21830. ( SQL_LANGUAGE_BINDING_STYLE IN ( 'EMBEDDED', 'MODULE' )
  21831. AND
  21832. SQL_LANGUAGE_PROGRAMMING_LANGUAGE IN
  21833. ( 'COBOL', 'FORTRAN', 'PASCAL', 'PLI' ) ) ) )
  21834. OR
  21835. ( SQL_LANGUAGE_YEAR = '1992' AND
  21836. SQL_LANGUAGE_CONFORMANCE IN
  21837. ( 'ENTRY', 'INTERMEDIATE', 'FULL' ) AND
  21838. SQL_LANGUAGE_INTEGRITY IS NULL AND
  21839. ( ( SQL_LANGUAGE_BINDING = 'DIRECT' AND
  21840. SQL_LANGUAGE_PROGRAMMING_LANGUGE
  21841. IS NULL )
  21842. OR
  21843. ( SQL_LANGUAGE_BINDING IN ( 'EMBEDDED', 'MODULE' )
  21844. AND
  21845. SQL_LANGUAGE_PROGRAMMING_LANGUAGE IN
  21846. ( 'ADA', 'C', 'COBOL',
  21847. 'FORTRAN', 'MUMPS', 'PASCAL', 'PLI' ) ) ) ) ) )
  21848. OR
  21849. ( SQL_LANGUAGE_SOURCE <> 'ISO 9075' )
  21850. )
  21851. )
  21852. Description
  21853. 1) Each row represents one binding of an ISO or implementation-
  21854. defined SQL language to a standard module language, direct
  21855. invocation, or an embedded programming language.
  21856. 2) The value of SQL_LANGUAGE_SOURCE is the name of the source of
  21857. the language definition. The source of standard SQL language
  21858. is the value 'ISO 9075', while the source of an implementation-
  21859. defined version of SQL is implementation-defined.
  21860. 3) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075', then the
  21861. value of SQL_LANGUAGE_YEAR is the year that the ISO standard
  21862. was approved. Otherwise, the value of SQL_LANGUAGE_YEAR is
  21863. implementation-defined.
  21864. Note: As each new ISO SQL standard revision is approved, a new
  21865. valid value of SQL_LANGUAGE_YEAR must be added to the CHECK
  21866. constraint for this column.
  21867. Information Schema and Definition Schema 613
  21868. X3H2-92-154/DBL CBR-002
  21869. 21.3 Definition Schema
  21870. 4) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075', then the
  21871. value of SQL_LANGUAGE_CONFORMANCE is the conformance level to
  21872. which conformance is claimed for the ISO standard. Otherwise,
  21873. the value of SQL_LANGUAGE_CONFORMANCE is implementation-defined.
  21874. 5) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075' and that
  21875. language contains an optional integrity enhancement feature,
  21876. then the value of SQL_LANGUAGE_INTEGRITY is 'YES' if confor-
  21877. mance is claimed to the integrity enhancement feature, and 'NO'
  21878. otherwise. Otherwise, the value of SQL_LANGUAGE_INTEGRITY is
  21879. implementation-defined.
  21880. 6) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075', then the
  21881. value of SQL_LANGUAGE_IMPLEMENTATION is null. Otherwise, the
  21882. value of SQL_LANGUAGE_IMPLEMENTATION is an implementation-
  21883. defined character string value.
  21884. 7) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075', then the
  21885. value of SQL_LANGUAGE_BINDING_STYLE is the style of binding of
  21886. the SQL language. If the value of SQL_LANGUAGE_BINDING_STYLE is
  21887. 'MODULE', then the binding style of <module> is supported. If
  21888. the value of SQL_LANGUAGE_BINDING_STYLE is 'EMBEDDED', then the
  21889. binding style of <embedded SQL host program> is supported. If
  21890. the value of SQL_LANGUAGE_BINDING_STYLE is 'DIRECT', then the
  21891. binding style of <direct SQL statement> is supported. Otherwise,
  21892. the value of SQL_LANGUAGE_BINDING_STYLE is implementation-
  21893. defined.
  21894. 8) If the value of SQL_LANGUAGE_SOURCE is 'ISO 9075', then the
  21895. value of SQL_LANGUAGE_PROGRAMMING_LANGUAGE is the program-
  21896. ming language supported by the binding style indicated by
  21897. the value of SQL_LANGUAGE_BINDING_STYLE. If the value of
  21898. SQL_LANGUAGE_BINDING_STYLE is 'DIRECT', then SQL_LANGUAGE_
  21899. PROGRAMMING_LANGUAGE is the null value. If the value of SQL_
  21900. LANGUAGE_BINDING_STYLE is 'MODULE' or 'EMBEDDED', then SQL_
  21901. LANGUAGE_PROGRAMMING_LANGUAGE has the value 'ADA', 'C', 'COBOL',
  21902. 'FORTRAN', 'MUMPS', 'PASCAL', or 'PLI'.
  21903. Case:
  21904. a) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'ADA', then Ada is
  21905. supported with the given binding style.
  21906. b) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'C', then C is sup-
  21907. ported with the given binding style.
  21908. c) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'COBOL', then COBOL
  21909. is supported with the given binding style.
  21910. d) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'FORTRAN', then
  21911. Fortran is supported with the given binding style.
  21912. e) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'MUMPS', then MUMPS
  21913. is supported with the given binding style.
  21914. 614 Database Language SQL
  21915. X3H2-92-154/DBL CBR-002
  21916. 21.3 Definition Schema
  21917. f) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'PASCAL', then Pascal
  21918. is supported with the given binding style.
  21919. g) If SQL_LANGUAGE_PROGRAMMING_LANGUAGE is 'PLI', then PL/I is
  21920. supported with the given binding style.
  21921. Otherwise, the value of SQL_LANGUAGE_PROGRAMMING_LANGUAGE is
  21922. implementation-defined.
  21923. Information Schema and Definition Schema 615
  21924. X3H2-92-154/DBL CBR-002
  21925. 21.4 Assertions on the base tables
  21926. 21.4 Assertions on the base tables
  21927. The following clauses specify assertions that apply to the base
  21928. tables specified in Subclause 21.3, "Definition Schema".
  21929. The paramount criterion in formulating these assertions (after cor-
  21930. rectness) is ease of understanding for the human reader. There may
  21931. well be formulations of the same assertions that are more effi-
  21932. cient for some SQL-implementation, and quite possibly for all such
  21933. implementations.
  21934. 21.4.1 UNIQUE_CONSTRAINT_NAME assertion
  21935. Function
  21936. The UNIQUE_CONSTRAINT_NAME assertion ensures that the same combi-
  21937. nation of <schema name> and <constraint name> is not used by more
  21938. than one constraint.
  21939. Note: The UNIQUE_CONSTRAINT_NAME assertion avoids the need for
  21940. separate checks on DOMAINS, TABLE_CONSTRAINTS, and ASSERTIONS.
  21941. Definition
  21942. CREATE ASSERTION UNIQUE_CONSTRAINT_NAME
  21943. CHECK ( 1 =
  21944. ( SELECT MAX ( OCCURRENCES ) FROM
  21945. ( SELECT COUNT (*) AS OCCURRENCES FROM
  21946. ( SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21947. NAME
  21948. FROM DOMAIN_CONSTRAINTS
  21949. UNION ALL
  21950. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21951. NAME
  21952. FROM TABLE_CONSTRAINTS
  21953. UNION ALL
  21954. SELECT CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21955. NAME
  21956. FROM ASSERTIONS )
  21957. GROUP BY CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  21958. NAME
  21959. )
  21960. ) )
  21961. Description
  21962. 1) The UNIQUE_CONSTRAINT_NAME assertion checks that no combination
  21963. of (CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME)
  21964. appears more than once in the tables DOMAINS, TABLE_CONSTRAINTS
  21965. and ASSERTIONS.
  21966. 616 Database Language SQL
  21967. X3H2-92-154/DBL CBR-002
  21968. 21.4 Assertions on the base tables
  21969. 21.4.2 EQUAL_KEY_DEGREES assertion
  21970. Function
  21971. The assertion EQUAL_KEY_DEGREES ensures that every foreign key is
  21972. of the same degree as the corresponding unique constraint.
  21973. Definition
  21974. CREATE ASSERTION EQUAL_KEY_DEGREES
  21975. CHECK
  21976. ( NOT EXISTS
  21977. ( SELECT * FROM ( SELECT
  21978. COUNT ( DISTINCT FK.COLUMN_NAME ),
  21979. COUNT ( DISTINCT PK.COLUMN_NAME )
  21980. FROM KEY_COLUMN_USAGE AS FK,
  21981. REFERENTIAL_CONSTRAINTS AS RF,
  21982. KEY_COLUMN_USAGE AS PK
  21983. WHERE ( FK.CONSTRAINT_CATALOG, FK.CONSTRAINT_
  21984. SCHEMA,
  21985. FK.CONSTRAINT_NAME )
  21986. = ( RF.CONSTRAINT_CATALOG, RF.CONSTRAINT_
  21987. SCHEMA,
  21988. RF.CONSTRAINT_NAME )
  21989. AND
  21990. ( PK.CONSTRAINT_CATALOG, PK.CONSTRAINT_
  21991. SCHEMA,
  21992. PK.CONSTRAINT_NAME )
  21993. = ( RF.UNIQUE_CONSTRAINT_CATALOG, RF.UNIQUE_
  21994. CONSTRAINT_SCHEMA,
  21995. RF.UNIQUE_CONSTRAINT_NAME )
  21996. GROUP BY
  21997. RF.CONSTRAINT_CATALOG, RF.CONSTRAINT_SCHEMA, RF.CONSTRAINT_
  21998. NAME
  21999. ) AS REF ( FK_DEGREE, PK_DEGREE )
  22000. WHERE FK_DEGREE <> PK_DEGREE ) )
  22001. Information Schema and Definition Schema 617
  22002. X3H2-92-154/DBL CBR-002
  22003. 21.4 Assertions on the base tables
  22004. 21.4.3 KEY_DEGREE_GREATER_THAN_OR_EQUAL_TO_1 assertion
  22005. Function
  22006. The assertion KEY_DEGREE_GREATER_THAN_OR_EQUAL_TO_1 ensures that
  22007. every unique or primary key constraint has at least one unique
  22008. column and that every referential constraint has at least one ref-
  22009. erencing column.
  22010. Definition
  22011. CREATE ASSERTION KEY_DEGREE_GREATER_THAN_OR_EQUAL_TO_1
  22012. CHECK
  22013. ( NOT EXISTS
  22014. ( SELECT * FROM
  22015. TABLE_CONSTRAINTS
  22016. FULL OUTER JOIN
  22017. KEY_COLUMN_USAGE
  22018. USING ( CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_
  22019. NAME )
  22020. WHERE COLUMN_NAME IS NULL
  22021. AND CONSTRAINT_TYPE IN
  22022. ( 'UNIQUE', 'PRIMARY KEY', 'FOREIGN KEY' ) ) )
  22023. 618 Database Language SQL
  22024. X3H2-92-154/DBL CBR-002
  22025. 22 Status codes
  22026. 22.1 SQLSTATE
  22027. The character string value returned in an SQLSTATE parameter com-
  22028. prises a 2-character class value followed by a 3-character subclass
  22029. value, each with an implementation-defined character set that has a
  22030. one-octet form-of-use and is restricted to <digit>s and <simple
  22031. Latin upper case letter>s. Table 23, "SQLSTATE class and sub-
  22032. class values", specifies the class value for each condition and
  22033. the subclass value or values for each class value.
  22034. Class values that begin with one of the <digit>s '0', '1', '2',
  22035. '3', or '4' or one of the <simple Latin upper case letter>s 'A',
  22036. 'B', 'C', 'D', 'E', 'F', 'G', or 'H' are returned only for con-
  22037. ditions defined in this International Standard or in any other
  22038. International Standard. The class value 'HZ' is reserved for con-
  22039. ditions defined in ISO/IEC DIS 9579-2. Subclass values associated
  22040. with such classes that also begin with one of those 13 characters
  22041. are returned only for conditions defined in this International
  22042. Standard; subclass values associated with such classes that begin
  22043. with one of the <digit>s '5', '6', '7', '8', or '9' or one of the
  22044. <simple Latin upper case letter>s 'I', 'J', 'K', 'L', 'M', 'N',
  22045. 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', or 'Z' are
  22046. reserved for implementation-specified conditions and are called
  22047. implementation-defined subclasses.
  22048. Class values that begin with one of the <digit>s '5', '6', '7',
  22049. '8', or '9' or one of the <simple Latin upper case letter>s 'I',
  22050. 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
  22051. 'W', 'X', 'Y', or 'Z' are reserved for implementation-specified
  22052. conditions and are called implementation-defined classes. All sub-
  22053. class values except '000', which means no subclass, associated with
  22054. such classes are reserved for implementation-specified conditions
  22055. and are called implementation-defined subclasses.
  22056. If a subclass value is not specified for a condition, then either
  22057. subclass '000' or an implementation-defined subclass is returned.
  22058. An implementation-specified condition may duplicate a condition de-
  22059. fined in this International Standard; however, if such a condition
  22060. occurs as a result of executing a statement, then the corresponding
  22061. implementation-defined SQLSTATE value shall not be returned in the
  22062. SQLSTATE parameter but may be returned in the diagnostics area.
  22063. ____________Table_23-SQLSTATE_class_and_subclass_values____________
  22064. _Condition__________________Class_Subcondition_______________Subclass
  22065. | ambiguous cursor name | 3C | (no subclass) | 000 |
  22066. | | | | |
  22067. | | | | |
  22068. Status codes 619
  22069. X3H2-92-154/DBL CBR-002
  22070. 22.1 SQLSTATE
  22071. ________Table_23-SQLSTATE_class_and_subclass_values_(Cont.)________
  22072. _Condition__________________Class_Subcondition_______________Subclass
  22073. | cardinality violation | 21 | (no subclass) | 000 |
  22074. | | | | |
  22075. | connection exception | 08 | (no subclass) | 000 |
  22076. | | | | |
  22077. | | | connection does not | 003 |
  22078. exist
  22079. | | | connection failure | 006 |
  22080. | | | | |
  22081. | | | connection name in use | 002 |
  22082. | | | | |
  22083. | | | SQL-client unable to | 001 |
  22084. establish SQL-connection
  22085. | | | SQL-server rejected | 004 |
  22086. | | | establishment of SQL- | |
  22087. connection
  22088. | | | transaction resolution | 007 |
  22089. | | | unknown | |
  22090. | | | | |
  22091. | data exception | 22 | (no subclass) | 000 |
  22092. | | | | |
  22093. | | | character not in reper- | 021 |
  22094. toire
  22095. | | | datetime field overflow | 008 |
  22096. | | | | |
  22097. | | | division by zero | 012 |
  22098. | | | | |
  22099. | | | error in assignment | 005 |
  22100. | | | | |
  22101. | | | indicator overflow | 022 |
  22102. | | | | |
  22103. | | | interval field overflow | 015 |
  22104. | | | | |
  22105. | | | invalid character value | 018 |
  22106. for cast
  22107. | | | invalid datetime format | 007 |
  22108. | | | | |
  22109. | | | invalid escape character | 019 |
  22110. | | | | |
  22111. | | | invalid escape sequence | 025 |
  22112. | | | | |
  22113. | | | invalid parameter value | 023 |
  22114. | | | | |
  22115. | | | invalid time zone dis- | 009 |
  22116. placement value
  22117. | | | null value, no indicator | 002 |
  22118. | | | parameter | |
  22119. | | | | |
  22120. | | | numeric value out of | 003 |
  22121. | | | range | |
  22122. | | | | |
  22123. | | | string data, length | 026 |
  22124. | | | mismatch | |
  22125. | | | | |
  22126. 620 Database Language SQL
  22127. X3H2-92-154/DBL CBR-002
  22128. 22.1 SQLSTATE
  22129. ________Table_23-SQLSTATE_class_and_subclass_values_(Cont.)________
  22130. _Condition__________________Class_Subcondition_______________Subclass
  22131. | | | string data, right | 001 |
  22132. truncation
  22133. | | | substring error | 011 |
  22134. | | | | |
  22135. | | | trim error | 027 |
  22136. | | | | |
  22137. | | | unterminated C string | 024 |
  22138. | | | | |
  22139. | dependent privilege | 2B | (no subclass) | 000 |
  22140. descriptors still exist
  22141. | dynamic SQL error | 07 | (no subclass) | 000 |
  22142. | | | | |
  22143. | | | cursor specification | 003 |
  22144. cannot be executed
  22145. | | | invalid descriptor count | 008 |
  22146. | | | | |
  22147. | | | invalid descriptor index | 009 |
  22148. | | | | |
  22149. | | | prepared statement not a | 005 |
  22150. cursor specification
  22151. | | | restricted data type | 006 |
  22152. | | | attribute violation | |
  22153. | | | | |
  22154. | | | using clause does not | 001 |
  22155. | | | match dynamic parameter | |
  22156. specifications
  22157. | | | using clause does not | 002 |
  22158. | | | match target specifica- | |
  22159. | | | tions | |
  22160. | | | | |
  22161. | | | using clause required | 004 |
  22162. | | | for dynamic parameters | |
  22163. | | | | |
  22164. | | | using clause required | 007 |
  22165. | | | for result fields | |
  22166. | | | | |
  22167. | feature not supported | 0A | (no subclass) | 000 |
  22168. | | | | |
  22169. | | | multiple server transac- | 001 |
  22170. tions
  22171. | integrity constraint | 23 | (no subclass) | 000 |
  22172. | violation | | | |
  22173. | | | | |
  22174. | invalid authorization | 28 | (no subclass) | 000 |
  22175. | specification | | | |
  22176. | | | | |
  22177. | invalid catalog name | 3D | (no subclass) | 000 |
  22178. | | | | |
  22179. | invalid character set | 2C | (no subclass) | 000 |
  22180. name
  22181. | invalid condition number | 35 | (no subclass) | 000 |
  22182. | | | | |
  22183. Status codes 621
  22184. X3H2-92-154/DBL CBR-002
  22185. 22.1 SQLSTATE
  22186. ________Table_23-SQLSTATE_class_and_subclass_values_(Cont.)________
  22187. _Condition__________________Class_Subcondition_______________Subclass
  22188. | invalid connection name | 2E | (no subclass) | 000 |
  22189. | | | | |
  22190. | invalid cursor name | 34 | (no subclass) | 000 |
  22191. | | | | |
  22192. | invalid cursor state | 24 | (no subclass) | 000 |
  22193. | | | | |
  22194. | invalid schema name | 3F | (no subclass) | 000 |
  22195. | | | | |
  22196. | invalid SQL descriptor | 33 | (no subclass) | 000 |
  22197. name
  22198. | invalid SQL statement | 26 | (no subclass) | 000 |
  22199. | name | | | |
  22200. | | | | |
  22201. | invalid transaction | 25 | (no subclass) | 000 |
  22202. | state | | | |
  22203. | | | | |
  22204. | invalid transaction | 2D | (no subclass) | 000 |
  22205. | termination | | | |
  22206. | | | | |
  22207. | no data | 02 | (no subclass) | 000 |
  22208. | | | | |
  22209. | Remote Database Access | HZ | (See ISO/IEC 9579-2 for | |
  22210. the definition of pro-
  22211. tocol subconditions and
  22212. subclass code values)
  22213. | successful completion | 00 | (no subclass) | 000 |
  22214. | | | | |
  22215. | syntax error or access | 42 | (no subclass) | 000 |
  22216. | rule violation | | | |
  22217. | | | | |
  22218. | syntax error or access | 2A | (no subclass) | 000 |
  22219. | rule violation in direct | | | |
  22220. SQL statement
  22221. | syntax error or ac- | 37 | (no subclass) | 000 |
  22222. | cess rule violation in | | | |
  22223. | dynamic SQL statement | | | |
  22224. | | | | |
  22225. | transaction rollback | 40 | (no subclass) | 000 |
  22226. | | | | |
  22227. | | | integrity constraint | 002 |
  22228. | | | violation | |
  22229. | | | serialization failure | 001 |
  22230. | | | | |
  22231. | | | statement completion | 003 |
  22232. unknown
  22233. | triggered data change | 27 | (no subclass) | 000 |
  22234. | violation | | | |
  22235. | | | | |
  22236. | warning | 01 | (no subclass) | 000 |
  22237. | | | | |
  22238. | | | cursor operation con- | 001 |
  22239. flict
  22240. 622 Database Language SQL
  22241. X3H2-92-154/DBL CBR-002
  22242. 22.1 SQLSTATE
  22243. ________Table_23-SQLSTATE_class_and_subclass_values_(Cont.)________
  22244. _Condition__________________Class_Subcondition_______________Subclass
  22245. | | | disconnect error | 002 |
  22246. | | | | |
  22247. | | | implicit zero-bit | 008 |
  22248. padding
  22249. | | | insufficient item de- | 005 |
  22250. | | | scriptor areas | |
  22251. | | | | |
  22252. | | | null value eliminated in | 003 |
  22253. | | | set function | |
  22254. | | | | |
  22255. | | | privilege not granted | 007 |
  22256. | | | | |
  22257. | | | privilege not revoked | 006 |
  22258. | | | | |
  22259. | | | query expression too | 00A |
  22260. long for information
  22261. schema
  22262. | | | search condition too | 009 |
  22263. | | | long for information | |
  22264. | | | schema | |
  22265. | | | | |
  22266. | | | string data, right | 004 |
  22267. | | | truncation | |
  22268. | | | | |
  22269. | with check option viola- | 44 | (no subclass) | 000 |
  22270. |_tion_____________________|_____|__________________________|______|
  22271. | | | | |
  22272. | | | | |
  22273. | | | | |
  22274. Status codes 623
  22275. X3H2-92-154/DBL CBR-002
  22276. 22.2 SQLCODE
  22277. 22.2 SQLCODE
  22278. Table 24, "SQLCODE values", specifies the integer value returned in
  22279. an SQLCODE parameter for each condition. The negative values that
  22280. indicate exception conditions are implementation-defined.
  22281. ______________________Table_24-SQLCODE_values______________________
  22282. _Value__Condition__________________________________________________
  22283. | 0 | successful completion |
  22284. | | |
  22285. | +100 | no data |
  22286. | | |
  22287. |_-n___|_exception_________________________________________________|
  22288. | | |
  22289. Note: SQLSTATE is the preferred status parameter. The SQLCODE sta-
  22290. tus parameter is a deprecated feature that is supported for compat-
  22291. ibility with earlier versions of this International Standard. See
  22292. Annex D, "Deprecated features".
  22293. 624 Database Language SQL
  22294. X3H2-92-154/DBL CBR-002
  22295. 23 Conformance
  22296. 23.1 Introduction
  22297. This International Standard specifies conforming SQL language and
  22298. conforming SQL-implementations.
  22299. Conforming SQL language shall abide by the BNF Format, associated
  22300. Syntax Rules and Access Rules, definitions, and descriptions.
  22301. A conforming SQL-implementation shall process conforming SQL lan-
  22302. guage according to the associated General Rules, definitions, and
  22303. descriptions.
  22304. The object identifier for Database Language SQL is specified in
  22305. Subclause 3.4, "Object identifier for Database Language SQL".
  22306. 23.2 Claims of conformance
  22307. Claims of conformance to this International Standard shall state:
  22308. 1) Which level of conformance is claimed:
  22309. a) Full SQL (The complete database language specified in this
  22310. International Standard.)
  22311. b) Intermediate SQL (Intermediate SQL is a subset of Full SQL as
  22312. specified in the Leveling Rules.)
  22313. c) Entry SQL (Entry SQL is a subset of Intermediate SQL as spec-
  22314. ified in the Leveling Rules.)
  22315. 2) Which of the following binding styles are supported:
  22316. a) Module (<module>)
  22317. b) Embedded syntax (<embedded SQL host program>)
  22318. c) Direct invocation and processing of SQL language (<direct SQL
  22319. statement>)
  22320. 3) For the binding styles module or embedded syntax, which of the
  22321. following programming languages are supported:
  22322. a) Ada
  22323. b) C
  22324. c) COBOL
  22325. d) Fortran
  22326. Conformance 625
  22327. X3H2-92-154/DBL CBR-002
  22328. 23.2 Claims of conformance
  22329. e) MUMPS
  22330. f) Pascal
  22331. g) PL/I
  22332. 4) The definitions for all elements and actions that this Standard
  22333. specifies as implementation-defined.
  22334. 23.3 Extensions and options
  22335. A conforming implementation may provide additional facilities or
  22336. options not specified by this International Standard. This may im-
  22337. ply an implementation-defined extension of the list of reserved
  22338. words (<reserved word>) and thereby may prevent proper process-
  22339. ing of some programs that otherwise meet the requirements of this
  22340. International Standard.
  22341. An implementation remains conforming even if it provides user op-
  22342. tions to process nonconforming SQL language or to process conform-
  22343. ing SQL language in a nonconforming manner.
  22344. 23.4 Flagger requirements
  22345. Implementations that claim conformance only to Entry SQL may, but
  22346. are not required to, provide an SQL Flagger (see Subclause 4.34,
  22347. "SQL Flagger").
  22348. Implementations that claim conformance to Intermediate SQL shall
  22349. provide an SQL Flagger (see Subclause 4.34, "SQL Flagger") that
  22350. supports the following "level of flagging" options:
  22351. - Entry SQL Flagging
  22352. - Intermediate SQL Flagging
  22353. and the following "extent of checking" option:
  22354. - Syntax Only
  22355. Implementations that claim conformance to Full SQL shall provide an
  22356. SQL Flagger (see Subclause 4.34, "SQL Flagger") that supports the
  22357. following "level of flagging" options:
  22358. - Entry SQL Flagging
  22359. - Intermediate SQL Flagging
  22360. - Full SQL Flagging
  22361. and the following "extent of checking" options:
  22362. - Syntax Only
  22363. 626 Database Language SQL
  22364. X3H2-92-154/DBL CBR-002
  22365. 23.4 Flagger requirements
  22366. - Catalog Lookup
  22367. 23.5 Processing methods
  22368. This International Standard does not define the method by which an
  22369. <embedded SQL host program> is processed. Although the processing
  22370. of <embedded SQL host program> is defined in terms of derivation
  22371. of a program compliant with a programming language standard and a
  22372. <module>, implementations of SQL are not constrained to follow that
  22373. method, provided that effect is achieved.
  22374. Although the processing of <direct SQL statement> is defined in
  22375. terms of calls to <procedure>s in a <module>, implementations of
  22376. Direct Invocation are not constrained to follow that method, so
  22377. long as the same effect is achieved.
  22378. Conformance 627
  22379. 628 Database Language SQL
  22380. X3H2-92-154/DBL CBR-002
  22381. Annex A
  22382. (informative)
  22383. Leveling the SQL Language
  22384. This Annex describes the restrictions placed on conforming
  22385. Intermediate SQL and Entry SQL language.
  22386. A.1 Intermediate SQL Specifications
  22387. 1) Subclause 5.2, "<token> and <separator>":
  22388. a) In conforming Intermediate SQL language, a <regular iden-
  22389. tifier> or a <delimited identifier body> shall not comprise
  22390. more than 18 <character representation>s.
  22391. b) A <delimiter token> shall not be a <bit string literal> or a
  22392. <hex string literal>.
  22393. c) Conforming Intermediate SQL language shall contain no <iden-
  22394. tifier body> that ends in an <underscore>.
  22395. 2) Subclause 5.3, "<literal>":
  22396. a) An <unsigned integer> that is a <seconds fraction> shall not
  22397. contain more than 6 <digit>s.
  22398. b) A <literal> or <unsigned literal> shall not be a <bit string
  22399. literal> or a <hex string literal>.
  22400. c) A <character string literal> shall not specify a <character
  22401. set specification>.
  22402. 3) Subclause 5.4, "Names and identifiers":
  22403. a) Conforming Intermediate SQL language shall not contain any
  22404. <extended statement name> or <extended cursor name>.
  22405. b) Conforming Intermediate SQL language shall not contain any
  22406. <collation name>.
  22407. c) Conforming Intermediate SQL language shall not contain any
  22408. explicit <catalog name>.
  22409. Leveling the SQL Language 629
  22410. X3H2-92-154/DBL CBR-002
  22411. A.1 Intermediate SQL Specifications
  22412. d) Conforming Intermediate SQL language shall not contain any
  22413. <translation name> or <form-of-use conversion name>.
  22414. e) An <identifier> shall not specify a <character set specifica-
  22415. tion>.
  22416. 4) Subclause 6.1, "<data type>":
  22417. a) A <datetime type> shall not specify a <time precision> or
  22418. <timestamp precision>.
  22419. b) A <data type> shall not be a <bit string type>.
  22420. 5) Subclause 6.2, "<value specification> and <target specifica-
  22421. tion>":
  22422. a) In Intermediate SQL, the specific data type of <indicator
  22423. parameter>s and <indicator variable>s shall be the same
  22424. implementation-defined data type.
  22425. 6) Subclause 6.3, "<table reference>":
  22426. a) A <table reference> shall not be a <derived table>.
  22427. 7) Subclause 6.5, "<set function specification>":
  22428. a) If a <general set function> specifies DISTINCT, then the
  22429. <value expression> shall be a <column reference>.
  22430. 8) Subclause 6.6, "<numeric value function>":
  22431. a) A <numeric value function> shall not be a <position expres-
  22432. sion>.
  22433. b) A <numeric value function> shall not contain a <length ex-
  22434. pression> that is a <bit length expression>.
  22435. 9) Subclause 6.7, "<string value function>":
  22436. a) A <character value function> shall not be a <fold>.
  22437. b) Conforming Intermediate SQL language shall contain no <char-
  22438. acter translation>.
  22439. c) Conforming Intermediate SQL language shall contain no <form-
  22440. of-use conversion>.
  22441. d) Conforming Intermediate SQL language shall contain no <bit
  22442. value function>.
  22443. 10)Subclause 6.8, "<datetime value function>":
  22444. a) Conforming Intermediate SQL language shall contain no <time
  22445. precision> or <timestamp precision>.
  22446. 630 Database Language SQL
  22447. X3H2-92-154/DBL CBR-002
  22448. A.1 Intermediate SQL Specifications
  22449. 11)Subclause 6.13, "<string value expression>":
  22450. a) Conforming Intermediate SQL language shall not contain any
  22451. <collate clause>.
  22452. b) Conforming Intermediate SQL language shall contain no <bit
  22453. value expression>.
  22454. 12)Subclause 7.1, "<row value constructor>":
  22455. a) A <row value constructor> that is not simply contained in
  22456. a <table value constructor> shall not contain more than one
  22457. <row value constructor element>.
  22458. 13)Subclause 7.2, "<table value constructor>":
  22459. a) A <table value constructor> shall contain exactly one <row
  22460. value constructor> that shall be of the form "(<value expres-
  22461. sion list>)".
  22462. b) A <table value constructor> shall be the <query expression>
  22463. of an <insert statement>.
  22464. 14)Subclause 7.3, "<table expression>":
  22465. a) If the table identified in the <from clause> is a grouped
  22466. view, then the <table expression> shall not contain a <where
  22467. clause>, <group by clause>, or <having clause>.
  22468. 15)Subclause 7.4, "<from clause>":
  22469. a) A <table reference> shall not be a <derived table>.
  22470. b) If the table identified by <table name> is a grouped view,
  22471. then the <from clause> shall contain exactly one <table ref-
  22472. erence>.
  22473. 16)Subclause 7.5, "<joined table>":
  22474. a) Conforming Intermediate SQL language shall contain no <cross
  22475. join>.
  22476. b) Conforming Intermediate SQL language shall not specify UNION
  22477. JOIN.
  22478. 17)Subclause 7.7, "<group by clause>":
  22479. a) Conforming Intermediate SQL language shall not contain any
  22480. <collate clause>.
  22481. 18)Subclause 7.9, "<query specification>":
  22482. a) The <key word> DISTINCT shall not be specified more than once
  22483. in a <query specification>, excluding any <subquery> of that
  22484. <query specification>.
  22485. Leveling the SQL Language 631
  22486. X3H2-92-154/DBL CBR-002
  22487. A.1 Intermediate SQL Specifications
  22488. b) If the <table expression> of the <query specification> is a
  22489. grouped view, then the <select list> shall not contain a <set
  22490. function specification>.
  22491. 19)Subclause 7.10, "<query expression>":
  22492. a) A <simple table> shall not be a <table value constructor>
  22493. except in an <insert statement>.
  22494. b) Conforming Intermediate SQL shall contain no <explicit ta-
  22495. ble>.
  22496. 20)Subclause 7.11, "<scalar subquery>, <row subquery>, and <table
  22497. subquery>":
  22498. a) The <query expression> contained in a <subquery> shall be a
  22499. <query specification>.
  22500. 21)Subclause 8.1, "<predicate>":
  22501. a) A <predicate> shall not be a <match predicate>.
  22502. 22)Subclause 8.4, "<in predicate>":
  22503. a) Conforming Intermediate SQL language shall not contain a
  22504. <value expression> in an <in value list> that is not a <value
  22505. specification>.
  22506. 23)Subclause 8.10, "<match predicate>":
  22507. a) Conforming Intermediate SQL language shall not contain any
  22508. <match predicate>.
  22509. 24)Subclause 8.12, "<search condition>":
  22510. a) A <boolean test> shall not specify a <truth value>.
  22511. 25)Subclause 10.3, "<privileges>":
  22512. a) An <action> that specifies INSERT shall not contain a <privi-
  22513. lege column list>.
  22514. 26)Subclause 10.5, "<collate clause>":
  22515. a) Conforming Intermediate SQL language shall not contain any
  22516. <collate clause>.
  22517. 27)Subclause 11.1, "<schema definition>":
  22518. a) A <schema element> shall not be an <assertion definition>.
  22519. b) Conforming Intermediate SQL language shall not contain any
  22520. <collation definition>.
  22521. c) Conforming Intermediate SQL language shall not contain any
  22522. <translation definition>.
  22523. 632 Database Language SQL
  22524. X3H2-92-154/DBL CBR-002
  22525. A.1 Intermediate SQL Specifications
  22526. 28)Subclause 11.3, "<table definition>":
  22527. a) Conforming Intermediate SQL language shall not specify GLOBAL
  22528. TEMPORARY and shall not reference any global temporary table.
  22529. 29)Subclause 11.4, "<column definition>":
  22530. a) A <constraint attributes> shall not be specified, but
  22531. INITIALLY IMMEDIATE and NOT DEFERRABLE are implicit.
  22532. b) Conforming Intermediate SQL language shall not contain any
  22533. <collate clause>.
  22534. 30)Subclause 11.6, "<table constraint definition>":
  22535. a) A <constraint attributes> shall not be specified, but
  22536. INITIALLY IMMEDIATE and NOT DEFERRABLE are implicit.
  22537. 31)Subclause 11.8, "<referential constraint definition>":
  22538. a) A <references specification> shall not specify MATCH.
  22539. b) A <referential triggered action> shall not contain an <update
  22540. rule>.
  22541. 32)Subclause 11.9, "<check constraint definition>":
  22542. a) The <search condition> contained in a <check constraint defi-
  22543. nition> shall not contain a <subquery>.
  22544. b) The REFERENCES privilege is not required for <check con-
  22545. straint definition> access.
  22546. 33)Subclause 11.19, "<view definition>":
  22547. a) Conforming Intermediate SQL shall not contain any <levels
  22548. clause>, but the effect shall be that defined for a <levels
  22549. clause> of CASCADED.
  22550. 34)Subclause 11.21, "<domain definition>":
  22551. a) Conforming Intermediate SQL language shall not contain any
  22552. <collate clause>.
  22553. 35)Subclause 11.22, "<alter domain statement>":
  22554. a) Conforming Intermediate SQL language shall contain no <alter
  22555. domain statement>.
  22556. 36)Subclause 11.23, "<set domain default clause>":
  22557. a) Conforming Intermediate SQL language shall contain no <set
  22558. domain default clause>.
  22559. Leveling the SQL Language 633
  22560. X3H2-92-154/DBL CBR-002
  22561. A.1 Intermediate SQL Specifications
  22562. 37)Subclause 11.24, "<drop domain default clause>":
  22563. a) Conforming Intermediate SQL language shall contain no <drop
  22564. domain default clause>.
  22565. 38)Subclause 11.25, "<add domain constraint definition>":
  22566. a) Conforming Intermediate SQL language shall contain no <add
  22567. domain constraint definition>.
  22568. 39)Subclause 11.26, "<drop domain constraint definition>":
  22569. a) Conforming Intermediate SQL language shall contain no <drop
  22570. domain constraint definition>.
  22571. 40)Subclause 11.30, "<collation definition>":
  22572. a) Conforming Intermediate SQL language shall not contain any
  22573. <collation definition>.
  22574. 41)Subclause 11.31, "<drop collation statement>":
  22575. a) Conforming Intermediate SQL language shall not contain any
  22576. <drop collation statement>.
  22577. 42)Subclause 11.32, "<translation definition>":
  22578. a) Conforming Intermediate SQL language shall contain no <trans-
  22579. lation definition>.
  22580. 43)Subclause 11.33, "<drop translation statement>":
  22581. a) Conforming Intermediate SQL language shall contain no <drop
  22582. translation statement>.
  22583. 44)Subclause 11.34, "<assertion definition>":
  22584. a) Conforming Intermediate SQL language shall not contain any
  22585. <assertion definition>.
  22586. 45)Subclause 11.35, "<drop assertion statement>":
  22587. a) Conforming Intermediate SQL language shall not contain any
  22588. <drop assertion statement>.
  22589. 46)Subclause 11.36, "<grant statement>":
  22590. a) In Conforming Intermediate SQL language, an <object name>
  22591. shall not specify COLLATION or TRANSLATION.
  22592. 47)Subclause 12.1, "<module>":
  22593. a) A <module> shall not contain a <temporary table declaration>.
  22594. 634 Database Language SQL
  22595. X3H2-92-154/DBL CBR-002
  22596. A.1 Intermediate SQL Specifications
  22597. 48)Subclause 12.3, "<procedure>":
  22598. a) A <parameter declaration> shall not specify a <data type>
  22599. that is BIT or BIT VARYING.
  22600. 49)Subclause 12.5, "<SQL procedure statement>":
  22601. a) An <SQL transaction statement> shall not be a <set con-
  22602. straints mode statement>.
  22603. b) An <SQL schema statement> shall not be an <assertion defini-
  22604. tion>.
  22605. c) An <SQL schema statement> shall not be a <drop assertion
  22606. statement>.
  22607. d) An <SQL dynamic statement> shall not be an <allocate cursor
  22608. statement> statement.
  22609. e) An <SQL session statement> shall not be a <set schema state-
  22610. ment>, a <set catalog statement>, or a <set names statement>.
  22611. f) An <SQL schema statement> shall not be a <collation defini-
  22612. tion>, a <drop collation statement>, a <translation defini-
  22613. tion>, or a <drop translation statement>.
  22614. g) An <SQL dynamic statement shall not be a <deallocate prepared
  22615. statement>, or a <describe input statement>.
  22616. h) An <SQL procedure statement> shall not be an <SQL connection
  22617. statement>.
  22618. 50)Subclause 13.1, "<declare cursor>":
  22619. a) Conforming Intermediate SQL language shall not specify
  22620. INSENSITIVE.
  22621. b) If an <updatability clause> of FOR UPDATE with or without
  22622. a <column name list> is specified, then neither SCROLL nor
  22623. ORDER BY shall be specified.
  22624. 51)Subclause 13.3, "<fetch statement>":
  22625. a) A <fetch statement> shall not contain a <fetch orientation>.
  22626. 52)Subclause 13.5, "<select statement: single row>":
  22627. a) The <table expression> shall not include a <group by clause>
  22628. or a <having clause> and shall not identify a grouped view.
  22629. 53)Subclause 13.6, "<delete statement: positioned>":
  22630. a) Let T be the table identified by the <table name>. T shall
  22631. not be a table that is identified in the <from clause> of any
  22632. <subquery> contained in the <cursor specification> referenced
  22633. by the <cursor name>.
  22634. Leveling the SQL Language 635
  22635. X3H2-92-154/DBL CBR-002
  22636. A.1 Intermediate SQL Specifications
  22637. 54)Subclause 13.7, "<delete statement: searched>":
  22638. a) Let T be the table identified by the <table name>. T shall
  22639. not be a table that is identified in the <from clause> of any
  22640. <subquery> contained in the <search condition>.
  22641. 55)Subclause 13.8, "<insert statement>":
  22642. a) The base table that would be changed as a result of executing
  22643. the <insert statement> shall not be identified in any <from
  22644. clause> generally contained in the <query expression>.
  22645. 56)Subclause 13.9, "<update statement: positioned>":
  22646. a) Let T be the table identified by the <table name>. T shall
  22647. not be a table that is identified in the <from clause> of any
  22648. <subquery> contained in the <cursor specification> referenced
  22649. by the <cursor name>.
  22650. 57)Subclause 13.10, "<update statement: searched>":
  22651. a) Let T be the table identified by the <table name>. T shall
  22652. not be a table that is identified in the <from clause> of any
  22653. <subquery> contained in the <search condition> or contained
  22654. in the <value expression> of the <set clause>.
  22655. 58)Subclause 13.11, "<temporary table declaration>":
  22656. a) Conforming Intermediate SQL language shall not contain any
  22657. <temporary table declaration>.
  22658. 59)Subclause 14.2, "<set constraints mode statement>":
  22659. a) Conforming Intermediate SQL language shall not contain any
  22660. <set constraints mode statement>.
  22661. 60)Subclause 15.1, "<connect statement>":
  22662. a) Conforming Intermediate SQL language shall not contain any
  22663. <connect statement>.
  22664. 61)Subclause 15.2, "<set connection statement>":
  22665. a) Conforming Intermediate SQL language shall not contain any
  22666. <set connection statement>.
  22667. 62)Subclause 15.3, "<disconnect statement>":
  22668. a) Conforming Intermediate SQL language shall not contain any
  22669. <disconnect statement>.
  22670. 63)Subclause 16.1, "<set catalog statement>":
  22671. a) Conforming Intermediate SQL language shall not contain any
  22672. <set catalog statement>.
  22673. 636 Database Language SQL
  22674. X3H2-92-154/DBL CBR-002
  22675. A.1 Intermediate SQL Specifications
  22676. 64)Subclause 16.2, "<set schema statement>":
  22677. a) Conforming Intermediate SQL language shall not contain any
  22678. <set schema statement>.
  22679. 65)Subclause 16.3, "<set names statement>":
  22680. a) Conforming Intermediate SQL language shall not contain any
  22681. <set names statement>.
  22682. 66)Subclause 17.2, "<allocate descriptor statement>":
  22683. a) An <occurrences> and a <descriptor name> shall be a <lit-
  22684. eral>.
  22685. 67)Subclause 17.3, "<deallocate descriptor statement>":
  22686. a) A <descriptor name> shall be a <literal>.
  22687. 68)Subclause 17.4, "<get descriptor statement>":
  22688. a) A <descriptor name> shall be a <literal>.
  22689. 69)Subclause 17.5, "<set descriptor statement>":
  22690. a) A <descriptor name> shall be a <literal>.
  22691. 70)Subclause 17.6, "<prepare statement>":
  22692. a) A <preparable SQL schema statement> shall not be an <asser-
  22693. tion definition> or a <drop assertion statement>.
  22694. b) A <preparable SQL schema statement> shall not be a <collation
  22695. definition>, a <drop collation statement>, a <translation
  22696. definition>, or a <drop translation statement>.
  22697. c) A <preparable SQL session statement> shall not be a <set
  22698. schema statement>.
  22699. d) A <preparable SQL session statement> shall not be a <set
  22700. catalog statement>.
  22701. e) A <preparable SQL session statement> shall not be a <set
  22702. names statement>.
  22703. f) A <preparable SQL transaction statement> shall not be a <set
  22704. constraints mode statement>.
  22705. g) A <preparable SQL data statement> shall not be a <dynamic
  22706. single row select statement>.
  22707. 71)Subclause 17.7, "<deallocate prepared statement>":
  22708. a) Conforming Intermediate SQL language shall contain no <deal-
  22709. locate prepared statement>.
  22710. Leveling the SQL Language 637
  22711. X3H2-92-154/DBL CBR-002
  22712. A.1 Intermediate SQL Specifications
  22713. 72)Subclause 17.8, "<describe statement>":
  22714. a) Conforming Intermediate SQL language shall not contain any
  22715. <describe input statement>.
  22716. 73)Subclause 17.9, "<using clause>":
  22717. a) A <descriptor name> shall be a <literal>.
  22718. 74)Subclause 17.10, "<execute statement>":
  22719. a) Conforming Intermediate SQL language shall contain no <result
  22720. using clause>.
  22721. 75)Subclause 17.12, "<dynamic declare cursor>":
  22722. a) Conforming Intermediate SQL language shall contain no <dy-
  22723. namic declare cursor> that specifies INSENSITIVE.
  22724. b) If an <updatability clause> of FOR UPDATE with or without
  22725. a <column name list> is specified, then neither SCROLL nor
  22726. ORDER BY shall be specified.
  22727. 76)Subclause 17.13, "<allocate cursor statement>":
  22728. a) Conforming Intermediate SQL language shall not contain any
  22729. <allocate cursor statement>.
  22730. 77)Subclause 17.15, "<dynamic fetch statement>":
  22731. a) A <dynamic fetch statement> shall not contain a <fetch orien-
  22732. tation>.
  22733. 78)Subclause 17.17, "<dynamic delete statement: positioned>":
  22734. a) Let T be the table identified by the <table name>. T shall
  22735. not be a table that is identified in the <from clause> of any
  22736. <subquery> contained in the <cursor specification> referenced
  22737. by the <dynamic cursor name>.
  22738. 79)Subclause 17.18, "<dynamic update statement: positioned>":
  22739. a) Let T be the table identified by the <table name>. T shall
  22740. not be a table that is identified in the <from clause> of any
  22741. <subquery> contained in the <cursor specification> referenced
  22742. by the <dynamic cursor name>.
  22743. 80)Subclause 17.19, "<preparable dynamic delete statement: posi-
  22744. tioned>":
  22745. a) Conforming Intermediate SQL language shall contain no
  22746. <preparable dynamic delete statement: positioned>.
  22747. 638 Database Language SQL
  22748. X3H2-92-154/DBL CBR-002
  22749. A.1 Intermediate SQL Specifications
  22750. 81)Subclause 17.20, "<preparable dynamic update statement: posi-
  22751. tioned>":
  22752. a) Conforming Intermediate SQL language shall contain no
  22753. <preparable dynamic update statement: positioned>.
  22754. 82)Subclause 19.1, "<embedded SQL host program>":
  22755. a) An <embedded SQL statement> shall not contain a <temporary
  22756. table declaration>.
  22757. 83)Subclause 19.3, "<embedded SQL Ada program>":
  22758. a) An <Ada variable definition> shall not specify a bit string
  22759. variable.
  22760. 84)Subclause 19.4, "<embedded SQL C program>":
  22761. a) A <C derived variable> shall not be a <C bit variable>.
  22762. 85)Subclause 19.5, "<embedded SQL COBOL program>":
  22763. a) A <COBOL type specification> shall not be a <COBOL bit type>.
  22764. 86)Subclause 19.6, "<embedded SQL Fortran program>":
  22765. a) A <Fortran type specification> shall not specify BIT.
  22766. 87)Subclause 19.8, "<embedded SQL Pascal program>":
  22767. a) A <Pascal type specification> shall not specify BIT or PACKED
  22768. ARRAY [1..<length>] OF BIT.
  22769. 88)Subclause 19.9, "<embedded SQL PL/I program>":
  22770. a) A <PL/I type specification> shall not specify BIT or BIT
  22771. VARYING.
  22772. 89)Subclause 20.1, "<direct SQL statement>":
  22773. a) A <direct SQL data statement> shall not be a <temporary table
  22774. declaration>.
  22775. b) An <SQL session statement> shall not be a <set schema state-
  22776. ment>, a <set catalog statement>, or a <set names statement>.
  22777. c) An <SQL transaction statement> shall not be a <set con-
  22778. straints mode statement>.
  22779. d) An <SQL schema statement> shall not be an <assertion defini-
  22780. tion> or a <drop assertion statement>.
  22781. e) An <SQL schema statement> shall not be a <collation defini-
  22782. tion>, a <drop collation statement>, a <translation defini-
  22783. tion> or a <drop translation statement>.
  22784. Leveling the SQL Language 639
  22785. X3H2-92-154/DBL CBR-002
  22786. A.1 Intermediate SQL Specifications
  22787. f) A <direct SQL statement> shall not be an <SQL connection
  22788. statement>.
  22789. 90)Subclause 21.2, "Information Schema":
  22790. a) Conforming Intermediate SQL language shall reference only
  22791. the following Information Schema tables: SCHEMATA, DOMAINS,
  22792. TABLES, VIEWS, COLUMNS, TABLE_PRIVILEGES, COLUMN_PRIVILEGES,
  22793. USAGE_PRIVILEGES, REFERENTIAL_CONSTRAINTS, CHECK_CONSTRAINTS,
  22794. KEY_COLUMN_USAGE, ASSERTIONS, CHARACTER_SETS, COLLATIONS,
  22795. VIEW_COLUMN_USAGE, CONSTRAINT_TABLE_USAGE, CONSTRAINT_COLUMN_
  22796. USAGE, SQL_LANGUAGES, COLUMN_DOMAIN_USAGE, and VIEW_TABLE_
  22797. USAGE.
  22798. A.2 Entry SQL Specifications
  22799. 1) All Intermediate SQL specifications are included as Entry SQL
  22800. specifications.
  22801. 2) Subclause 5.2, "<token> and <separator>":
  22802. a) A <delimiter token> shall not be a <national character string
  22803. literal>.
  22804. b) An <identifier body> shall contain no <simple Latin lower
  22805. case letter>.
  22806. 3) Subclause 5.3, "<literal>":
  22807. a) A <literal> or <unsigned literal> shall not be a <national
  22808. character string literal>.
  22809. b) A <literal> or <unsigned literal> shall not be a <datetime
  22810. literal> or an <interval literal>.
  22811. 4) Subclause 5.4, "Names and identifiers":
  22812. a) Conforming Entry SQL language shall not contain any <do-
  22813. main name>, <SQL statement name>, <dynamic cursor name>, or
  22814. <constraint name>.
  22815. 5) Subclause 6.1, "<data type>":
  22816. a) A <character string type> shall not specify VARYING or
  22817. VARCHAR.
  22818. b) A <data type> shall not be a <datetime type> or an <interval
  22819. type>.
  22820. c) A <data type> shall not be a <national character string type>
  22821. nor specify CHARACTER SET.
  22822. 640 Database Language SQL
  22823. X3H2-92-154/DBL CBR-002
  22824. A.2 Entry SQL Specifications
  22825. 6) Subclause 6.2, "<value specification> and <target specifica-
  22826. tion>":
  22827. a) A <general value specification> shall not be a <dynamic pa-
  22828. rameter specification>.
  22829. b) A <general value specification> shall not specify VALUE.
  22830. c) A <general value specification> shall not specify SESSION_
  22831. USER, SYSTEM_USER, or CURRENT_USER.
  22832. 7) Subclause 6.3, "<table reference>":
  22833. a) A <table reference> shall not be a <joined table>.
  22834. b) The optional <key word> AS shall not be specified.
  22835. c) <derived column list> shall not be specified.
  22836. 8) Subclause 6.5, "<set function specification>":
  22837. a) If a <general set function> specifies or implies ALL, then
  22838. COUNT shall not be specified.
  22839. b) If a <general set function> specifies or implies ALL, then
  22840. the <value expression> shall include a <column reference>
  22841. that references a column of T.
  22842. c) If the <value expression> contains a <column reference> that
  22843. is an outer reference, then the <value expression> shall be a
  22844. <column reference>.
  22845. d) No <column reference> contained in a <set function specifica-
  22846. tion> shall reference a column derived from a <value expres-
  22847. sion> that generally contains a <set function specification>.
  22848. 9) Subclause 6.6, "<numeric value function>":
  22849. a) A <numeric value function> shall not be a <length expres-
  22850. sion>.
  22851. b) A <numeric value function> shall not be an <extract expres-
  22852. sion>.
  22853. 10)Subclause 6.7, "<string value function>":
  22854. a) A <character value function> shall not be a <character sub-
  22855. string function>.
  22856. b) A <character value function> shall not be a <trim function>.
  22857. 11)Subclause 6.8, "<datetime value function>":
  22858. a) Conforming Entry SQL language shall not contain any <datetime
  22859. value function>.
  22860. Leveling the SQL Language 641
  22861. X3H2-92-154/DBL CBR-002
  22862. A.2 Entry SQL Specifications
  22863. 12)Subclause 6.9, "<case expression>":
  22864. a) Conforming Entry SQL language shall not contain any <case
  22865. expression>.
  22866. 13)Subclause 6.10, "<cast specification>":
  22867. a) Conforming Entry SQL language shall not contain any <cast
  22868. specification>.
  22869. 14)Subclause 6.11, "<value expression>":
  22870. a) A <value expression> shall not be a <datetime value expres-
  22871. sion>.
  22872. b) A <value expression> shall not be an <interval value expres-
  22873. sion>.
  22874. c) A <value expression primary> shall not be a <case expres-
  22875. sion>.
  22876. d) A <value expression primary> shall not be a <cast specifica-
  22877. tion>.
  22878. e) A <value expression primary> shall not be a <scalar subquery>
  22879. except when the <value expression primary> is simply con-
  22880. tained in a <value expression> that is simply contained in
  22881. the second <row value constructor> of a <comparison predi-
  22882. cate>.
  22883. 15)Subclause 6.13, "<string value expression>":
  22884. a) A <character value expression> shall not be a <concatena-
  22885. tion>.
  22886. 16)Subclause 6.14, "<datetime value expression>":
  22887. a) Conforming Entry SQL language shall not contain any <datetime
  22888. value expression>.
  22889. 17)Subclause 6.15, "<interval value expression>":
  22890. a) Conforming Entry SQL language shall not contain any <interval
  22891. value expression>.
  22892. 18)Subclause 7.1, "<row value constructor>":
  22893. a) A <value expression> that is contained in the <row value con-
  22894. structor> that is contained in the <table value constructor>
  22895. that is contained in the <query expression> of an <insert
  22896. statement> shall be a <value specification>.
  22897. b) A <row value constructor element> shall not specify DEFAULT.
  22898. 642 Database Language SQL
  22899. X3H2-92-154/DBL CBR-002
  22900. A.2 Entry SQL Specifications
  22901. 19)Subclause 7.5, "<joined table>":
  22902. a) Conforming Entry SQL language shall not contain any <joined
  22903. table>.
  22904. 20)Subclause 7.6, "<where clause>":
  22905. a) A <value expression> directly contained in the <search condi-
  22906. tion> shall not include a reference to a column derived from
  22907. a function.
  22908. 21)Subclause 7.9, "<query specification>":
  22909. a) A <query specification> is not updatable if the <where
  22910. clause> of the <table expression> contains a <subquery>.
  22911. b) A <select sublist> shall not specify "<qualifier>.*".
  22912. 22)Subclause 7.10, "<query expression>":
  22913. a) A <query expression> shall not specify EXCEPT.
  22914. b) A <query term> shall not specify INTERSECT.
  22915. c) A <query primary> shall not contain a <joined table>.
  22916. d) A <query expression> shall not specify CORRESPONDING.
  22917. e) If UNION is specified, then except for column names, the
  22918. descriptions of the first and second operands shall be iden-
  22919. tical and the description of the result is identical to the
  22920. description of the operands.
  22921. 23)Subclause 7.11, "<scalar subquery>, <row subquery>, and <table
  22922. subquery>":
  22923. a) If a <subquery> is contained in a <comparison predicate>,
  22924. then the <table expression> in the <query specification>
  22925. shall not contain a <group by clause> or a <having clause>
  22926. and shall not identify a grouped view.
  22927. 24)Subclause 8.1, "<predicate>":
  22928. a) Conforming Entry SQL language shall not contain any <overlaps
  22929. predicate>.
  22930. b) Conforming Entry SQL language shall not contain any <unique
  22931. predicate>.
  22932. 25)Subclause 8.5, "<like predicate>":
  22933. a) The <match value> shall be a <column reference>.
  22934. b) A <pattern> shall be a <value specification>.
  22935. c) An <escape character> shall be a <value specification>.
  22936. Leveling the SQL Language 643
  22937. X3H2-92-154/DBL CBR-002
  22938. A.2 Entry SQL Specifications
  22939. 26)Subclause 8.6, "<null predicate>":
  22940. a) A <row value constructor> shall be a <column reference>.
  22941. 27)Subclause 8.9, "<unique predicate>":
  22942. a) Conforming Entry SQL language shall not contain any <unique
  22943. predicate>.
  22944. 28)Subclause 8.11, "<overlaps predicate>":
  22945. a) Conforming Entry SQL language shall not contain any <overlaps
  22946. predicate>.
  22947. 29)Subclause 10.1, "<interval qualifier>":
  22948. a) Conforming Entry SQL language shall not contain any <interval
  22949. qualifier>.
  22950. 30)Subclause 10.2, "<language clause>":
  22951. a) Conforming Entry SQL language shall not contain a <language
  22952. clause> that specifies MUMPS.
  22953. 31)Subclause 10.4, "<character set specification>":
  22954. a) Conforming Entry SQL language shall not contain a <character
  22955. set specification>.
  22956. 32)Subclause 11.1, "<schema definition>":
  22957. a) A <schema element> shall not be a <domain definition>.
  22958. b) A <schema name clause> shall specify AUTHORIZATION and shall
  22959. not specify a <schema name>.
  22960. c) A <schema character set specification> shall not be speci-
  22961. fied.
  22962. d) Conforming Intermediate SQL language shall not contain any
  22963. <character set definition>.
  22964. 33)Subclause 11.2, "<drop schema statement>":
  22965. a) Conforming Entry SQL language shall not contain a <drop
  22966. schema statement>.
  22967. 34)Subclause 11.18, "<drop table statement>":
  22968. a) Conforming Entry SQL language shall not contain any <drop
  22969. table statement>.
  22970. 35)Subclause 11.4, "<column definition>":
  22971. a) A <column definition> shall not contain a <domain name>.
  22972. 644 Database Language SQL
  22973. X3H2-92-154/DBL CBR-002
  22974. A.2 Entry SQL Specifications
  22975. b) A <column constraint> shall not contain a <referential trig-
  22976. gered action>.
  22977. c) Conforming Entry SQL language shall not contain any <con-
  22978. straint name definition>.
  22979. 36)Subclause 11.5, "<default clause>":
  22980. a) A <default option> shall not specify CURRENT_DATE, CURRENT_
  22981. TIME, CURRENT_TIMESTAMP, SYSTEM_USER, SESSION_USER, or
  22982. CURRENT_USER.
  22983. 37)Subclause 11.6, "<table constraint definition>":
  22984. a) Conforming Entry SQL language shall not contain any <con-
  22985. straint name definition>.
  22986. 38)Subclause 11.7, "<unique constraint definition>":
  22987. a) If PRIMARY KEY or UNIQUE is specified, then the <column defi-
  22988. nition> for each column whose <column name> is in the <unique
  22989. column list> shall specify NOT NULL.
  22990. 39)Subclause 11.8, "<referential constraint definition>":
  22991. a) A <referential constraint definition> shall not contain a
  22992. <referential triggered action>.
  22993. 40)Subclause 11.10, "<alter table statement>":
  22994. a) Conforming Entry SQL language shall not contain an <alter
  22995. table statement>.
  22996. 41)Subclause 11.11, "<add column definition>":
  22997. a) Conforming Entry SQL language shall not contain an <add col-
  22998. umn definition>.
  22999. 42)Subclause 11.12, "<alter column definition>":
  23000. a) Conforming Entry SQL language shall not contain an <alter
  23001. column definition>.
  23002. 43)Subclause 11.13, "<set column default clause>":
  23003. a) Conforming Entry SQL language shall not contain a <set column
  23004. default clause>.
  23005. 44)Subclause 11.14, "<drop column default clause>":
  23006. a) Conforming Entry SQL language shall not contain a <drop col-
  23007. umn default clause>.
  23008. 45)Subclause 11.15, "<drop column definition>":
  23009. a) Conforming Entry SQL language shall not contain a <drop col-
  23010. umn definition>.
  23011. Leveling the SQL Language 645
  23012. X3H2-92-154/DBL CBR-002
  23013. A.2 Entry SQL Specifications
  23014. 46)Subclause 11.16, "<add table constraint definition>":
  23015. a) Conforming Entry SQL language shall not contain an <add table
  23016. constraint definition>.
  23017. 47)Subclause 11.17, "<drop table constraint definition>":
  23018. a) Conforming Entry SQL language shall not contain a <drop table
  23019. constraint definition>.
  23020. 48)Subclause 11.19, "<view definition>":
  23021. a) The <query expression> in a <view definition> shall be a
  23022. <query specification>.
  23023. 49)Subclause 11.20, "<drop view statement>":
  23024. a) Conforming Entry SQL language shall not contain a <drop view
  23025. statement>.
  23026. 50)Subclause 11.36, "<grant statement>":
  23027. a) An <object name> shall not specify TABLE.
  23028. b) In Conforming Entry SQL language, an <object name> shall not
  23029. specify CHARACTER SET or DOMAIN.
  23030. 51)Subclause 11.37, "<revoke statement>":
  23031. a) Conforming Entry SQL language shall not contain a <revoke
  23032. statement>.
  23033. 52)Subclause 11.21, "<domain definition>":
  23034. a) Conforming Entry SQL language shall not contain any <domain
  23035. definition>.
  23036. 53)Subclause 11.27, "<drop domain statement>":
  23037. a) Conforming Entry SQL language shall not contain a <drop do-
  23038. main statement>.
  23039. 54)Subclause 11.28, "<character set definition>":
  23040. a) Conforming Entry SQL language shall not specify any <charac-
  23041. ter set definition>.
  23042. 55)Subclause 11.29, "<drop character set statement>":
  23043. a) Conforming Entry SQL language shall contain no <drop charac-
  23044. ter set statement>.
  23045. 56)Subclause 12.1, "<module>":
  23046. a) A <module> shall be associated with an SQL-agent during its
  23047. execution. An SQL-agent shall be associated with at most one
  23048. <module>.
  23049. 646 Database Language SQL
  23050. X3H2-92-154/DBL CBR-002
  23051. A.2 Entry SQL Specifications
  23052. b) A <module contents> shall not be a <dynamic declare cursor>.
  23053. 57)Subclause 12.2, "<module name clause>":
  23054. a) A <module character set specification> shall not be speci-
  23055. fied.
  23056. 58)Subclause 12.3, "<procedure>":
  23057. a) A <parameter declaration> shall not specify a <data type>
  23058. that is CHARACTER VARYING.
  23059. 59)Subclause 12.5, "<SQL procedure statement>":
  23060. a) An <SQL procedure statement> shall not be an <SQL schema
  23061. statement>.
  23062. b) An <SQL procedure statement> shall not be an <SQL dynamic
  23063. statement>.
  23064. c) An <SQL session statement> shall not be a <set session au-
  23065. thorization identifier statement> or a <set time zone state-
  23066. ment>.
  23067. d) An <SQL transaction statement> shall not be a <set transac-
  23068. tion statement>.
  23069. e) An <SQL procedure statement> shall not be an <SQL diagnostics
  23070. statement>.
  23071. 60)Subclause 13.1, "<declare cursor>":
  23072. a) A <declare cursor> shall not specify SCROLL.
  23073. b) A <cursor specification> shall not contain an <updatability
  23074. clause>.
  23075. 61)Subclause 13.3, "<fetch statement>":
  23076. a) A <fetch statement> shall not specify FROM.
  23077. b) If the data type of the target identified by the i-th <target
  23078. specification> in the <fetch target list> is an exact numeric
  23079. type, then the data type of the i-th column of the table T
  23080. shall be an exact numeric type.
  23081. 62)Subclause 13.5, "<select statement: single row>":
  23082. a) If the data type of the target identified by the i-th <target
  23083. specification> in the <fetch target list> is an exact numeric
  23084. type, then the data type of the i-th column of the table T
  23085. shall be an exact numeric type.
  23086. Leveling the SQL Language 647
  23087. X3H2-92-154/DBL CBR-002
  23088. A.2 Entry SQL Specifications
  23089. 63)Subclause 13.8, "<insert statement>":
  23090. a) The <query expression> that is contained in an <insert state-
  23091. ment> shall be a <table value constructor> that specifies
  23092. VALUES and contains exactly one <row value constructor> or it
  23093. shall be a <query specification>.
  23094. b) If the data type of the target identified by the i-th <column
  23095. name> is an exact numeric type, then the data type of the i-
  23096. th item of the <insert statement> shall be an exact numeric
  23097. type.
  23098. c) If the data type of the target C identified by the i-th <col-
  23099. umn name> is character string, then the length in characters
  23100. of the i-th item of the <insert statement> shall be less than
  23101. or equal to the length of C.
  23102. d) The <insert columns and source> shall immediately contain a
  23103. <query expression>.
  23104. 64)Subclause 13.9, "<update statement: positioned>":
  23105. a) If the data type of the column identified by the i-th <object
  23106. column> is an exact numeric type, then the data type of the
  23107. i-th <value expression> in the <update statement: positioned>
  23108. shall be an exact numeric type.
  23109. b) If the data type of the column identified by the i-th <object
  23110. column> C is character string, then the length in characters
  23111. of the i-th <value expression> in the <update statement:
  23112. positioned> shall be less than or equal to the length of C.
  23113. c) An <update source> shall not specify DEFAULT.
  23114. 65)Subclause 13.10, "<update statement: searched>":
  23115. a) If the data type of the column identified by the i-th <object
  23116. column> is an exact numeric type, then the data type of the
  23117. i-th <value expression> in the <update statement: searched>
  23118. shall be an exact numeric type.
  23119. b) If the data type of the column identified by the i-th <object
  23120. column> C is character string, then the length in characters
  23121. of the i-th <value expression> in the <update statement:
  23122. searched> shall be less than or equal to the length of C.
  23123. 66)Subclause 14.1, "<set transaction statement>":
  23124. a) Conforming Entry SQL language shall not contain any <set
  23125. transaction statement>.
  23126. 67)Subclause 14.3, "<commit statement>":
  23127. a) In conforming Entry SQL language, WORK shall be specified.
  23128. 648 Database Language SQL
  23129. X3H2-92-154/DBL CBR-002
  23130. A.2 Entry SQL Specifications
  23131. 68)Subclause 14.4, "<rollback statement>":
  23132. a) In conforming Entry SQL language, WORK shall be specified.
  23133. 69)Subclause 16.4, "<set session authorization identifier state-
  23134. ment>":
  23135. a) Conforming Intermediate SQL language shall not contain any
  23136. <set session authorization identifier statement>.
  23137. 70)Subclause 16.5, "<set local time zone statement>":
  23138. a) Conforming Entry SQL language shall not contain any <set
  23139. local time zone statement>.
  23140. 71)Subclause 17.2, "<allocate descriptor statement>":
  23141. a) Conforming Entry SQL language shall not contain any Dynamic
  23142. SQL language.
  23143. 72)Subclause 17.3, "<deallocate descriptor statement>":
  23144. a) Conforming Entry SQL language shall not contain any Dynamic
  23145. SQL language.
  23146. 73)Subclause 17.4, "<get descriptor statement>":
  23147. a) Conforming Entry SQL language shall not contain any Dynamic
  23148. SQL language.
  23149. 74)Subclause 17.5, "<set descriptor statement>":
  23150. a) Conforming Entry SQL language shall not contain any Dynamic
  23151. SQL language.
  23152. 75)Subclause 17.6, "<prepare statement>":
  23153. a) Conforming Entry SQL language shall not contain any Dynamic
  23154. SQL language.
  23155. 76)Subclause 17.7, "<deallocate prepared statement>":
  23156. a) Conforming Entry SQL language shall not contain any Dynamic
  23157. SQL language.
  23158. 77)Subclause 17.8, "<describe statement>":
  23159. a) Conforming Entry SQL language shall not contain any Dynamic
  23160. SQL language.
  23161. 78)Subclause 17.9, "<using clause>":
  23162. a) Conforming Entry SQL language shall not contain any Dynamic
  23163. SQL language.
  23164. Leveling the SQL Language 649
  23165. X3H2-92-154/DBL CBR-002
  23166. A.2 Entry SQL Specifications
  23167. 79)Subclause 17.10, "<execute statement>":
  23168. a) Conforming Entry SQL language shall not contain any Dynamic
  23169. SQL language.
  23170. 80)Subclause 17.11, "<execute immediate statement>":
  23171. a) Conforming Entry SQL language shall not contain any Dynamic
  23172. SQL language.
  23173. 81)Subclause 17.12, "<dynamic declare cursor>":
  23174. a) Conforming Entry SQL language shall not contain any Dynamic
  23175. SQL language.
  23176. 82)Subclause 17.13, "<allocate cursor statement>":
  23177. a) Conforming Entry SQL language shall not contain any Dynamic
  23178. SQL language.
  23179. 83)Subclause 17.14, "<dynamic open statement>":
  23180. a) Conforming Entry SQL language shall not contain any Dynamic
  23181. SQL language.
  23182. 84)Subclause 17.15, "<dynamic fetch statement>":
  23183. a) Conforming Entry SQL language shall not contain any Dynamic
  23184. SQL language.
  23185. 85)Subclause 17.16, "<dynamic close statement>":
  23186. a) Conforming Entry SQL language shall not contain any Dynamic
  23187. SQL language.
  23188. 86)Subclause 17.17, "<dynamic delete statement: positioned>":
  23189. a) Conforming Entry SQL language shall not contain any Dynamic
  23190. SQL language.
  23191. 87)Subclause 17.18, "<dynamic update statement: positioned>":
  23192. a) Conforming Entry SQL language shall not contain any Dynamic
  23193. SQL language.
  23194. 88)Subclause 17.19, "<preparable dynamic delete statement: posi-
  23195. tioned>":
  23196. a) Conforming Entry SQL language shall not contain any Dynamic
  23197. SQL language.
  23198. 89)Subclause 17.20, "<preparable dynamic update statement: posi-
  23199. tioned>":
  23200. a) Conforming Entry SQL language shall not contain any Dynamic
  23201. SQL language.
  23202. 650 Database Language SQL
  23203. X3H2-92-154/DBL CBR-002
  23204. A.2 Entry SQL Specifications
  23205. 90)Subclause 18.1, "<get diagnostics statement>":
  23206. a) Conforming Entry SQL language shall not contain any <get
  23207. diagnostics statement>.
  23208. 91)Subclause 19.1, "<embedded SQL host program>":
  23209. a) An <embedded SQL statement> shall not contain a <dynamic
  23210. declare cursor>.
  23211. b) An <embedded SQL statement> shall not contain an <embedded
  23212. character set declaration>.
  23213. 92)Subclause 19.3, "<embedded SQL Ada program>":
  23214. a) An <Ada qualified type specification> shall not specify a
  23215. <character set specification>.
  23216. 93)Subclause 19.4, "<embedded SQL C program>":
  23217. a) A <C derived variable> shall not be a <C VARCHAR variable> or
  23218. a <C extended char variable>.
  23219. 94)Subclause 19.5, "<embedded SQL COBOL program>":
  23220. a) A <COBOL character type> shall not specify a <character set
  23221. specification>.
  23222. b) A <COBOL integer type> shall not be a <COBOL binary integer>.
  23223. 95)Subclause 19.6, "<embedded SQL Fortran program>":
  23224. a) A <Fortran type specification> shall not specify a <character
  23225. set specification>.
  23226. 96)Subclause 19.8, "<embedded SQL Pascal program>":
  23227. a) A <Pascal type specification> shall not specify a <character
  23228. set specification>.
  23229. 97)Subclause 19.9, "<embedded SQL PL/I program>":
  23230. a) A <PL/I type specification> shall not specify CHARACTER
  23231. VARYING.
  23232. b) A <PL/I type specification> shall not specify a <character
  23233. set specification>.
  23234. 98)Subclause 20.1, "<direct SQL statement>":
  23235. a) A <direct SQL statement> shall not be an <SQL schema state-
  23236. ment>.
  23237. b) An <SQL session statement> shall not be a <set session au-
  23238. thorization identifier statement> or a <set local time zone
  23239. statement>.
  23240. Leveling the SQL Language 651
  23241. X3H2-92-154/DBL CBR-002
  23242. A.2 Entry SQL Specifications
  23243. c) A <direct SQL data statement> shall not be a <temporary table
  23244. declaration>.
  23245. 99)Subclause 21.2, "Information Schema":
  23246. a) Conforming Entry SQL language shall not reference any views
  23247. from the Information Schema.
  23248. 652 Database Language SQL
  23249. Annex B
  23250. (informative)
  23251. Implementation-defined elements
  23252. This Annex references those features that are identified in the
  23253. body of this International Standard as implementation-defined.
  23254. The term implementation-defined is used to identify characteristics
  23255. that may differ between implementations, but that shall be defined
  23256. for each particular implementation.
  23257. 1) Subclause 4.2.1, "Character strings and collating sequences":
  23258. The specific character set associated with the subtype of char-
  23259. acter string represented by the <key word>s NATIONAL CHARACTER
  23260. is implementation-defined.
  23261. 2) Subclause 4.4.1, "Characteristics of numbers": Whether trunca-
  23262. tion or rounding is performed when trailing digits are removed
  23263. from a numeric value is implementation-defined.
  23264. 3) Subclause 4.4.1, "Characteristics of numbers": When an approxi-
  23265. mation is obtained by truncation or rounding and there are more
  23266. than one approximation, then it is implementation-defined which
  23267. approximation is chosen.
  23268. 4) Subclause 4.4.1, "Characteristics of numbers": It is implementation-
  23269. defined which numerical values have approximations obtained by
  23270. rounding or truncation for a given approximate numeric type.
  23271. 5) Subclause 4.4.1, "Characteristics of numbers": The bound-
  23272. aries within which the normal rules of arithmetic apply are
  23273. implementation-defined.
  23274. 6) Subclause 4.6, "Type conversions and mixing of data types": When
  23275. converting between numeric data types, if least significant dig-
  23276. its are lost, then it is implementation-defined whether rounding
  23277. or truncation occurs.
  23278. 7) Subclause 4.11, "SQL-schemas": The default schema for <prepara-
  23279. ble statement>s that are dynamically prepared in the current
  23280. SQL-session through the execution of <prepare statement>s and
  23281. <execute immediate statement>s is initially implementation-
  23282. defined but may be changed by the use of <set schema state-
  23283. ment>s.
  23284. Implementation-defined elements 653
  23285. X3H2-92-154/DBL CBR-002
  23286. 8) Subclause 4.12, "Catalogs": The creation and destruction of
  23287. catalogs is accomplished by implementation-defined means.
  23288. 9) Subclause 4.12, "Catalogs": The set of catalogs that can
  23289. be referenced in any SQL-statement, during any particular
  23290. SQL-transaction, or during the course of an SQL-session is
  23291. implementation-defined.
  23292. 10)Subclause 4.12, "Catalogs": The default catalog for <module>s
  23293. whose <module authorization clause> does not specify an explicit
  23294. <catalog name> to qualify <schema name> and the default catalog
  23295. name substitution value for execution of <preparable statement>s
  23296. that are dynamically prepared in the current SQL-session through
  23297. the execution of <prepare statement>s and <execute immediate
  23298. statement>s are implementation-defined.
  23299. 11)Subclause 4.13, "Clusters of catalogs": A cluster is an
  23300. implementation-defined collection of catalogs.
  23301. 12)Subclause 4.13, "Clusters of catalogs": Whether or not any
  23302. catalog can occur simultaneously in more than one cluster is
  23303. implementation-defined.
  23304. 13)Subclause 4.15, "SQL-environment": The constituents of an SQL-
  23305. environment beyond those specified in Subclause 4.15, "SQL-
  23306. environment", are implementation-defined.
  23307. 14)Subclause 4.15, "SQL-environment": The rules determining whether
  23308. a <module> is within the environment are implementation-defined.
  23309. 15)Subclause 4.16, "Modules": The mechanisms by which <module>s are
  23310. created or destroyed are implementation-defined.
  23311. 16)Subclause 4.16, "Modules": The manner in which an associ-
  23312. ation between a <module> and an SQL-agent is defined is
  23313. implementation-defined.
  23314. 17)Subclause 4.16, "Modules": Whether a compilation unit may invoke
  23315. or transfer control to other compilation units, written in the
  23316. same or a different programming language is implementation-
  23317. defined.
  23318. 18)Subclause 4.18.1, "Status parameters": The negative (exception)
  23319. values for the SQLCODE status parameter are implementation-
  23320. defined.
  23321. 19)Subclause 4.22.1, "Classes of SQL-statements": This International
  23322. Standard permits implementations to provide additional,
  23323. implementation-defined, statements that may fall into any of
  23324. these categories; the classification of such statements is also
  23325. implementation-defined.
  23326. 654 Database Language SQL
  23327. X3H2-92-154/DBL CBR-002
  23328. 20)Subclause 4.23, "Embedded syntax": Whether a portion of the
  23329. name space is reserved by an implementation for the names of
  23330. procedures, subroutines, program variables, branch labels, <mod-
  23331. ule>s, or <procedure>s is implementation-defined; if a portion
  23332. of the name space is so reserved, the portion reserved is also
  23333. implementation-defined.
  23334. 21)Subclause 4.25, "Direct invocation of SQL": The method of in-
  23335. voking <direct SQL statement>s, the method of raising conditions
  23336. as a result of <direct SQL statement>s, the method of accessing
  23337. diagnostic information, and the method of returning the results
  23338. are all implementation-defined.
  23339. 22)Subclause 4.28, "SQL-transactions": It is implementation-defined
  23340. whether or not the non-dynamic or dynamic execution of an SQL-
  23341. data statement or the execution of an <SQL dynamic data state-
  23342. ment> is permitted to occur within the same SQL-transaction as
  23343. the non-dynamic or dynamic execution of an SQL-schema state-
  23344. ment. If it does occur, then the effect on any open cursor,
  23345. prepared dynamic statement, or deferred constraint is also
  23346. implementation-defined.
  23347. 23)Subclause 4.28, "SQL-transactions": If an implementation detects
  23348. unrecoverable errors and implicitly initiates the execution
  23349. of a <rollback statement>, an exception condition is raised:
  23350. transaction rollback with an implementation-defined subclass
  23351. code.
  23352. 24)Subclause 4.29, "SQL-connections": It is implementation-defined
  23353. how an implementation uses <SQL-server name> to determine the
  23354. location, identity, and communication protocol required to ac-
  23355. cess the SQL-environment and create an SQL-session.
  23356. 25)Subclause 4.30, "SQL-sessions": When an SQL-session is initiated
  23357. other than through the use of an explicit <connect statement>,
  23358. then an SQL-session associated with an implementation-defined
  23359. SQL-environment is initiated. The default SQL-environment is
  23360. implementation-defined.
  23361. 26)Subclause 4.30, "SQL-sessions": The mechanism and rules by which
  23362. an environment determines whether a call to a <procedure> is
  23363. the last call within the last active <module> is implementation-
  23364. defined.
  23365. 27)Subclause 4.30, "SQL-sessions": An SQL-session uses one or more
  23366. implementation-defined schemas that contain the instances of
  23367. any global temporary tables, created local temporary tables, or
  23368. declared local temporary tables within the SQL-session.
  23369. 28)Subclause 4.30, "SQL-sessions": When an SQL-session is initiated
  23370. other than through the use of an explicit <connect statement>,
  23371. there is an implementation-defined default <authorization iden-
  23372. tifier> that is used to for privilege checking for the execution
  23373. Implementation-defined elements 655
  23374. X3H2-92-154/DBL CBR-002
  23375. of <SQL procedure statement>s contained in <module>s not having
  23376. an explicit <module authorization identifier>.
  23377. 29)Subclause 4.30, "SQL-sessions": When an SQL-session is initi-
  23378. ated, there is an implementation-defined default catalog whose
  23379. name is used to effectively qualify all unqualified <schema
  23380. name>s contained in <preparable statement>s that are dynamically
  23381. prepared in the current SQL-session through the execution of
  23382. <prepare statement>s and <execute immediate statement>s or are
  23383. contained in <direct SQL statement>s when those statements are
  23384. invoked directly.
  23385. 30)Subclause 4.30, "SQL-sessions": When an SQL-session is initi-
  23386. ated, there is an implementation-defined default schema whose
  23387. name is used to effectively qualify all unqualified <qualified
  23388. name>s contained in <preparable statement>s that are dynamically
  23389. prepared in the current SQL-session through the execution of
  23390. <prepare statement>s and <execute immediate statement>s or are
  23391. contained in <direct SQL statement>s when those statements are
  23392. invoked directly.
  23393. 31)Subclause 4.30, "SQL-sessions": When an SQL-session is initi-
  23394. ated, there is an implementation-defined default character set
  23395. that is used to identify the character set implicit for <iden-
  23396. tifier>s and <character string literal>s that are contained in
  23397. <preparable statement>s when those statements are prepared in
  23398. the current SQL-session by either an <execute immediate state-
  23399. ment> or a <prepare statement> or are contained in <direct SQL
  23400. statement>s when those statements are invoked directly.
  23401. 32)Subclause 4.30, "SQL-sessions": When an SQL-session is ini-
  23402. tiated, there is an implementation-defined default time zone
  23403. displacement that is used as the current default time zone dis-
  23404. placement of the SQL-session.
  23405. 33)Subclause 4.31, "Client-server operation": When an SQL-agent is
  23406. active, it is bound in some implementation-defined manner to a
  23407. single SQL-client.
  23408. 34)Subclause 4.34, "SQL Flagger": If an SQL-implementation provides
  23409. user options to process conforming SQL language in a noncon-
  23410. forming manner, then it is required that the implementation also
  23411. provide a flagger option, or some other implementation-defined
  23412. means, to detect SQL conforming language that may be processed
  23413. differently under the various user options.
  23414. 35)Subclause 5.2, "<token> and <separator>": The end-of-line indi-
  23415. cator (<newline>) is implementation-defined.
  23416. 36)Subclause 5.3, "<literal>": The <character set name> character
  23417. set used to represent national characters is implementation-
  23418. defined.
  23419. 656 Database Language SQL
  23420. X3H2-92-154/DBL CBR-002
  23421. 37)Subclause 5.4, "Names and identifiers": If a <schema name> con-
  23422. tained in a <schema name clause> but not contained in a <module>
  23423. does not contain a <catalog name>, then an implementation-
  23424. defined <catalog name> is implicit.
  23425. 38)Subclause 5.4, "Names and identifiers": If a <schema name> con-
  23426. tained in a <module authorization clause> does not contain a
  23427. <catalog name>, then an implementation-defined <catalog name> is
  23428. implicit.
  23429. 39)Subclause 5.4, "Names and identifiers": The data type of the
  23430. <simple value specification> of <extended statement name> shall
  23431. be character string with an implementation-defined character
  23432. set.
  23433. 40)Subclause 5.4, "Names and identifiers": The data type of the
  23434. <simple value specification> of <extended cursor name> shall be
  23435. character string with an implementation-defined character set.
  23436. 41)Subclause 5.4, "Names and identifiers": Those <identifier>s
  23437. that are valid <authorization identifier>s are implementation-
  23438. defined.
  23439. 42)Subclause 5.4, "Names and identifiers": Those <identifier>s that
  23440. are valid <catalog name>s are implementation-defined.
  23441. 43)Subclause 5.4, "Names and identifiers": All <form-of-use conver-
  23442. sion name>s are implementation-defined.
  23443. 44)Subclause 6.1, "<data type>": The <character set name> associ-
  23444. ated with NATIONAL CHARACTER is implementation-defined.
  23445. 45)Subclause 6.1, "<data type>": If a <precision> is omitted, then
  23446. an implementation-defined <precision> is implicit.
  23447. 46)Subclause 6.1, "<data type>": The decimal precision of a data
  23448. type defined as DECIMAL for each value specified by <precision>
  23449. is implementation-defined.
  23450. 47)Subclause 6.1, "<data type>": The precision of a data type de-
  23451. fined as INTEGER is implementation-defined, but has the same
  23452. radix as that for SMALLINT.
  23453. 48)Subclause 6.1, "<data type>": The precision of a data type de-
  23454. fined as SMALLINT is implementation-defined, but has the same
  23455. radix as that for INTEGER.
  23456. 49)Subclause 6.1, "<data type>": The binary precision of a data
  23457. type defined as FLOAT for each value specified by <precision> is
  23458. implementation-defined.
  23459. 50)Subclause 6.1, "<data type>": The precision of a data type de-
  23460. fined as REAL is implementation-defined.
  23461. Implementation-defined elements 657
  23462. X3H2-92-154/DBL CBR-002
  23463. 51)Subclause 6.1, "<data type>": The precision of a data type de-
  23464. fined as DOUBLE PRECISION is implementation-defined, but greater
  23465. than that for REAL.
  23466. 52)Subclause 6.1, "<data type>": For every <data type>, the limits
  23467. of the <data type> are implementation-defined.
  23468. 53)Subclause 6.1, "<data type>": The maximum lengths for character
  23469. string types, variable-length character string types, bit string
  23470. types, and variable-length bit string types are implementation-
  23471. defined.
  23472. 54)Subclause 6.1, "<data type>": If CHARACTER SET is not speci-
  23473. fied for <character string type>, then the character set is
  23474. implementation-defined.
  23475. 55)Subclause 6.1, "<data type>": The character set named SQL_TEXT
  23476. is an implementation-defined character set that contains every
  23477. character that is in <SQL language character> and all characters
  23478. that are in other character sets supported by the implementa-
  23479. tion.
  23480. 56)Subclause 6.1, "<data type>": For the <exact numeric type>s
  23481. DECIMAL and NUMERIC, the maximum values of <precision> and of
  23482. <scale> are implementation-defined.
  23483. 57)Subclause 6.1, "<data type>": For the <approximate numeric
  23484. type> FLOAT, the maximum value of <precision> is implementation-
  23485. defined.
  23486. 58)Subclause 6.1, "<data type>": For the <approximate numeric
  23487. type>s FLOAT, REAL, and DOUBLE PRECISION, the maximum and mini-
  23488. mum values of the exponent are implementation-defined.
  23489. 59)Subclause 6.1, "<data type>": The maximum value of <time frac-
  23490. tional seconds precision> is implementation-defined, but shall
  23491. not be less than 6.
  23492. 60)Subclause 6.1, "<data type>": Interval arithmetic that in-
  23493. volves leap seconds or discontinuities in calendars will produce
  23494. implementation-defined results.
  23495. 61)Subclause 6.2, "<value specification> and <target specifi-
  23496. cation>": Whether the character string of the <value spec-
  23497. ification>s CURRENT_USER, SESSION_USER, and SYSTEM_USER is
  23498. variable-length or fixed-length, and its maximum length if it
  23499. is variable-length or its length if it is fixed-length, are
  23500. implementation-defined.
  23501. 62)Subclause 6.2, "<value specification> and <target specifica-
  23502. tion>": The value specified by SYSTEM_USER is an implementation-
  23503. defined string that represents the operating system user who
  23504. executed the <module> that contains the SQL-statement whose ex-
  23505. ecution caused the SYSTEM_USER <general value specification> to
  23506. be evaluated.
  23507. 658 Database Language SQL
  23508. X3H2-92-154/DBL CBR-002
  23509. 63)Subclause 6.2, "<value specification> and <target specifica-
  23510. tion>": In Intermediate SQL, the specific data type of <indi-
  23511. cator parameter>s and <indicator variable>s shall be the same
  23512. implementation-defined data type.
  23513. 64)Subclause 6.5, "<set function specification>": The precision
  23514. of the value derived from application of the COUNT function is
  23515. implementation-defined.
  23516. 65)Subclause 6.5, "<set function specification>": The precision of
  23517. the value derived from application of the SUM function to a data
  23518. type of exact numeric is implementation-defined.
  23519. 66)Subclause 6.5, "<set function specification>": The precision and
  23520. scale of the value derived from application of the AVG function
  23521. to a data type of exact numeric is implementation-defined.
  23522. 67)Subclause 6.5, "<set function specification>": The preci-
  23523. sion of the value derived from application of the SUM func-
  23524. tion or AVG function to a data type of approximate numeric is
  23525. implementation-defined.
  23526. 68)Subclause 6.6, "<numeric value function>": The precision of
  23527. <position expression> is implementation-defined.
  23528. 69)Subclause 6.6, "<numeric value function>": The precision of
  23529. <extract expression> is implementation-defined. If <datetime
  23530. field> specifies SECOND, then the scale is also implementation-
  23531. defined.
  23532. 70)Subclause 6.6, "<numeric value function>": The precision of
  23533. <length expression> is implementation-defined.
  23534. 71)Subclause 6.7, "<string value function>": The maximum length
  23535. of <character translation> or <form-of-use conversion> is
  23536. implementation-defined.
  23537. 72)Subclause 6.10, "<cast specification>": Whether to round or
  23538. truncate when casting to exact or approximate numeric data types
  23539. is implementation-defined.
  23540. 73)Subclause 6.12, "<numeric value expression>": When the data type
  23541. of both operands of the addition. subtraction, multiplication,
  23542. or division operator is exact numeric, the precision of the
  23543. result is implementation-defined.
  23544. 74)Subclause 6.12, "<numeric value expression>": When the data type
  23545. of both operands of the division operator is exact numeric, the
  23546. scale of the result is implementation-defined.
  23547. 75)Subclause 6.12, "<numeric value expression>": When the data
  23548. type of either operand of an arithmetic operator is approximate
  23549. numeric, the precision of the result is implementation-defined.
  23550. Implementation-defined elements 659
  23551. X3H2-92-154/DBL CBR-002
  23552. 76)Subclause 6.12, "<numeric value expression>": Whether to round
  23553. or truncate when performing division is implementation-defined.
  23554. 77)Subclause 6.15, "<interval value expression>": When an interval
  23555. is produced from the difference of two datetimes, the choice of
  23556. whether to round or truncate is implementation-defined.
  23557. 78)Subclause 9.1, "Retrieval assignment": If a value V is approxi-
  23558. mate numeric and a target T is exact numeric, then whether the
  23559. approximation of V retrieved into T is obtained by rounding or
  23560. by truncation is implementation-defined.
  23561. 79)Subclause 9.2, "Store assignment": If a value V is approximate
  23562. numeric and a target T is exact numeric, then whether the ap-
  23563. proximation of V stored into T is obtained by rounding or by
  23564. truncation is implementation-defined.
  23565. 80)Subclause 9.3, "Set operation result data types": If all of the
  23566. data types in DTS are exact numeric, then the result data type
  23567. is exact numeric with implementation-defined precision.
  23568. 81)Subclause 9.3, "Set operation result data types": If any data
  23569. type in DTS is approximate numeric, then each data type in DTS
  23570. shall be numeric and the result data type is approximate numeric
  23571. with implementation-defined precision.
  23572. 82)Subclause 10.1, "<interval qualifier>": The maximum value of
  23573. <interval leading field precision> is implementation-defined,
  23574. but shall not be less than 2.
  23575. 83)Subclause 10.1, "<interval qualifier>": The maximum value of
  23576. <interval fractional seconds precision> is implementation-
  23577. defined, but shall not be less than 6.
  23578. 84)Subclause 10.4, "<character set specification>": The <standard
  23579. character repertoire name>s, <implementation-defined character
  23580. repertoire name>s, <standard universal character form-of-use
  23581. name>s, and <implementation-defined universal character form-
  23582. of-use name>s that are supported are implementation-defined.
  23583. 85)Subclause 10.4, "<character set specification>": The default
  23584. collating sequence of the character repertoire specified by
  23585. an <implementation-defined character repertoire name> or an
  23586. <implementation-defined universal character for-of-use name> and
  23587. whether that collating sequence has the NO PAD attribute or the
  23588. PAD SPACE attribute is implementation-defined.
  23589. 86)Subclause 11.1, "<schema definition>": If <schema character set
  23590. specification> is not specified, then a <schema character set
  23591. specification> containing an implementation-defined <character
  23592. set specification> is implicit.
  23593. 87)Subclause 11.1, "<schema definition>": The privileges necessary
  23594. to execute the <schema definition> are implementation-defined.
  23595. 660 Database Language SQL
  23596. X3H2-92-154/DBL CBR-002
  23597. 88)Subclause 11.30, "<collation definition>": The <standard col-
  23598. lation name>s and <implementation-defined collation name>s that
  23599. are supported are implementation-defined.
  23600. 89)Subclause 11.30, "<collation definition>": The collating se-
  23601. quence resulting from the specification of EXTERNAL in a <colla-
  23602. tion definition> is implementation-defined.
  23603. 90)Subclause 11.32, "<translation definition>": The <standard
  23604. translation name>s and <implementation-defined translation
  23605. name>s that are supported are implementation-defined.
  23606. 91)Subclause 12.1, "<module>": If the explicit or implicit <schema
  23607. name> does not specify a <catalog name>, then an implementation-
  23608. defined <catalog name> is implicit.
  23609. 92)Subclause 12.2, "<module name clause>": If a <module character
  23610. set specification> is not specified, then a <module character
  23611. set specification> that specifies the implementation-defined
  23612. character set that contains every character that is in <SQL
  23613. language character> is implicit.
  23614. 93)Subclause 12.3, "<procedure>": Whether or not SAI can invoke
  23615. <procedure>s in a <module> with explicit <module authorization
  23616. identifier> MAI is implementation-defined, as are any restric-
  23617. tions pertaining to such invocation.
  23618. 94)Subclause 12.3, "<procedure>": If the value of any input param-
  23619. eter provided by the SQL-agent falls outside the set of allowed
  23620. values of the data type of the parameter, or if the value of any
  23621. output parameter resulting from the execution of the <procedure>
  23622. falls outside the set of values supported by the SQL-agent for
  23623. that parameter, then the effect is implementation-defined.
  23624. 95)Subclause 12.3, "<procedure>": If the <module> that contains the
  23625. <procedure> is associated with an SQL-agent that is associated
  23626. with another <module> that contains a <procedure> with the same
  23627. <procedure name>, then the effect is implementation-defined.
  23628. 96)Subclause 12.4, "Calls to a <procedure>": There is an implementation-
  23629. defined package and character type for use in Ada bindings.
  23630. The precisions and scales of the Ada types for SQL data types
  23631. and the <exact numeric type> of indicator parameters are
  23632. implementation-defined.
  23633. 97)Subclause 12.4, "Calls to a <procedure>": The null character
  23634. that defines the end of a C character string is implementation-
  23635. defined.
  23636. 98)Subclause 12.4, "Calls to a <procedure>": The number of bits in
  23637. a C character is implementation-defined.
  23638. 99)Subclause 12.4, "Calls to a <procedure>": The precision of
  23639. an SQLCODE parameter in an <embedded COBOL program> is an
  23640. implementation-defined value between 4 and 18, inclusive.
  23641. Implementation-defined elements 661
  23642. X3H2-92-154/DBL CBR-002
  23643. 100Subclause 12.4, "Calls to a <procedure>": The number of bits
  23644. contained in a COBOL character is implementation-defined.
  23645. 101Subclause 12.4, "Calls to a <procedure>": The precision of a
  23646. COBOL data type corresponding to SQL INTEGER or SMALLINT is
  23647. implementation-defined.
  23648. 102Subclause 12.4, "Calls to a <procedure>": The number of bits
  23649. contained in a Fortran character is implementation-defined.
  23650. 103Subclause 12.4, "Calls to a <procedure>": The number of bits
  23651. contained in a Pascal character is implementation-defined.
  23652. 104Subclause 12.3, "<procedure>": The precision of an SQLCODE pa-
  23653. rameter in an <embedded PL/I program> is implementation-defined.
  23654. 105Subclause 12.4, "Calls to a <procedure>": The precision of
  23655. a PL/I data type corresponding to SQL INTEGER or SMALLINT is
  23656. implementation-defined.
  23657. 106Subclause 13.1, "<declare cursor>": Whether null values shall
  23658. be considered greater than or less than all non-null values
  23659. in determining the order of rows in a table associated with a
  23660. <declare cursor> is implementation-defined.
  23661. 107Subclause 14.1, "<set transaction statement>": The isolation
  23662. level that is set for a transaction is an implementation-defined
  23663. isolation level that will not exhibit any of the phenomena that
  23664. the explicit or implicit <level of isolation> would not exhibit,
  23665. as specified in Table 9, "SQL-transaction isolation levels and
  23666. the three phenomena".
  23667. 108Subclause 14.3, "<commit statement>": If any error other than
  23668. those specified in the General Rules preventing commitment
  23669. of the SQL-transaction has occurred, then any changes to SQL-
  23670. data or schemas that were made by the current SQL-transaction
  23671. are canceled and an exception condition is raised: transaction
  23672. rollback with an implementation-defined subclass value.
  23673. 109Subclause 15.1, "<connect statement>": It is implementation-
  23674. defined whether or not an SQL-implementation may support trans-
  23675. actions that affect more than one SQL-server. If it does so,
  23676. then the effects are implementation-defined.
  23677. 110Subclause 15.1, "<connect statement>": If <user name> is not
  23678. specified, then an implementation-defined <user name> for the
  23679. SQL-connection is implicit.
  23680. 111Subclause 15.1, "<connect statement>": The restrictions on
  23681. whether or not the <user name> shall be identical to the <mod-
  23682. ule authorization identifier> for the <module> that contains
  23683. the <procedure> that contains the <connect statement> are
  23684. implementation-defined.
  23685. 662 Database Language SQL
  23686. X3H2-92-154/DBL CBR-002
  23687. 112Subclause 15.1, "<connect statement>": If DEFAULT is speci-
  23688. fied, then the method by which the default SQL-environment is
  23689. determined is implementation-defined.
  23690. 113Subclause 15.1, "<connect statement>": The method by which
  23691. <SQL-server name> is used to determine the appropriate SQL-
  23692. environment is implementation-defined.
  23693. 114Subclause 16.4, "<set session authorization identifier state-
  23694. ment>": Whether or not the <authorization identifier> for the
  23695. SQL-session can be set to an <authorization identifier> other
  23696. than the <authorization identifier> of the SQL-session when the
  23697. SQL-session is started is implementation-defined, as are any
  23698. restrictions pertaining to such changes.
  23699. 115Subclause 17.2, "<allocate descriptor statement>": If WITH MAX
  23700. <occurrences> is not specified, then an implementation-defined
  23701. default value for <occurrences> that is greater than 0 is im-
  23702. plicit.
  23703. 116Subclause 17.2, "<allocate descriptor statement>": The max-
  23704. imum number of SQL descriptor areas and the maximum number
  23705. of item descriptor areas for a single SQL descriptor area are
  23706. implementation-defined.
  23707. 117Subclause 17.5, "<set descriptor statement>": Restrictions
  23708. on changing TYPE, LENGTH, PRECISION, DATETIME_INTERVAL_CODE,
  23709. DATETIME_INTERVAL_PRECISION, SCALE, CHARACTER_SET_CATALOG,
  23710. CHARACTER_SET_SCHEMA, and CHARACTER_SET_NAME values resulting
  23711. from the execution of a <describe statement> before execution
  23712. of a <execute statement>, <dynamic open statement>, or <dynamic
  23713. fetch statement> are implementation-defined, except as specified
  23714. in the General Rules of Subclause 17.9, "<using clause>".
  23715. 118Subclause 17.6, "<prepare statement>": The Format and Syntax
  23716. Rules for a <preparable implementation-defined statement> are
  23717. implementation-defined.
  23718. 119Subclause 18.1, "<get diagnostics statement>": The actual length
  23719. of variable-length character items in the diagnostics area is
  23720. implementation-defined but not less than 128.
  23721. 120Subclause 18.1, "<get diagnostics statement>": The charac-
  23722. ter string value set for CLASS_ORIGIN and SUBCLASS_ORIGIN
  23723. for an implementation-defined class code or subclass code is
  23724. implementation-defined, but shall not be 'ISO 9075'.
  23725. 121Subclause 18.1, "<get diagnostics statement>": The value of
  23726. MESSAGE_TEXT is an implementation-defined character string.
  23727. 122Subclause 19.1, "<embedded SQL host program>": If an <embedded
  23728. character set declaration> is not specified, then an <embedded
  23729. character set declaration> containing an implementation-defined
  23730. <character set specification> is implicit.
  23731. Implementation-defined elements 663
  23732. X3H2-92-154/DBL CBR-002
  23733. 123Subclause 19.3, "<embedded SQL Ada program>": If <character
  23734. set specification> is not specified when CHAR is specified,
  23735. then an implementation-defined <character set specification> is
  23736. implicit.
  23737. 124Subclause 19.3, "<embedded SQL Ada program>": SQLCODE_TYPE
  23738. describes an exact numeric variable whose precision is the
  23739. implementation-defined precision defined for the SQLCODE pa-
  23740. rameter.
  23741. 125Subclause 19.4, "<embedded SQL C program>": If <character set
  23742. specification> is not specified when <C character variable>
  23743. or <C VARCHAR variable> is specified, then an implementation-
  23744. defined <character set specification> is implicit.
  23745. 126Subclause 19.5, "<embedded SQL COBOL program>": The COBOL data
  23746. description clauses, in addition to the PICTURE, SIGN, USAGE and
  23747. VALUE clauses, that may appear in a <COBOL variable definition>
  23748. are implementation-defined.
  23749. 127Subclause 19.5, "<embedded SQL COBOL program>": If <character
  23750. set specification> is not specified when <COBOL character type>
  23751. is specified, then an implementation-defined <character set
  23752. specification> is implicit.
  23753. 128Subclause 19.5, "<embedded SQL COBOL program>": The precision
  23754. of the <COBOL type specification> that corresponds to SQLCODE is
  23755. implementation-defined.
  23756. 129Subclause 19.6, "<embedded SQL Fortran program>": If <character
  23757. set specification> is not specified when CHARACTER is specified,
  23758. then an implementation-defined <character set specification> is
  23759. implicit.
  23760. 130Subclause 19.7, "<embedded SQL MUMPS program>": In a <MUMPS
  23761. character variable>, an implementation-defined <character set
  23762. specification> is implicit.
  23763. 131Subclause 19.8, "<embedded SQL Pascal program>": If <character
  23764. set specification> is not specified when PACKED ARRAY OF CHAR
  23765. is specified, then an implementation-defined <character set
  23766. specification> is implicit.
  23767. 132Subclause 19.9, "<embedded SQL PL/I program>": The PL/I data de-
  23768. scription clauses, in addition to the <PL/I type specification>
  23769. and the INITIAL clause, that may appear in a <PL/I variable
  23770. definition> are implementation-defined.
  23771. 133Subclause 19.9, "<embedded SQL PL/I program>": If <character
  23772. set specification> is not specified when CHARACTER is specified,
  23773. then an implementation-defined <character set specification> is
  23774. implicit.
  23775. 664 Database Language SQL
  23776. X3H2-92-154/DBL CBR-002
  23777. 134Subclause 19.9, "<embedded SQL PL/I program>": The precision
  23778. of the <PL/I type specification> that corresponds to SQLCODE is
  23779. implementation-defined.
  23780. 135Subclause 20.1, "<direct SQL statement>": The <value specifica-
  23781. tion> that represents the null value is implementation-defined.
  23782. 136Subclause 20.1, "<direct SQL statement>": The Format, Syntax
  23783. Rules, and Access Rules for <direct implementation-defined
  23784. statement> are implementation-defined.
  23785. 137Subclause 20.1, "<direct SQL statement>": Whether a <direct
  23786. implementation-defined statement> may be associated with an
  23787. active transaction is implementation-defined.
  23788. 138Subclause 20.1, "<direct SQL statement>": Whether a <direct
  23789. implementation-defined statement> initiates a transaction is
  23790. implementation-defined.
  23791. 139Subclause 20.1, "<direct SQL statement>": The methods of rais-
  23792. ing a condition and of accessing diagnostics information are
  23793. implementation-defined.
  23794. 140Subclause 20.2, "<direct select statement: multiple rows>":
  23795. Whether null values shall be considered greater than or less
  23796. than all non-null values in determining the order of rows in
  23797. a table associated with a <declare cursor> is implementation-
  23798. defined.
  23799. 141Subclause 20.2, "<direct select statement: multiple rows>": The
  23800. method of returning the results is implementation-defined.
  23801. 142Subclause 21.3.13, "TABLE_CONSTRAINTS base table": If the con-
  23802. taining <add table constraint definition> does not specify a
  23803. <constraint name definition>, then the values of CONSTRAINT_
  23804. CATALOG, CONSTRAINT_SCHEMA, and CONSTRAINT_NAME are implementation-
  23805. defined.
  23806. 143Subclause 21.3.23, "CHARACTER_SETS base table": The values of
  23807. FORM_OF_USE and NUMBER_OF_CHARACTERS, in the row for the charac-
  23808. ter set INFORMATION_SCHEMA.SQL_TEXT, are implementation-defined.
  23809. 144Subclause 21.3.24, "COLLATIONS base table": The value of PAD_
  23810. ATTRIBUTE for the collation SQL_TEXT is implementation-defined.
  23811. 145Subclause 21.3.26, "SQL_LANGUAGES base table": The value of SQL_
  23812. LANGUAGE_IMPLEMENTATION is implementation-defined. If the value
  23813. of SQL_LANGUAGE_SOURCE is not 'ISO 9075', then the value of all
  23814. other columns is implementation-defined.
  23815. 146Subclause 22.1, "SQLSTATE": The character set associated with
  23816. the class value and subclass value of the SQLSTATE parameter is
  23817. implementation-defined.
  23818. Implementation-defined elements 665
  23819. X3H2-92-154/DBL CBR-002
  23820. 147Subclause 22.1, "SQLSTATE": The values and meanings for classes
  23821. and subclasses that begin with one of the <digit>s '5', '6',
  23822. '7', '8', or '9' or one of the <simple Latin upper case letter>s
  23823. 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
  23824. 'U', 'V', 'W', 'X', 'Y', or 'Z' are implementation-defined. The
  23825. values and meanings for all subclasses that are associated with
  23826. implementation-defined class values are implementation-defined.
  23827. 148Subclause 22.2, "SQLCODE": The negative values returned in
  23828. an SQLCODE parameter to indicate exception conditions are
  23829. implementation-defined.
  23830. 149Clause 23, "Conformance": The method of flagging nonconform-
  23831. ing SQL language or processing of conforming SQL language is
  23832. implementation-defined, as is the list of additional <key word>s
  23833. that may be required by the implementation.
  23834. 666 Database Language SQL
  23835. Annex C
  23836. (informative)
  23837. Implementation-dependent elements
  23838. This Annex references those places where this International
  23839. Standard states explicitly that the actions of a conforming im-
  23840. plementation are implementation-dependent.
  23841. The term implementation-dependent is used to identify character-
  23842. istics that may differ between implementations, but that are not
  23843. necessarily specified for any particular implementation.
  23844. 1) Subclause 3.3.3, "Specification of the Information Schema" The
  23845. actual objects on which the Information Schema views are based
  23846. are implementation-dependent.
  23847. 2) Subclause 3.3.4.1, "Exceptions": The effect on <target specifi-
  23848. cation>s and SQL descriptor areas of an SQL-statement that ter-
  23849. minates with an exception condition, unless explicitly defined
  23850. by this International Standard, is implementation-dependent.
  23851. 3) Subclause 3.3.4.1, "Exceptions": If more than one condition
  23852. could have occurred as a result of execution of a statement,
  23853. then it is implementation-dependent whether diagnostic informa-
  23854. tion pertaining to more than one condition is made available.
  23855. 4) Subclause 3.3.4.3, "Terms denoting rule requirements": The
  23856. treatment of language that does not conform to the SQL Formats
  23857. and Syntax Rules is implementation-dependent.
  23858. 5) Subclause 3.3.4.4, "Rule evaluation order": It is implementation-
  23859. dependent whether expressions are actually evaluated left-to-
  23860. right when the precedence is not otherwise determined by the
  23861. Formats or by parentheses.
  23862. 6) Subclause 3.3.4.4, "Rule evaluation order": If evaluation
  23863. of the inessential parts of an expression or search condi-
  23864. tion would cause an exception condition to be raised, then it
  23865. is implementation-dependent whether or not that condition is
  23866. raised.
  23867. 7) Subclause 4.1, "Data types": The physical representation of a
  23868. value of a data type is implementation-dependent.
  23869. Implementation-dependent elements 667
  23870. X3H2-92-154/DBL CBR-002
  23871. 8) Subclause 4.1, "Data types": The null value for each data type
  23872. is implementation-dependent.
  23873. 9) Subclause 4.9, "Tables": Because global temporary table contents
  23874. are distinct within SQL-sessions, and created local temporary
  23875. tables are distinct within <module>s within SQL-sessions, the
  23876. effective <schema name> of the schema in which the global tempo-
  23877. rary table or the created local temporary table is instantiated
  23878. is an implementation-dependent <schema name> that may be thought
  23879. of as having been effectively derived from the <schema name> of
  23880. the schema in which the global temporary table or created lo-
  23881. cal temporary table is defined and the implementation-dependent
  23882. SQL-session identifier associated with the SQL-session.
  23883. 10)Subclause 4.9, "Tables": The effective <schema name> of the
  23884. schema in which the created local temporary table is instanti-
  23885. ated may be thought of as being further qualified by a unique
  23886. implementation-dependent name associated with the <module> in
  23887. which the created local temporary table is referenced.
  23888. 11)Subclause 4.9, "Tables": Whether a temporary viewed table is
  23889. materialized is implementation-dependent.
  23890. 12)Subclause 4.19, "Diagnostics area": The actual size of the diag-
  23891. nostics area is implementation-dependent when the SQL-agent does
  23892. not specify the size.
  23893. 13)Subclause 4.19, "Diagnostics area": The ordering of the the
  23894. information about conditions placed into the diagnostics area
  23895. is implementation-dependent, except that the first condition
  23896. in the diagnostics area always corresponds to the condition
  23897. corresponding to the SQLSTATE or SQLCODE value.
  23898. 14)Subclause 4.21, "Cursors": If the <declare cursor> does not
  23899. include an <order by clause>, or includes an <order by clause>
  23900. that does not specify the order of the rows completely, then
  23901. the rows of the table have an order that is defined only to
  23902. the extent that the <order by clause> specifies an order and is
  23903. otherwise implementation-dependent.
  23904. 15)Subclause 4.21, "Cursors": When the ordering of a cursor is not
  23905. defined by an <order by clause>, the relative position of two
  23906. rows is implementation-dependent.
  23907. 16)Subclause 4.21, "Cursors": The effect on the position and state
  23908. of an open cursor when an error occurs during the execution of
  23909. an SQL-statement that identifies the cursor is implementation-
  23910. dependent.
  23911. 17)Subclause 4.21, "Cursors": If a cursor is open and a change is
  23912. made to SQL-data from within the same SQL-transaction other than
  23913. through that cursor, then whether that change will be visible
  23914. through that cursor before it is closed is implementation-
  23915. dependent.
  23916. 668 Database Language SQL
  23917. X3H2-92-154/DBL CBR-002
  23918. 18)Subclause 4.26, "Privileges": The mapping of <authorization
  23919. identifier>s to operating system users is implementation-
  23920. dependent.
  23921. 19)Subclause 4.26, "Privileges": When an SQL-session is initiated,
  23922. the current <authorization identifier> for the SQL-session is
  23923. determined in an implementation-dependent manner, unless the
  23924. session is initiated using a <connect statement>.
  23925. 20)Subclause 4.27, "SQL-agents": An SQL-agent is an implementation-
  23926. dependent entity that causes the execution of SQL-statements.
  23927. 21)Subclause 4.28, "SQL-transactions": The schema definitions that
  23928. are implicitly read on behalf of executing an SQL-statement are
  23929. implementation-dependent.
  23930. 22)Subclause 4.30, "SQL-sessions": The SQL-session <module>
  23931. contains a <module authorization clause> that specifies
  23932. SCHEMA <schema name>, where the value of <schema name> is
  23933. implementation-dependent.
  23934. 23)Subclause 4.30, "SQL-sessions": A unique implementation-
  23935. dependent SQL-session identifier is associated with each SQL-
  23936. session.
  23937. 24)Subclause 4.31, "Client-server operation": The <module name> of
  23938. the <module> that is effectively materialized on an SQL-server
  23939. is implementation-dependent.
  23940. 25)Subclause 4.31, "Client-server operation": Diagnostic infor-
  23941. mation is passed to the diagnostics area in the SQL-client is
  23942. passed in an implementation-dependent manner.
  23943. 26)Subclause 4.31, "Client-server operation": The effect on diag-
  23944. nostic information of incompatibilities between the character
  23945. repertoires supported by the SQL-client and SQL-server environ-
  23946. ments is implementation-dependent.
  23947. 27)Subclause 6.4, "<column reference>": The implicit qualifier of
  23948. a <column reference> for which there is more than one possible
  23949. qualifier with most local scope is implementation-dependent.
  23950. 28)Subclause 6.8, "<datetime value function>": The time of
  23951. evaluation of the CURRENT_DATE, CURRENT_TIME, and CURRENT_
  23952. TIMESTAMP functions during the execution of an SQL-statement
  23953. is implementation-dependent.
  23954. 29)Subclause 6.15, "<interval value expression>": The start date-
  23955. time used for converting intervals to scalars for subtraction
  23956. purposes is implementation-dependent.
  23957. 30)Subclause 7.1, "<row value constructor>": The names of the
  23958. columns of a <row value constructor> that specifies a <row value
  23959. constructor list> are implementation-dependent.
  23960. Implementation-dependent elements 669
  23961. X3H2-92-154/DBL CBR-002
  23962. 31)Subclause 7.9, "<query specification>": When a column is not
  23963. named by an <as clause> and is not derived from a single <col-
  23964. umn reference>, then the name of the column is implementation-
  23965. dependent.
  23966. 32)Subclause 7.10, "<query expression>": If a <simple table> is
  23967. not a <query specification>, then the name of each column of the
  23968. <simple table> is implementation-dependent.
  23969. 33)Subclause 7.10, "<query expression>": If a <non-join query term>
  23970. is not a <non-join query primary> and the <column name> of the
  23971. corresponding columns of both tables participating in the <non-
  23972. join query term> are not the same, then the result column has an
  23973. implementation-dependent <column name>.
  23974. 34)Subclause 7.10, "<query expression>": If a <non-join query ex-
  23975. pression > is not a <non-join query term> and the <column name>
  23976. of the corresponding columns of both tables participating in the
  23977. <non-join query expression > are not the same, then the result
  23978. column has an implementation-dependent <column name>.
  23979. 35)Subclause 8.2, "<comparison predicate>": If CS has the NO PAD
  23980. attribute, then the pad character is an implementation-dependent
  23981. character different from any character in the character set of X
  23982. and Y that collates less than any string under CS.
  23983. 36)Subclause 8.2, "<comparison predicate>": When the operations
  23984. MAX, MIN, DISTINCT, references to a grouping column, and the
  23985. UNION, EXCEPT, and INTERSECT operators refer to character
  23986. strings, the specific value selected by these operations from
  23987. a set of such equal values is implementation-dependent.
  23988. 37)Subclause 9.3, "Set operation result data types": The specific
  23989. character set chosen for the result is implementation-dependent,
  23990. but shall be the character set of one of the data types in DTS.
  23991. 38)Subclause 11.6, "<table constraint definition>": The <constraint
  23992. name> of a constraint that does not specify a <constraint name
  23993. definition> is implementation-dependent.
  23994. 39)Subclause 11.8, "<referential constraint definition>": The spe-
  23995. cific value to use for cascading among various values that are
  23996. not distinct is implementation-dependent.
  23997. 40)Subclause 11.21, "<domain definition>": The <constraint name>
  23998. of a constraint that does not specify a <constraint name defini-
  23999. tion> is implementation-dependent.
  24000. 41)Subclause 12.1, "<module>": If the SQL-agent that performs a
  24001. call of a <procedure> in a <module> is not a standard program in
  24002. the language specified in the <language clause> of the <module>,
  24003. then the results are implementation-dependent.
  24004. 670 Database Language SQL
  24005. X3H2-92-154/DBL CBR-002
  24006. 42)Subclause 12.1, "<module>": If the SQL-agent that performs
  24007. a call of a <procedure> in a <module> is not a program that
  24008. conforms to the programming language standard specified by
  24009. the <language clause> of that <module>, then the effect is
  24010. implementation-dependent.
  24011. 43)Subclause 12.3, "<procedure>": The <procedure name> should be a
  24012. standard-conforming procedure, function, or routine name of the
  24013. language specified by the subject <language clause>. Failure to
  24014. observe this recommendation will have implementation-dependent
  24015. effects.
  24016. 44)Subclause 12.3, "<procedure>": After the execution of the last
  24017. <procedure>, if an unrecoverable error has not occurred, and
  24018. the SQL-agent did not terminate unexpectedly, and no constraint
  24019. is not satisfied, then the choice of whether to perform a <com-
  24020. mit statement> or a <rollback statement> is implementation-
  24021. dependent. The determination of whether an SQL-agent has termi-
  24022. nated unexpectedly is implementation-dependent.
  24023. 45)Subclause 12.3, "<procedure>": If there are more than one status
  24024. parameter, then the order in which values are assigned to these
  24025. status parameters is implementation-dependent.
  24026. 46)Subclause 13.1, "<declare cursor>": If a <declare cursor>
  24027. does not contain an <order by clause>, then the ordering of
  24028. rows in the table associated with that <declare cursor> is
  24029. implementation-dependent.
  24030. 47)Subclause 13.1, "<declare cursor>": If a <declare cursor> con-
  24031. tains an <order by clause> and a group of two or more rows in
  24032. the table associated with that <declare cursor> contain val-
  24033. ues that are the null value or compare equal according to
  24034. Subclause 8.2, "<comparison predicate>", in all columns spec-
  24035. ified in the <order by clause>, then the order in which rows in
  24036. that group are returned is implementation-dependent.
  24037. 48)Subclause 13.3, "<fetch statement>": The order of assign-
  24038. ment to targets in the <fetch target list> of values returned
  24039. by a <fetch statement>, other than status parameters, is
  24040. implementation-dependent.
  24041. 49)Subclause 13.3, "<fetch statement>": If an error occurs during
  24042. assignment of a value to a target during the execution of a
  24043. <fetch statement>, then the values of targets other than status
  24044. parameters are implementation-dependent.
  24045. 50)Subclause 13.5, "<select statement: single row>": If the cardi-
  24046. nality of the <query expression> is greater than 1, then it is
  24047. implementation-dependent whether or not values are assigned to
  24048. the targets identified by the <select target list>.
  24049. Implementation-dependent elements 671
  24050. X3H2-92-154/DBL CBR-002
  24051. 51)Subclause 13.5, "<select statement: single row>": The order
  24052. of assignment to targets in the <select target list> of values
  24053. returned by a <select statement: single row>, other than status
  24054. parameters, is implementation-dependent.
  24055. 52)Subclause 13.5, "<select statement: single row>": If an error
  24056. occurs during assignment of a value to a target during the ex-
  24057. ecution of a <select statement: single row>, then the values
  24058. of targets other than status parameters are implementation-
  24059. dependent.
  24060. 53)Subclause 14.1, "<set transaction statement>": If <number of
  24061. conditions> is not specified, then an implementation-dependent
  24062. value not less than 1 is implicit.
  24063. 54)Subclause 15.3, "<disconnect statement>": If ALL is specified,
  24064. then L is a list representing every active SQL-connection that
  24065. has been established by a <connect statement> by the current
  24066. SQL-agent and that has not yet been disconnected by a <discon-
  24067. nect statement>, in an implementation-dependent order.
  24068. 55)Subclause 17.4, "<get descriptor statement>": If an exception
  24069. condition is raised in a <get descriptor statement>, then the
  24070. values of all targets specified by <simple target specifica-
  24071. tion 1> and <simple target specification 2> are implementation-
  24072. dependent.
  24073. 56)Subclause 17.4, "<get descriptor statement>": For a <select
  24074. list> column, if the column name is implementation-dependent,
  24075. then NAME is the implementation-dependent name for the column
  24076. and UNNAMED is set to 1.
  24077. 57)Subclause 17.4, "<get descriptor statement>": For a <dynamic
  24078. parameter specification>, the values of NAME and UNNAMED are
  24079. implementation-dependent.
  24080. 58)Subclause 17.5, "<set descriptor statement>": Item descriptor
  24081. area fields not relevant to the data type of the item being de-
  24082. scribed according to the General Rules of Subclause 17.5, "<set
  24083. descriptor statement>", are set to implementation-dependent
  24084. values.
  24085. 59)Subclause 17.5, "<set descriptor statement>": If an exception
  24086. condition is raised in a <set descriptor statement>, then the
  24087. values of all elements of the descriptor specified in the <set
  24088. descriptor statement> are implementation-dependent.
  24089. 60)Subclause 17.6, "<prepare statement>": The validity of an <ex-
  24090. tended statement name> value or a <statement name> in an SQL-
  24091. transaction different from the one in which the statement was
  24092. prepared is implementation-dependent.
  24093. 672 Database Language SQL
  24094. X3H2-92-154/DBL CBR-002
  24095. 61)Subclause 17.9, "<using clause>": When a <describe output state-
  24096. ment> is executed, the values of DATA and INDICATOR, as well
  24097. as the value of other fields not relevant to the data type of
  24098. the described item, are implementation-dependent. If the col-
  24099. umn name is implementation-dependent, then NAME is set to that
  24100. implementation-dependent name.
  24101. 62)Subclause 17.9, "<using clause>": When a <describe input state-
  24102. ment> is used, the values for NAME, DATA, and INDICATOR, as well
  24103. as the value of other fields not relevant to the data type of
  24104. the described item, in the SQL dynamic descriptor area structure
  24105. are implementation-dependent.
  24106. 63)Subclause 18.1, "<get diagnostics statement>": The value of
  24107. ROW_COUNT following the execution of an SQL-statement that
  24108. does not directly result in the execution of a <delete state-
  24109. ment: searched>, an <insert statement>, or an <update statement:
  24110. searched> is implementation-dependent.
  24111. 64)Subclause 18.1, "<get diagnostics statement>": If <condition
  24112. number> has a value other than 1, then the association between
  24113. <condition number> values and specific conditions raised dur-
  24114. ing evaluation of the General Rules for that SQL-statement is
  24115. implementation-dependent.
  24116. 65)Subclause 19.1, "<embedded SQL host program>": The <module name>
  24117. of the implied <module> derived from an <embedded SQL host pro-
  24118. gram> is implementation-dependent.
  24119. 66)Subclause 19.1, "<embedded SQL host program>": The <module au-
  24120. thorization identifier> of the implied <module> derived from an
  24121. <embedded SQL host program> is implementation-dependent.
  24122. 67)Subclause 19.1, "<embedded SQL host program>": In each <de-
  24123. clare cursor> in the implied <module> derived from an <embedded
  24124. SQL host program>, each <embedded variable name> has been re-
  24125. placed consistently with a distinct <parameter name> that is
  24126. implementation-dependent.
  24127. 68)Subclause 19.1, "<embedded SQL host program>": The <procedure
  24128. name> of each <procedure> in the implied <module> derived from
  24129. an <embedded SQL host program> is implementation-dependent.
  24130. 69)Subclause 19.1, "<embedded SQL host program>": In each <pro-
  24131. cedure> in the implied <module> derived from an <embedded
  24132. SQL host program>, each <embedded variable name> has been re-
  24133. placed consistently with a distinct <parameter name> that is
  24134. implementation-dependent.
  24135. 70)Subclause 19.1, "<embedded SQL host program>": For <SQL pro-
  24136. cedure statement>s other than <open statement>s, whether one
  24137. <procedure> in the implied <module> derived from an <embedded
  24138. SQL host program> can correspond to more than one <SQL procedure
  24139. Implementation-dependent elements 673
  24140. X3H2-92-154/DBL CBR-002
  24141. statement> in the <embedded SQL host program> is implementation-
  24142. dependent.
  24143. 71)Subclause 19.1, "<embedded SQL host program>": In each <proce-
  24144. dure> in the implied <module> derived from an <embedded SQL host
  24145. program>, the order of the instances of <parameter declaration>
  24146. is implementation-dependent.
  24147. 72)Subclause 20.1, "<direct SQL statement>": If an unrecoverable
  24148. error has occurred, or if the direct invocation of SQL termi-
  24149. nated unexpectedly, or if any constraint is not satisfied, then
  24150. a <rollback statement> is performed. Otherwise, the choice of
  24151. which of these SQL-statements to perform is implementation-
  24152. dependent. The determination of whether a direct invocation of
  24153. SQL has terminated unexpectedly is implementation-dependent.
  24154. 73)Subclause 20.2, "<direct select statement: multiple rows>":
  24155. If an <order by clause> is not specified, then the ordering
  24156. of rows in the table associated with that <declare cursor> is
  24157. implementation-dependent.
  24158. 74)Subclause 20.2, "<direct select statement: multiple rows>": If
  24159. an <order by clause> is specified and a group of two or more
  24160. rows in the resulting table contain values that are the null
  24161. value or compare equal according to Subclause 8.2, "<compar-
  24162. ison predicate>", in all columns specified in the <order by
  24163. clause>, then the order in which rows in that group are returned
  24164. is implementation-dependent.
  24165. 75)Subclause 21.3.23, "CHARACTER_SETS base table": The values of
  24166. DEFAULT_COLLATE_SCHEMA, DEFAULT_COLLATE_CATALOG, and DEFAULT_
  24167. COLLATE_NAME for default collations specifying the order of
  24168. characters in a repertoire are implementation-dependent.
  24169. 674 Database Language SQL
  24170. Annex D
  24171. (informative)
  24172. Deprecated features
  24173. It is intended that the following features will be removed at a
  24174. later date from a revised version of this International Standard:
  24175. 1) SQLCODE
  24176. 2) <COBOL computational integer>s in <embedded SQL COBOL program>s.
  24177. 3) The <unsigned integer> option of <sort specification> of <de-
  24178. clare cursor>.
  24179. 4) The <parameter declaration>s in a <procedure> without enclosing
  24180. parentheses and without commas separating multiple <parameter
  24181. declaration>s.
  24182. Deprecated features 675
  24183. 676 Database Language SQL
  24184. X3H2-92-154/DBL CBR-002
  24185. Annex E
  24186. (informative)
  24187. Incompatibilities with ISO/IEC 9075:1989
  24188. This International Standard introduces some incompatibilities
  24189. with the earlier version of Database Language SQL as specified
  24190. in ISO/IEC 9075:1989. Unless specified in this Annex, features
  24191. and capabilities of Database Language SQL are compatible with the
  24192. earlier version of this International Standard.
  24193. 1) In Subclause 4.12, "Cursors", and Subclause 8.3, "<declare cur-
  24194. sor>", General Rule 3)a)iii) of ISO/IEC 9075:1989, a requirement
  24195. was made that multiple openings of an unordered cursor within a
  24196. single SQL-transaction return the rows in the same order every
  24197. time. In this International Standard, the order of rows returned
  24198. for an unordered cursor is always implementation-dependent.
  24199. 2) In ISO/IEC 9075:1989, <parameter name>s were simple <identi-
  24200. fier>s. In this International Standard, colons are now required
  24201. to delimit <parameter name>s.
  24202. 3) In ISO/IEC 9075:1989, the specification of the enforcement of
  24203. WITH CHECK OPTION for a view was ambiguous. This International
  24204. Standard clarifies the intent of WITH CHECK OPTION.
  24205. 4) In ISO/IEC 9075:1989, the <unique constraint definition> had no
  24206. rule to prevent defining two unique constraints with identical
  24207. unique column lists on a table. This International Standard
  24208. adds a Syntax Rule to require that all unique column lists be
  24209. distinct.
  24210. 5) In ISO/IEC 9075:1989, there were no requirements that users have
  24211. SELECT privileges on tables that were referenced in contexts
  24212. other than <select statement: single row> or <fetch statement>.
  24213. This International Standard adds Access Rules to require that
  24214. users have SELECT privilege on tables referenced in various
  24215. <query expression>s, <table expression>s, <search condition>s,
  24216. and <value expression>s.
  24217. 6) In ISO/IEC 9075:1989, the specification of a view did not
  24218. preclude the possibility of defining a view in terms of it-
  24219. self. This International Standard adds a Syntax Rule in
  24220. Incompatibilities with ISO/IEC 9075:1989 677
  24221. X3H2-92-154/DBL CBR-002
  24222. Subclause 11.19, "<view definition>" to preclude that possi-
  24223. bility.
  24224. 7) In ISO/IEC 9075:1989, the specification did not preclude the
  24225. possibility of using outer references in <set function specifi-
  24226. cation>s in <subquery>s contained in the <search condition> of
  24227. a <having clause>, but did not define the semantics of such a
  24228. construction. This International Standard adds a Syntax Rule in
  24229. Subclause 6.5, "<set function specification>", and a Syntax Rule
  24230. in Subclause 7.6, "<where clause>", to preclude that possibil-
  24231. ity.
  24232. 8) In ISO/IEC 9075:1989, the <module> derived from an <embedded SQL
  24233. host program> had an implementor-defined <module authorization
  24234. identifier>. As the time of binding was not specified, this
  24235. meant that the authorization identifier for privilege checking
  24236. could be determined at either compile-time or run-time. In this
  24237. International Standard, the derived <module> has no <module
  24238. authorization identifier> and the authorization identifier for
  24239. privilege checking is determined at run-time.
  24240. 9) In ISO/IEC 9075:1989, if a cursor is on or before a row and that
  24241. row is deleted, then the cursor is positioned before the row
  24242. that is immediately after the position of the deleted row. In
  24243. this International Standard, if the deletion is not made through
  24244. that cursor, then the effect of the deletion is implementation-
  24245. dependent.
  24246. 10)A number of additional <reserved word>s have been added to the
  24247. language. These <reserved word>s are:
  24248. - ABSOLUTE
  24249. - ACTION
  24250. - ADD
  24251. - ALLOCATE
  24252. - ALTER
  24253. - ARE
  24254. - ASSERTION
  24255. - AT
  24256. - BETWEEN
  24257. - BIT
  24258. - BIT_LENGTH
  24259. - BOTH
  24260. - CASCADE
  24261. 678 Database Language SQL
  24262. X3H2-92-154/DBL CBR-002
  24263. - CASCADED
  24264. - CASE
  24265. - CAST
  24266. - CATALOG
  24267. - CHAR_LENGTH
  24268. - CHARACTER_LENGTH
  24269. - COALESCE
  24270. - COLLATE
  24271. - COLLATION
  24272. - COLUMN
  24273. - CONNECT
  24274. - CONNECTION
  24275. - CONSTRAINT
  24276. - CONSTRAINTS
  24277. - CONVERT
  24278. - CORRESPONDING
  24279. - CROSS
  24280. - CURRENT_DATE
  24281. - CURRENT_TIME
  24282. - CURRENT_TIMESTAMP
  24283. - CURRENT_USER
  24284. - DATE
  24285. - DAY
  24286. - DEALLOCATE
  24287. - DEFERRABLE
  24288. - DEFERRED
  24289. - DESCRIBE
  24290. - DESCRIPTOR
  24291. - DIAGNOSTICS
  24292. - DISCONNECT
  24293. Incompatibilities with ISO/IEC 9075:1989 679
  24294. X3H2-92-154/DBL CBR-002
  24295. - DOMAIN
  24296. - DROP
  24297. - ELSE
  24298. - END-EXEC
  24299. - EXCEPT
  24300. - EXCEPTION
  24301. - EXECUTE
  24302. - EXTERNAL
  24303. - EXTRACT
  24304. - FALSE
  24305. - FIRST
  24306. - FULL
  24307. - GET
  24308. - GLOBAL
  24309. - HOUR
  24310. - IDENTITY
  24311. - IMMEDIATE
  24312. - INITIALLY
  24313. - INNER
  24314. - INPUT
  24315. - INSENSITIVE
  24316. - INTERSECT
  24317. - INTERVAL
  24318. - ISOLATION
  24319. - JOIN
  24320. - LAST
  24321. - LEADING
  24322. - LEFT
  24323. - LEVEL
  24324. - LOCAL
  24325. 680 Database Language SQL
  24326. X3H2-92-154/DBL CBR-002
  24327. - LOWER
  24328. - MATCH
  24329. - MINUTE
  24330. - MONTH
  24331. - NAMES
  24332. - NATIONAL
  24333. - NATURAL
  24334. - NCHAR
  24335. - NEXT
  24336. - NO
  24337. - NULLIF
  24338. - OCTET_LENGTH
  24339. - ONLY
  24340. - OUTER
  24341. - OUTPUT
  24342. - OVERLAPS
  24343. - PAD
  24344. - PARTIAL
  24345. - POSITION
  24346. - PREPARE
  24347. - PRESERVE
  24348. - PRIOR
  24349. - READ
  24350. - RELATIVE
  24351. - RESTRICT
  24352. - REVOKE
  24353. - RIGHT
  24354. - ROWS
  24355. - SCROLL
  24356. - SECOND
  24357. Incompatibilities with ISO/IEC 9075:1989 681
  24358. X3H2-92-154/DBL CBR-002
  24359. - SESSION
  24360. - SESSION_USER
  24361. - SIZE
  24362. - SPACE
  24363. - SQLSTATE
  24364. - SUBSTRING
  24365. - SYSTEM_USER
  24366. - TEMPORARY
  24367. - THEN
  24368. - TIME
  24369. - TIMESTAMP
  24370. - TIMEZONE_HOUR
  24371. - TIMEZONE_MINUTE
  24372. - TRAILING
  24373. - TRANSACTION
  24374. - TRANSLATE
  24375. - TRANSLATION
  24376. - TRIM
  24377. - TRUE
  24378. - UNKNOWN
  24379. - UPPER
  24380. - USAGE
  24381. - USING
  24382. - VALUE
  24383. - VARCHAR
  24384. - VARYING
  24385. - WHEN
  24386. - WRITE
  24387. - YEAR
  24388. 682 Database Language SQL
  24389. X3H2-92-154/DBL CBR-002
  24390. - ZONE
  24391. Incompatibilities with ISO/IEC 9075:1989 683
  24392. 684 Database Language SQL
  24393. X3H2-92-154/DBL CBR-002
  24394. Annex F
  24395. (informative)
  24396. Maintenance and interpretation of SQL
  24397. ISO/IEC JTC1 provides formal procedures for revision, maintenance,
  24398. and interpretation of JTC1 Standards. Section 6.13 of the JTC1
  24399. Directives, "Maintenance/correction of defects in JTC1 Standards",
  24400. specifies procedures for creating and processing "defect reports".
  24401. Defect reports may result in technical corrigendum, amendments,
  24402. interpretations, or other commentary on an existing International
  24403. Standard. In addition, SC21, the JTC1 subcommittee that devel-
  24404. oped this International Standard, provides procedures for raising
  24405. new "questions" about topics related to existing SC21 projects.
  24406. Questions may result in interpretations, new project proposals, or
  24407. possibly new defect reports.
  24408. Since publication of ISO/IEC 9075:1989, the following SC21 ques-
  24409. tions have resulted in formal interpretations of Database Language
  24410. SQL. The first number in parentheses identifies the SC21 document
  24411. in which the question was first raised, and the second number iden-
  24412. tifies the SC21 document in which the proposed interpretation was
  24413. formally adopted.
  24414. 1) Expression Evaluation (SC21 N5142, SC21 N5468)
  24415. 2) Read-Only Cursors (SC21 N5143, SC21 N5469)
  24416. 3) Working Viewed Tables (SC21 N5144, SC21 N5470)
  24417. 4) Authorization Id (SC21 N5145, SC21 N5471)
  24418. Since publication of ISO/IEC 9075:1989, several new defects have
  24419. been discovered in the SQL language, leading to creation of the
  24420. following defect reports.
  24421. 1) General Clarifications, Defect Report 9075/5 (WG3 N1150, N1160)
  24422. 2) General Clarifications, Defect Report 9075/6 (WG3 N1161)
  24423. The SQL language corrections proposed in each defect report were
  24424. accepted by SC21/WG3 in May 1991 (see SC21 N6249, Arles WG3
  24425. Resolutions). Further processing within SC21 was superseded by
  24426. adoption of ISO/IEC 9075:1992 as a replacement standard for ISO/IEC
  24427. Maintenance and interpretation of SQL 685
  24428. X3H2-92-154/DBL CBR-002
  24429. 9075:1989. All corrections to SQL proposed by these defect reports
  24430. are included in this International Standard.
  24431. Potential new questions or new defect reports addressing the spec-
  24432. ifications of this International Standard should be communicated
  24433. to:
  24434. Secretariat, ISO/IEC JTC1/SC21/WG3
  24435. Standards Council of Canada
  24436. Ottawa, Ontario
  24437. Canada.
  24438. 686 Database Language SQL
  24439. Index
  24440. . . . , 8 a completion condition is
  24441. !!, 8 raised, 10
  24442. |, 22, 27 ACTION, 84, 274, 276, 590,
  24443. ::=, 7 591, 592, 678
  24444. <1987>, 16 <action>, 64, 245, 246,
  24445. <1989>, 16 329, 330, 332, 333, 338,
  24446. <1992>, 16, 17 632
  24447. < >, 7 <action list>, 245
  24448. [ ], 8 <actual identifier>, 98
  24449. { }, 8 Ada, 3, 49, 61, 342, 344,
  24450. |, 8 352, 356, 357, 489, 490,
  24451. - A - 491, 493, 495, 498, 500,
  24452. abandoned, 336, 337, 338 501, 502, 503, 614, 625,
  24453. ABSOLUTE, 84, 377, 378, 639, 651, 661
  24454. 379, 678 ADA, 83, 243, 344, 352,
  24455. access mode, 67, 74, 350, 362, 493, 613, 614
  24456. 384, 386, 389, 392, 394, <Ada assignment operator>,
  24457. 400, 528 500
  24458. Access Rules, 9, 10, 12, <Ada host identifier>, 490,
  24459. 13, 15, 38, 64, 77, 289, 500, 501
  24460. 290, 292, 294, 300, 310, <Ada initial value>, 500,
  24461. 313, 318, 323, 330, 331, 501
  24462. 332, 338, 375, 398, 443, <Ada qualified type
  24463. 462, 467, 472, 475, 476, specification>, 500,
  24464. 477, 525, 526, 625, 665, 501, 503, 651
  24465. 677 <Ada type specification>,
  24466. 500, 502
  24467. Index 1
  24468. <Ada unqualified type <alter column definition>,
  24469. specification>, 500 266, 283, 286, 287, 288,
  24470. <Ada variable definition>, 645
  24471. 490, 500, 501, 502, 639 <alter domain action>, 304
  24472. ADD, 84, 284, 291, 307, <alter domain statement>,
  24473. 310, 678 52, 281, 304, 305, 306,
  24474. <add column definition>, 307, 308, 338, 368, 482,
  24475. 283, 284, 285, 645 633
  24476. <add domain constraint <alter table action>, 283
  24477. definition>, 304, 307, <alter table statement>,
  24478. 634 52, 262, 263, 265, 272,
  24479. Additional common elements, 274, 281, 283, 284, 286,
  24480. 239 289, 291, 292, 338, 368,
  24481. <add table constraint 482, 645
  24482. definition>, 272, 283, ambiguous cursor name, 443,
  24483. 291, 310, 586, 646, 665 462, 619
  24484. AFTER, 85 <ampersand>, 79, 80, 489,
  24485. ALIAS, 85 491
  24486. ALL, 84, 124, 126, 176, AND, 84, 211, 228, 229,
  24487. 183, 184, 196, 197, 200, 230, 272, 538, 539, 542,
  24488. 201, 202, 220, 245, 246, 543, 544, 545, 546, 547,
  24489. 294, 300, 332, 338, 401, 548, 549, 550, 551, 552,
  24490. 402, 403, 412, 586, 616, 553, 554, 555, 556, 557,
  24491. 641, 672 558, 559, 561, 562, 570,
  24492. <all>, 220 571, 580, 581, 612, 613,
  24493. ALLOCATE, 84, 431, 465, 617, 618
  24494. 482, 678 an exception condition is
  24495. <allocate cursor statement> raised, 10
  24496. , 49, 53, 55, 57, 58, ANSI/IEEE 770/X3.160, 517
  24497. 59, 62, 104, 369, 447, ANSI/IEEE 770/X3.97, 517
  24498. 449, 465, 466, 469, 476, ANSI/MDC X11.1, 515
  24499. 477, 482, 635, 638 ANSI/MIL-STD-1815A, 3, 501
  24500. <allocate descriptor ANSI X3.135, xiii, xvi, 75,
  24501. statement>, 54, 60, 76, 85, 677, 678
  24502. 62, 104, 369, 431, 482 ANSI X3.159, 505
  24503. ALTER, 84, 283, 286, 292, ANSI X3.198, 512
  24504. 304, 310, 338, 482, 678 ANSI X3.23, 3, 509
  24505. <alter column action>, 286 ANSI X3.53, 3, 521
  24506. ANSI X3.9, 512
  24507. 2 Database Language SQL
  24508. ANY, 84, 212, 220, 571, AS, 84, 118, 120, 122, 144,
  24509. 573, 580, 583, 584, 585, 146, 147, 169, 170, 182,
  24510. 586, 591, 595, 596, 606, 191, 202, 209, 296, 298,
  24511. 608, 610, 611 301, 311, 362, 363, 364,
  24512. applicable, 66, 119, 122, 365, 366, 407, 446, 456,
  24513. 135, 145, 246, 249, 251, 457, 458, 538, 539, 541,
  24514. 264, 276, 282, 298, 302, 542, 543, 544, 545, 546,
  24515. 304, 310, 312, 316, 321, 547, 548, 549, 550, 551,
  24516. 326, 329, 337, 373, 384, 552, 553, 554, 555, 556,
  24517. 386, 389, 392, 394, 452, 557, 558, 559, 561, 562,
  24518. 453, 454, 455, 493, 531, 563, 564, 565, 586, 616,
  24519. 572 617, 641
  24520. applicable privileges, 66, ASC, 84, 371, 531
  24521. 119, 122, 135, 145, 246, <as clause>, 191, 192, 670
  24522. 249, 251, 264, 276, 282, assertion, 43
  24523. 298, 302, 310, 312, 316, ASSERTION, 84, 259, 325,
  24524. 321, 326, 329, 337, 384, 328, 338, 482, 537, 617,
  24525. 386, 389, 392, 394 618, 678
  24526. application program, 2, 77 <assertion check>, 325
  24527. <approximate numeric <assertion definition>, 52,
  24528. literal>, 90, 94, 95, 255, 257, 325, 326, 368,
  24529. 148, 150 482, 593, 594, 632, 634,
  24530. <approximate numeric type>, 635, 637, 639
  24531. 29, 107, 108, 110, 453, assertion descriptor, 40,
  24532. 454, 658 43, 44, 300, 326, 337,
  24533. approximate numeric value, 338, 598
  24534. 28 Assertions, 43
  24535. <arc1>, 16 ASSERTIONS, 553, 593, 598,
  24536. <arc2>, 16 616, 640
  24537. <arc3>, 16 ASSERTIONS base table, 598
  24538. ARE, 84, 344, 490, 678 Assertions on the base
  24539. <argument>, 451, 455, 456, tables, 616
  24540. 457, 460 ASSERTIONS view, 553
  24541. ASSERTIONS_DEFERRED_CHECK,
  24542. 598
  24543. ASSERTIONS_FOREIGN_KEY_
  24544. CHECK_CONSTRAINTS, 598
  24545. Index 3
  24546. ASSERTIONS_FOREIGN_KEY_ BETWEEN, 84, 211, 678
  24547. SCHEMATA, 598 <between predicate>, 205,
  24548. ASSERTIONS_INITIALLY_ 211, 444, 446
  24549. DEFERRED_NOT_NULL, 598 BIT, 19, 35, 84, 107, 109,
  24550. ASSERTIONS_IS_DEFERRABLE_ 351, 352, 356, 357, 358,
  24551. NOT_NULL, 598 359, 360, 361, 362, 363,
  24552. ASSERTIONS_PRIMARY_KEY, 598 364, 366, 425, 429, 440,
  24553. assignable, 5, 34, 35, 231 445, 500, 502, 505, 506,
  24554. <asterisk>, 79, 80, 124, 507, 510, 512, 513, 514,
  24555. 157, 158, 168, 191, 512 517, 518, 519, 520, 522,
  24556. ASYNC, 85
  24557. AT, 84, 165, 166, 678 523, 570, 635, 639, 678
  24558. AUTHORIZATION, 84, 255, <bit>, 89, 90, 92
  24559. 257, 341, 343, 420, 484, <bit concatenation>, 27,
  24560. 535, 567, 644 160, 162, 163
  24561. <authorization identifier>, <bit factor>, 160, 162, 163
  24562. 44, 46, 64, 65, 66, 72, <bit length expression>,
  24563. 73, 98, 102, 103, 116, 128, 131, 630
  24564. 245, 246, 255, 256, 258, <bit primary>, 160, 161,
  24565. 260, 261, 283, 289, 290, 163
  24566. 294, 297, 298, 300, 302, bit string, 26
  24567. Bit string comparison and
  24568. 304, 309, 310, 312, 313, assignment, 27
  24569. 316, 318, 321, 323, 326, bit string data type
  24570. 328, 329, 330, 331, 332, descriptor, 26
  24571. 333, 336, 341, 342, 348, <bit string literal>, 82,
  24572. 397, 398, 407, 409, 420, 86, 89, 92, 93, 95, 97,
  24573. 421, 487, 526, 568, 600, 266, 267, 629
  24574. 601, 603, 605, 655, 657, Bit strings, 26
  24575. 663, 669 <bit string type>, 107,
  24576. AVG, 84, 124, 125, 126, 659 109, 113, 453, 454, 630
  24577. bit string variable, 27
  24578. - B - <bit substring function>,
  24579. Backus Naur Form, 7 27, 133, 134, 137
  24580. Backus Normal Form, 7 <bit value expression>,
  24581. <1989 base>, 16 133, 134, 137, 160, 162,
  24582. base table, 45 163, 631
  24583. base table descriptor, 39 <bit value function>, 132,
  24584. BEFORE, 85 137, 630
  24585. BEGIN, 84, 490
  24586. 4 Database Language SQL
  24587. BIT_LENGTH, 84, 128, 131, CARDINAL_NUMBER_DOMAIN_
  24588. 148, 151, 152, 445, 507, CHECK, 565
  24589. 678 <C array specification>,
  24590. BNF, 7 504, 505, 506, 507
  24591. BOOLEAN, 85 CASCADE, 84, 258, 274, 277,
  24592. <boolean factor>, 36, 229 278, 279, 289, 290, 292,
  24593. <boolean primary>, 229 294, 300, 310, 313, 318,
  24594. <boolean term>, 229 323, 337, 338, 590, 591,
  24595. <boolean test>, 229, 230, 592, 678
  24596. 632 CASCADED, 40, 84, 296, 297,
  24597. BOTH, 84, 132, 134, 136, 299, 578, 579, 633, 679
  24598. 152, 153, 154, 407, 408, CASE, 76, 84, 141, 142,
  24599. 415, 417, 419, 420, 431, 543, 544, 679
  24600. 447, 465, 678 <case abbreviation>, 141
  24601. BREADTH, 85 <case expression>, 26, 141,
  24602. BY, 84, 187, 196, 371, 372, 143, 155, 156, 237, 642
  24603. 374, 464, 530, 616, 617, <case operand>, 141, 142
  24604. 635, 638 <case specification>, 141,
  24605. - C - 142, 143, 444, 446
  24606. C, 3, 49, 61, 83, 243, 357, CAST, 35, 84, 144, 146,
  24607. 358, 362, 363, 452, 454, 147, 169, 170, 192, 202,
  24608. 489, 490, 491, 493, 495, 209, 353, 362, 363, 364,
  24609. 498, 504, 505, 506, 507, 365, 366, 446, 456, 457,
  24610. 613, 614, 625, 639, 651, 458, 679
  24611. 661, 664 <cast operand>, 144, 145
  24612. calendar, 5 <cast specification>, 43,
  24613. CALL, 85 49, 144, 145, 146, 147,
  24614. Calls to a <procedure>, 352 154, 155, 156, 456, 457,
  24615. cardinality, 5, 37, 125, 458, 642
  24616. 126, 174, 178, 191, 194, <cast target>, 144
  24617. 203, 222, 382, 485, 537, catalog, 45, 46
  24618. 589, 671 CATALOG, 84, 415, 417, 484,
  24619. cardinality violation, 203, 679
  24620. 382, 620 <catalog name>, 15, 44, 45,
  24621. CARDINAL_NUMBER, 565, 570, 64, 98, 101, 102, 104,
  24622. 580, 588, 606 256, 258, 341, 415, 417,
  24623. CARDINAL_NUMBER domain, 565 486, 487, 629, 654, 657,
  24624. 661
  24625. Index 5
  24626. Catalogs, 45 <character factor>, 160,
  24627. CATALOG_NAME, 83, 480, 481, 161, 162
  24628. 486, 487, 536, 538, 539, Characteristics of numbers,
  24629. 541, 542, 543, 544, 545, 28
  24630. 546, 547, 548, 549, 550, character not in repertoire
  24631. 551, 552, 553, 554, 555, , 111, 620
  24632. 556, 557, 558, 559, 561, <character primary>, 160,
  24633. 562, 569, 571, 573, 580, 162
  24634. 583, 584, 585, 586, 591, character repertoire, 5, 7,
  24635. 595, 596, 606, 608, 610, 20, 21, 23, 24, 35, 46,
  24636. 611 74, 85, 86, 92, 93, 100,
  24637. <C bit variable>, 504, 505, 109, 111, 129, 133, 134,
  24638. 507, 639 136, 145, 160, 208, 237,
  24639. <C character variable>, 248, 249, 250, 266, 312,
  24640. 504, 505, 506, 507, 664 315, 316, 506, 607, 660,
  24641. <C class modifier>, 504 669
  24642. <C derived variable>, 504, <character representation>,
  24643. 507, 639, 651 88, 89, 92, 93, 95, 97,
  24644. CHAR, 84, 107, 108, 356, 216, 500, 501, 505, 506,
  24645. 360, 361, 500, 501, 502, 508, 509, 520, 521, 629
  24646. 517, 518, 519, 520, 522, <character set definition>,
  24647. 664 52, 255, 257, 311, 312,
  24648. character, 5 323, 368, 482, 644, 646
  24649. CHARACTER, 19, 20, 21, 35, character set descriptor,
  24650. 49, 84, 107, 108, 109, 21, 44, 250, 311, 312,
  24651. 113, 248, 255, 259, 263, 318, 606
  24652. 301, 311, 313, 329, 332, <character set name>, 44,
  24653. 351, 352, 356, 357, 358, 93, 99, 103, 104, 105,
  24654. 359, 360, 361, 362, 363, 108, 248, 249, 259, 302,
  24655. 364, 365, 366, 367, 426, 311, 312, 313, 316, 321,
  24656. 429, 440, 445, 447, 482, 329, 331, 333, 419, 452,
  24657. 483, 500, 501, 504, 505, 454, 656, 657
  24658. 506, 508, 509, 510, 512, <character set source>, 311
  24659. 513, 516, 517, 518, 520,
  24660. 521, 522, 523, 564, 570,
  24661. 604, 605, 640, 646, 647,
  24662. 651, 653, 657, 658, 664
  24663. 6 Database Language SQL
  24664. <character set specifica- <character value
  24665. tion>, 85, 86, 87, 89, expression>, 23, 24,
  24666. 92, 93, 97, 98, 100, 128, 129, 130, 132, 133,
  24667. 105, 107, 109, 248, 249, 135, 136, 160, 161, 162,
  24668. 250, 255, 256, 263, 301, 164, 214, 444, 642
  24669. 314, 320, 331, 335, 344, <character value function>,
  24670. 426, 490, 500, 501, 503, 132, 137, 138, 630, 641
  24671. 504, 506, 507, 508, 510, CHARACTER_DATA, 564, 570,
  24672. 511, 512, 513, 514, 517, 573, 574, 576, 578, 580,
  24673. 518, 519, 520, 521, 523, 585, 590, 593, 598, 600,
  24674. 629, 630, 644, 651, 660, 602, 604, 608, 612
  24675. 663, 664 CHARACTER_DATA domain, 564
  24676. character string, 20 CHARACTER_LENGTH, 84, 128,
  24677. character string data type 151, 445, 679
  24678. descriptor, 20 CHARACTER_MAXIMUM_LENGTH,
  24679. <character string literal>, 539, 544, 570, 571, 572
  24680. 73, 82, 86, 87, 89, 92, CHARACTER_OCTET_LENGTH,
  24681. 93, 95, 97, 100, 266, 539, 544, 570, 571, 572
  24682. 419, 629, 656 CHARACTER_SETS, 554, 604,
  24683. character strings, 6 606, 608, 611, 640
  24684. Character strings, 20 CHARACTER_SETS base table,
  24685. Character strings and 606
  24686. collating sequences, CHARACTER_SETS view, 554
  24687. 20 CHARACTER_SETS_CHECK_
  24688. <character string type>, REFERENCES_COLLATIONS,
  24689. 107, 108, 109, 113, 263, 606
  24690. 301, 452, 454, 640, 658 CHARACTER_SETS_DEFAULT_
  24691. <character substring COLLATE_CATALOG_NOT_
  24692. function>, 22, 27, 132, NULL, 606
  24693. 133, 135, 137, 444, 641 CHARACTER_SETS_DEFAULT_
  24694. <character translation>, COLLATE_NAME_NOT_NULL,
  24695. 22, 132, 134, 136, 137, 606
  24696. 444, 630, 659 CHARACTER_SETS_DEFAULT_
  24697. COLLATE_SCHEMA_NOT_NULL,
  24698. 606
  24699. CHARACTER_SETS_FOREIGN_KEY_
  24700. SCHEMATA, 606
  24701. Index 7
  24702. CHARACTER_SETS_PRIMARY_KEY, <check constraint
  24703. 606 definition>, 262, 264,
  24704. CHARACTER_SET_CATALOG, 83, 270, 271, 281, 282, 301,
  24705. 426, 427, 428, 434, 436, 309, 593, 594, 633
  24706. 439, 440, 441, 452, 454, Checking of constraints, 41
  24707. 456, 457, 538, 539, 544, CHECK_CLAUSE, 551, 593, 594
  24708. 554, 555, 556, 569, 604, CHECK_COLUMN_USAGE, 559,
  24709. 606, 607, 608, 609, 610, 561, 596
  24710. 611, 663 CHECK_COLUMN_USAGE base
  24711. CHARACTER_SET_NAME, 83, table, 596
  24712. 354, 426, 427, 428, 434, CHECK_COLUMN_USAGE_CHECK_
  24713. 436, 439, 440, 441, 452, REFERENCES_COLUMNS, 596
  24714. 454, 456, 457, 538, 539, CHECK_COLUMN_USAGE_FOREIGN_
  24715. 544, 554, 555, 556, 569, KEY_CHECK_CONSTRAINTS,
  24716. 604, 606, 607, 608, 609, 596
  24717. CHECK_COLUMN_USAGE_PRIMARY_
  24718. 610, 611, 663 KEY, 596
  24719. CHARACTER_SET_SCHEMA, 83, CHECK_CONSTRAINTS, 551,
  24720. 426, 427, 428, 434, 436, 574, 586, 593, 594, 595,
  24721. 439, 440, 441, 452, 454, 596, 598, 640
  24722. 456, 457, 538, 539, 544, CHECK_CONSTRAINTS base
  24723. 554, 555, 556, 569, 604, table, 593
  24724. 606, 607, 608, 609, 610, CHECK_CONSTRAINTS view, 551
  24725. 611, 663 CHECK_CONSTRAINTS_PRIMARY_
  24726. <char length expression>, KEY, 593
  24727. 128, 130 CHECK_CONSTRAINTS_SOURCE_
  24728. CHAR_LENGTH, 84, 128, 679 CHECK, 593
  24729. CHECK, 40, 75, 84, 264, CHECK_OPTION, 356, 543,
  24730. 281, 296, 297, 299, 325, 578, 579
  24731. 389, 393, 395, 487, 537, CHECK_OPTION_CHECK, 578
  24732. 565, 570, 571, 572, 573, CHECK_OPTION_NOT_NULL, 578
  24733. 574, 576, 578, 579, 580, CHECK_TABLE_IN_COLUMNS, 576
  24734. CHECK_TABLE_USAGE, 595
  24735. 583, 584, 585, 586, 587, CHECK_TABLE_USAGE base
  24736. 588, 590, 591, 593, 595, table, 595
  24737. 596, 598, 600, 602, 604, CHECK_TABLE_USAGE_CHECK_
  24738. 606, 608, 610, 611, 612, REFERENCES_TABLES, 595
  24739. 613, 616, 617, 618, 677
  24740. 8 Database Language SQL
  24741. CHECK_TABLE_USAGE_FOREIGN_ <COBOL character type>,
  24742. KEY_CHECK_CONSTRAINTS, 508, 509, 510, 511, 651,
  24743. 595 664
  24744. CHECK_TABLE_USAGE_PRIMARY_ <COBOL computational
  24745. KEY, 595 integer>, 508, 510,
  24746. <C host identifier>, 490, 675
  24747. 504, 505, 506, 507 <COBOL host identifier>,
  24748. <C initial value>, 504, 490, 508, 509
  24749. 505, 506 <COBOL integer type>, 508,
  24750. Claims of conformance, 625 651
  24751. Classes of SQL-statements, <COBOL nines>, 508
  24752. 51 <COBOL nines specification>
  24753. CLASS_ORIGIN, 83, 84, 479, , 508
  24754. 481, 485, 663 <COBOL numeric type>, 508,
  24755. Client-server operation, 74 510
  24756. CLOSE, 84, 381, 403, 405, <COBOL type specification>,
  24757. 471, 482, 483 508, 510, 511, 639, 664
  24758. <close statement>, 50, 53, <COBOL variable definition>
  24759. 55, 57, 58, 59, 368, , 490, 508, 509, 510,
  24760. 381, 482 664
  24761. cluster, 45, 566, 654 Codes associated with
  24762. Clusters of catalogs, 45 datetime data types
  24763. <C numeric variable>, 504, in Dynamic SQL, 429
  24764. 507 Codes used for <interval
  24765. COALESCE, 6, 84, 141, 142, qualifier>s in Dynamic
  24766. 182, 444, 446, 544, 679 SQL, 429
  24767. COBOL, 3, 49, 61, 83, 243, Codes used for SQL data
  24768. 358, 359, 363, 364, 489, types in Dynamic SQL,
  24769. 490, 491, 493, 495, 498, 428
  24770. 508, 509, 510, 511, 612, coercibility, 5, 21, 23,
  24771. 613, 614, 625, 639, 651, 24, 25, 35, 115, 122,
  24772. 661, 662, 664, 675 125, 133, 134, 145, 155,
  24773. <COBOL binary integer>, 161, 187, 208, 214, 237,
  24774. 508, 510, 651 264, 297, 372
  24775. <COBOL bit type>, 508, 509, Coercible, 23, 24, 25, 26,
  24776. 510, 511, 639 115, 145, 208, 264
  24777. COLLATE, 84, 251, 318, 444,
  24778. 679
  24779. Index 9
  24780. <collate clause>, 21, 23, <collation definition>, 53,
  24781. 24, 36, 37, 160, 161, 255, 257, 314, 315, 316,
  24782. 163, 187, 188, 251, 262, 317, 331, 335, 368, 482,
  24783. 263, 264, 265, 301, 302, 632, 634, 635, 637, 639,
  24784. 303, 311, 331, 337, 372, 661
  24785. 631, 632, 633 collation descriptor, 21,
  24786. Collating coercibility 44, 313, 315, 317, 318,
  24787. rules for dyadic 323, 608
  24788. operators, 24 <collation name>, 36, 37,
  24789. Collating coercibility 99, 103, 104, 251, 259,
  24790. rules for monadic 265, 302, 310, 314, 315,
  24791. operators, 24 316, 318, 329, 331, 333,
  24792. collating sequence, 6 335, 444, 452, 454, 629
  24793. <collating sequence COLLATIONS, 539, 545, 555,
  24794. definition>, 314, 315 572, 604, 606, 608, 640
  24795. Collating sequence usage COLLATIONS base table, 608
  24796. for comparisons, 25 <collation source>, 311,
  24797. collation, 6, 20, 21, 24, 312, 314, 315, 316
  24798. 35, 36, 37, 44, 53, 64, COLLATIONS view, 555
  24799. 65, 66, 87, 99, 103, COLLATIONS_CHARACTER_SET_
  24800. 104, 251, 255, 256, 257, CATALOG_NOT_NULL, 608
  24801. 258, 259, 263, 265, 301, COLLATIONS_CHARACTER_SET_
  24802. 302, 310, 311, 312, 314, NAME_NOT_NULL, 608
  24803. 315, 316, 317, 318, 319, COLLATIONS_CHARACTER_SET_
  24804. 323, 329, 330, 331, 333, SCHEMA_NOT_NULL, 608
  24805. 334, 335, 336, 337, 368, COLLATIONS_CHECK_
  24806. 436, 444, 452, 454, 482, REFERENCES_CHARACTER_
  24807. 483, 555, 572, 605, 607, SETS, 608
  24808. COLLATIONS_FOREIGN_KEY_
  24809. 608, 609, 629, 632, 634, SCHEMATA, 608
  24810. 635, 637, 639, 661, 665, COLLATIONS_PAD_ATTRIBUTE_
  24811. 674 CHECK, 608
  24812. COLLATION, 84, 259, 311, COLLATIONS_PRIMARY_KEY, 608
  24813. 314, 315, 316, 318, 329, COLLATION_CATALOG, 83, 427,
  24814. 331, 332, 482, 679 434, 436, 438, 452, 454,
  24815. 539, 544, 545, 555, 570,
  24816. 571, 572, 604, 606, 608,
  24817. 609
  24818. 10 Database Language SQL
  24819. COLLATION_NAME, 83, 428, column, 14, 15, 21, 23, 24,
  24820. 434, 436, 438, 452, 454, 35, 36, 37, 38, 39, 41,
  24821. 539, 544, 545, 555, 570, 42, 43, 50, 61, 62, 63,
  24822. 571, 572, 604, 606, 608, 64, 65, 66, 75, 98, 103,
  24823. 609 109, 118, 119, 120, 121,
  24824. COLLATION_SCHEMA, 83, 427, 122, 123, 124, 125, 126,
  24825. 434, 436, 438, 452, 454, 127, 155, 156, 174, 176,
  24826. 539, 544, 545, 555, 570, 177, 178, 179, 180, 181,
  24827. 571, 572, 604, 606, 608, 182, 183, 184, 185, 186,
  24828. 609 187, 189, 190, 191, 192,
  24829. collection, 5, 6, 14 193, 194, 195, 196, 197,
  24830. <colon>, 80, 91, 99, 242, 198, 199, 200, 201, 202,
  24831. 490, 500, 517 203, 208, 217, 219, 220,
  24832. 223, 224, 227, 228, 230,
  24833. 234, 236, 245, 246, 256,
  24834. 260, 261, 262, 263, 264,
  24835. 265, 266, 267, 268, 270,
  24836. 271, 272, 273, 274, 275,
  24837. 276, 277, 278, 279, 280,
  24838. 282, 283, 284, 285, 286,
  24839. 287, 288, 289, 290, 292,
  24840. 296, 297, 298, 299, 301,
  24841. 302, 304, 306, 309, 318,
  24842. 325, 326, 329, 330, 331,
  24843. 333, 334, 335, 336, 337,
  24844. 371, 372, 373, 374, 377,
  24845. 379, 380, 383, 386, 388,
  24846. 389, 390, 391, 392, 393,
  24847. 394, 395, 396, 397, 398,
  24848. 420, 436, 446, 447, 450,
  24849. 451, 452, 457, 464, 469,
  24850. 474, 475, 487, 530, 533,
  24851. 544, 547, 552, 558, 561,
  24852. 562, 569, 570, 572, 579,
  24853. 580, 581, 582, 584, 588,
  24854. 589, 591, 594, 596, 597,
  24855. 601, 602, 603, 613, 618,
  24856. 641, 643, 644, 645, 647,
  24857. 648, 665, 669, 670, 671,
  24858. 672, 673, 674, 677
  24859. Index 11
  24860. COLUMN, 84, 284, 286, 289, <column reference>, 21,
  24861. 679 121, 122, 123, 124, 125,
  24862. <column constraint>, 262, 126, 127, 155, 156, 177,
  24863. 264, 265, 645 181, 185, 187, 189, 190,
  24864. <column constraint 191, 192, 193, 217, 219,
  24865. definition>, 262, 263, 230, 264, 284, 302, 390,
  24866. 264 579, 594, 630, 641, 643,
  24867. <column definition>, 109, 644, 669, 670
  24868. 256, 260, 261, 262, 263, Columns, 36
  24869. 264, 265, 266, 273, 284, COLUMNS, 539, 544, 545,
  24870. 325, 397, 398, 644, 645 562, 572, 576, 580, 584,
  24871. column descriptor, 37, 39, 588, 596, 602, 640
  24872. 187, 192, 197, 198, 199, COLUMNS base table, 580
  24873. 200, 265, 267, 268, 286, COLUMNS view, 544
  24874. 287, 288, 297, 302, 306, COLUMNS_CHECK_DATA_TYPE,
  24875. 309, 318, 372, 393, 397, 580
  24876. 451, 580, 581 COLUMNS_CHECK_REFERENCES_
  24877. <column name>, 36, 98, 103, DOMAIN, 580
  24878. 118, 119, 121, 174, 181, COLUMNS_FOREIGN_KEY_TABLES,
  24879. 182, 191, 192, 197, 198, 580
  24880. 199, 200, 245, 246, 262, COLUMNS_PRIMARY_KEY, 580
  24881. 265, 272, 273, 276, 282, COLUMNS_UNIQUE, 580
  24882. COLUMN_DEFAULT, 544, 580,
  24883. 284, 286, 287, 288, 289, 581
  24884. 296, 297, 298, 309, 326, COLUMN_DOMAIN_USAGE, 562,
  24885. 331, 334, 335, 371, 372, 640
  24886. 373, 388, 389, 390, 391, COLUMN_DOMAIN_USAGE view,
  24887. 392, 394, 398, 474, 487, 562
  24888. 530, 645, 648, 670 COLUMN_NAME, 83, 480, 481,
  24889. <column name list>, 64, 65, 487, 539, 544, 545, 547,
  24890. 66, 118, 180, 196, 245, 552, 558, 561, 562, 570,
  24891. 272, 274, 296, 371, 372, 571, 572, 573, 580, 581,
  24892. 373, 374, 388, 392, 464, 584, 588, 589, 596, 597,
  24893. 474, 635, 638 602, 603, 617, 618
  24894. column privilege descriptor COLUMN_POSITION_NOT_NULL,
  24895. , 66 580
  24896. COLUMN_PRIVILEGES, 542,
  24897. 545, 547, 602, 640
  24898. 12 Database Language SQL
  24899. COLUMN_PRIVILEGES base COMMITTED, 68, 69, 83, 399
  24900. table, 602 common column name, 121,
  24901. COLUMN_PRIVILEGES view, 547 122, 181
  24902. COLUMN_PRIVILEGES_FOREIGN_ comparable, 6, 21, 27, 31,
  24903. KEY_COLUMNS, 602 33, 34, 35, 134, 142,
  24904. COLUMN_PRIVILEGES_GRANTEE_ 169, 181, 207, 209, 211,
  24905. FOREIGN_KEY_USERS, 602 214, 220, 224, 227, 231,
  24906. COLUMN_PRIVILEGES_GRANTOR_ 234, 237
  24907. FOREIGN_KEY_USERS, 602 <comparison predicate>,
  24908. COLUMN_PRIVILEGES_IS_ 156, 203, 205, 207, 209,
  24909. GRANTABLE_CHECK, 602 220, 221, 373, 444, 446,
  24910. COLUMN_PRIVILEGES_IS_ 531, 642, 643
  24911. GRANTABLE_NOT_NULL, compilation unit, 1, 2, 46,
  24912. 602 47, 61, 67, 490, 501,
  24913. COLUMN_PRIVILEGES_PRIMARY_ 505, 509, 512, 515, 517,
  24914. KEY, 602 521, 654
  24915. COLUMN_PRIVILEGES_TYPE_ COMPLETION, 85
  24916. CHECK, 602 completion condition, 10
  24917. <comma>, 80, 107, 108, 118, <comp op>, 207, 208, 209,
  24918. 141, 173, 176, 178, 187, 210, 220, 221, 373, 531
  24919. 191, 212, 239, 245, 260, <concatenation>, 160, 161,
  24920. 329, 333, 346, 371, 377, 162, 163, 164, 642
  24921. 382, 391, 399, 401, 434, <concatenation operator>,
  24922. 438, 451, 474, 479, 500, 22, 83, 160, 445
  24923. 504, 505, 512, 515, 517, Concepts, 19
  24924. 520 <condition>, 497, 499
  24925. COMMAND_FUNCTION, 83, 479, <condition action>, 497,
  24926. 481, 482, 488 499
  24927. <comment>, 83, 86, 444, 462 Conditional rules, 13
  24928. <comment character>, 83 <condition information>,
  24929. <comment introducer>, 83, 479, 485
  24930. 86 <condition information
  24931. COMMIT, 68, 70, 84, 260, item>, 479, 480, 485
  24932. 275, 281, 397, 403, 482 <condition information item
  24933. <commit statement>, 41, 50, name>, 479, 480, 481
  24934. 52, 54, 67, 69, 71, 253, <condition number>, 479,
  24935. 342, 369, 403, 413, 482, 480, 485, 673
  24936. 526, 671
  24937. Index 13
  24938. CONDITION_NUMBER, 83, 354, CONSTRAINT, 84, 292, 308,
  24939. 479, 481, 485 338, 484, 536, 565, 568,
  24940. conformance, 9, 12, 16, 17, 569, 570, 571, 572, 573,
  24941. 75, 76, 563, 612, 614, 574, 576, 578, 580, 583,
  24942. 625, 626, 627 584, 585, 586, 588, 590,
  24943. Conformance, 625 591, 593, 595, 596, 598,
  24944. CONNECT, 84, 349, 407, 483, 600, 602, 604, 605, 606,
  24945. 527, 679 608, 610, 611, 612, 679
  24946. CONNECTION, 84, 349, 410, <constraint attributes>,
  24947. 484, 527, 679 252, 253, 262, 263, 270,
  24948. connection does not exist, 301, 309, 325, 633
  24949. 349, 410, 412, 527, 620 <constraint check time>,
  24950. connection exception, 71, 252, 253
  24951. 349, 408, 409, 410, 412, constraint mode, 40, 41,
  24952. 527, 620 67, 74, 253, 270, 326,
  24953. connection failure, 71, 350, 401, 402, 528
  24954. 410, 620 <constraint name>, 99, 103,
  24955. Connection management, 407 105, 252, 259, 270, 292,
  24956. <connection name>, 71, 99,
  24957. 103, 104, 407, 408, 410, 302, 308, 309, 325, 326,
  24958. 412, 488 328, 338, 401, 402, 586,
  24959. connection name in use, 616, 640, 670
  24960. 408, 620 <constraint name
  24961. <connection object>, 410, definition>, 252, 253,
  24962. 411, 412 262, 263, 265, 270, 271,
  24963. <connection target>, 407 301, 302, 309, 645, 665,
  24964. CONNECTION_NAME, 83, 352, 670
  24965. 354, 480, 481, 488 <constraint name
  24966. <connect statement>, 54, definition> and
  24967. 65, 70, 71, 72, 74, 349, <constraint attributes>,
  24968. 369, 407, 408, 409, 483, 252
  24969. 488, 527, 636, 655, 662, <constraint name list>,
  24970. 669, 672 401, 402
  24971. consistent, 673 CONSTRAINTS, 84, 401, 403,
  24972. constraint, 45 679
  24973. 14 Database Language SQL
  24974. CONSTRAINT_CATALOG, 83, Conventions, 9
  24975. 480, 481, 486, 487, 541, CONVERT, 84, 132, 679
  24976. 549, 550, 551, 552, 553, Coordinated Universal Time,
  24977. 559, 561, 574, 575, 585, 5
  24978. 586, 588, 589, 590, 591, <correlation name>, 99,
  24979. 593, 595, 596, 598, 616, 102, 103, 118, 119, 121,
  24980. 617, 618, 665 122
  24981. CONSTRAINT_COLUMN_USAGE, CORRESPONDING, 84, 196,
  24982. 561, 640 198, 199, 202, 289, 643,
  24983. CONSTRAINT_COLUMN_USAGE 679
  24984. view, 561 <corresponding column list>
  24985. CONSTRAINT_NAME, 83, 480, , 196, 198
  24986. 481, 486, 487, 541, 549, corresponding join columns,
  24987. 550, 551, 552, 553, 559, 181, 182, 183
  24988. 561, 574, 575, 585, 586, <corresponding spec>, 196
  24989. 588, 589, 590, 591, 593, COUNT, 62, 84, 124, 125,
  24990. 595, 596, 598, 616, 617, 126, 192, 434, 435, 436,
  24991. 618, 665 438, 439, 452, 453, 455,
  24992. CONSTRAINT_SCHEMA, 83, 480, 457, 485, 537, 586, 616,
  24993. 481, 486, 487, 541, 549, 617, 641, 659
  24994. 550, 551, 552, 553, 559, CREATE, 84, 255, 260, 296,
  24995. 561, 574, 575, 585, 586, 301, 311, 314, 320, 325,
  24996. 588, 589, 590, 591, 593, 482, 483, 484, 535, 536,
  24997. 595, 596, 598, 616, 617, 537, 538, 539, 541, 542,
  24998. 618, 665 543, 544, 546, 547, 548,
  24999. CONSTRAINT_TABLE_USAGE, 549, 550, 551, 552, 553,
  25000. 559, 640 554, 555, 556, 557, 558,
  25001. CONSTRAINT_TABLE_USAGE 559, 561, 562, 563, 564,
  25002. view, 559 565, 567, 568, 569, 570,
  25003. CONSTRAINT_TYPE, 549, 585, 573, 574, 576, 578, 580,
  25004. 586, 587, 588, 590, 591, 583, 584, 585, 588, 590,
  25005. 618 593, 595, 596, 598, 600,
  25006. CONSTRAINT_TYPE_CHECK, 585, 602, 604, 606, 608, 610,
  25007. 588, 590 612, 616, 617, 618
  25008. CONSTRAINT_TYPE_NOT_NULL,
  25009. 585
  25010. CONTINUE, 84, 497, 499
  25011. Index 15
  25012. created local temporary CURRENT_USER, 70, 84, 114,
  25013. table, 37, 38, 39, 72, 115, 116, 117, 266, 267,
  25014. 258, 260, 261, 275, 281, 268, 269, 282, 325, 375,
  25015. 655, 668 530, 538, 539, 541, 542,
  25016. CROSS, 84, 180, 182, 679 543, 545, 546, 547, 548,
  25017. <cross join>, 180, 183, 549, 550, 551, 552, 553,
  25018. 184, 631 554, 555, 556, 557, 558,
  25019. <C storage class>, 504 559, 561, 562, 641, 645,
  25020. CURRENT, 84, 384, 391, 412, 658, 679
  25021. 472, 474, 476, 477 cursor, 49
  25022. <current date value CURSOR, 84, 371, 464, 465,
  25023. function>, 139 482, 483, 484
  25024. current SQL-connection, 71, <cursor name>, 62, 99, 103,
  25025. 72, 408, 409, 410, 411, 341, 342, 371, 375, 377,
  25026. 412, 413 381, 384, 391, 392, 443,
  25027. current SQL-session, 44, 462, 464, 467, 469, 471,
  25028. 45, 72, 73, 93, 100, 472, 474, 475, 476, 477,
  25029. 101, 103, 104, 115, 309, 492, 635, 636
  25030. 401, 408, 409, 410, 411, cursor operation conflict,
  25031. 415, 417, 419, 420, 421, 279, 385, 387, 392, 395,
  25032. 422, 487, 526, 653, 654, 486, 622
  25033. 656 Cursors, 49
  25034. <current timestamp value <cursor specification>, 62,
  25035. function>, 139 119, 371, 372, 373, 374,
  25036. <current time value 375, 377, 381, 384, 391,
  25037. function>, 139 442, 448, 449, 464, 465,
  25038. CURRENT_DATE, 70, 84, 139, 467, 469, 472, 474, 476,
  25039. 153, 645, 669, 679 477, 635, 636, 638, 647
  25040. CURRENT_TIME, 84, 139, 645, cursor specification cannot
  25041. 669, 679 be executed, 459, 621
  25042. CURRENT_TIMESTAMP, 84, 139, CURSOR_NAME, 83, 352, 354,
  25043. 645, 669, 679 480, 481, 486, 487
  25044. <C VARCHAR variable>, 504,
  25045. 505, 506, 507, 651, 664
  25046. <C variable definition>,
  25047. 490, 504, 505, 506, 507
  25048. 16 Database Language SQL
  25049. <C variable specification>, DATA_TYPE, 354, 539, 544,
  25050. 504 545, 570, 571, 572, 573,
  25051. CYCLE, 85 580, 581
  25052. - D - DATA_TYPE_CHECK_REFERENCES_
  25053. DATA, 83, 85, 427, 434, COLLATION, 571
  25054. 435, 436, 439, 452, 453, DATA_TYPE_DESCRIPTOR, 539,
  25055. 455, 456, 458, 673 545, 570, 571, 572, 573,
  25056. Data assignment rules, 231 581
  25057. database, 1, 2, 7, 14, 45, DATA_TYPE_DESCRIPTOR base
  25058. 61, 63, 70, 625 table, 570
  25059. data exception, 111, 112, DATA_TYPE_DESCRIPTOR_CHECK_
  25060. 126, 135, 136, 137, 146, USED, 572
  25061. 147, 148, 149, 150, 151, DATA_TYPE_DESCRIPTOR_
  25062. 152, 153, 154, 158, 163, PRIMARY_KEY, 571
  25063. 167, 215, 231, 233, 234, date, 5
  25064. 235, 348, 363, 422, 435, DATE, 19, 31, 84, 90, 94,
  25065. 439, 620 108, 110, 111, 139, 152,
  25066. Data manipulation, 371 166, 429, 440, 571, 679
  25067. Data parameters, 48 <date literal>, 90, 94
  25068. data type, 19 <date string>, 82, 90
  25069. <data type>, 47, 63, 93, datetime data type
  25070. 103, 107, 113, 115, 144, descriptor, 29
  25071. 192, 262, 263, 264, 265, <datetime factor>, 165
  25072. <datetime field>, 31, 33,
  25073. 301, 346, 350, 351, 352, 94, 96, 111, 112, 128,
  25074. 356, 357, 358, 359, 360, 129, 130, 145, 152, 153,
  25075. 361, 362, 415, 419, 420, 154, 165, 166, 167, 168,
  25076. 422, 446, 492, 494, 630, 169, 170, 209, 227, 238,
  25077. 635, 640, 647, 658 239, 240, 241, 267, 659
  25078. data type descriptor, 19, datetime field overflow,
  25079. 20, 26, 27, 29, 30, 36, 167, 620
  25080. 37, 192, 265, 290, 302, <datetime literal>, 89, 90,
  25081. 309, 310, 570, 572 95, 96, 97, 267, 640
  25082. Data types, 19 <datetime primary>, 165,
  25083. Data types of <key word>s 166, 167
  25084. used in SQL item Datetimes, 30
  25085. descriptor areas, 427 Datetimes and intervals, 29
  25086. <datetime term>, 165, 166,
  25087. 167, 168, 169, 171, 445
  25088. Index 17
  25089. <datetime type>, 107, 108, <deallocate prepared
  25090. 111, 113, 426, 453, 454, statement>, 50, 54,
  25091. 630, 640 60, 61, 63, 369, 449,
  25092. <datetime value>, 91, 92, 483, 635, 637
  25093. 95 DEC, 84, 108, 366, 515,
  25094. <datetime value expression> 516, 520
  25095. , 128, 129, 130, 155, DECIMAL, 19, 27, 34, 84,
  25096. 156, 165, 166, 167, 168, 107, 108, 109, 110, 360,
  25097. 169, 170, 642 361, 425, 426, 429, 440,
  25098. <datetime value function>, 516, 520, 522, 571, 657,
  25099. 139, 140, 165, 266, 267, 658
  25100. 268, 269, 282, 325, 375, DECLARE, 84, 371, 397, 464,
  25101. 641 490, 520, 521
  25102. DATETIME_INTERVAL_CODE, 83, <declare cursor>, 46, 49,
  25103. 426, 427, 434, 436, 439, 50, 53, 56, 57, 58, 60,
  25104. 440, 441, 453, 454, 455, 341, 342, 371, 374, 375,
  25105. 456, 457, 663 377, 381, 384, 391, 464,
  25106. DATETIME_INTERVAL_PRECISION 476, 477, 489, 492, 493,
  25107. , 83, 427, 434, 436, 495, 496, 647, 662, 665,
  25108. 439, 440, 441, 453, 455, 668, 671, 673, 674, 675,
  25109. 456, 457, 663 677
  25110. DATETIME_PRECISION, 539, declared local temporary
  25111. 544, 570, 571, 572 table, 37, 39, 72, 101,
  25112. <date value>, 90, 91, 96 103, 245, 275, 281, 283,
  25113. DAY, 30, 31, 32, 33, 84, 294, 397, 398, 459, 486,
  25114. 95, 112, 167, 238, 239, 487, 655
  25115. 240, 430, 441, 445, 679 DEFAULT, 84, 173, 175, 255,
  25116. <days value>, 91, 94 266, 274, 278, 279, 288,
  25117. <day-time interval>, 91 306, 311, 312, 314, 316,
  25118. <day-time literal>, 91, 95
  25119. DEALLOCATE, 84, 342, 433, 349, 388, 391, 393, 407,
  25120. 447, 449, 483, 526, 679 408, 410, 412, 527, 590,
  25121. <deallocate descriptor 591, 592, 642, 648, 663
  25122. statement>, 54, 60, 62, <default clause>, 35, 262,
  25123. 342, 369, 433, 483, 526 266, 267, 268, 287, 301,
  25124. 302, 305, 309
  25125. default collating sequence,
  25126. 5
  25127. 18 Database Language SQL
  25128. <default option>, 36, 37, Definitions, 5
  25129. 266, 268, 269, 573, 581, Definitions, notations, and
  25130. 645 conventions, 5
  25131. <default specification>, definition schema, 45
  25132. 173, 174 Definition Schema, 75, 77,
  25133. default SQL-connection, 71, 86, 100, 533, 566
  25134. 72, 408, 412 Definitions provided in
  25135. default SQL-session, 72, this International
  25136. 349, 408, 527 Standard, 5
  25137. default time zone, 73, 94, Definitions taken from
  25138. 96, 112, 122, 656 ISO/IEC 10646, 5
  25139. DEFAULT_CHARACTER_SET_ Definitions taken from ISO
  25140. CATALOG, 538, 569 8601, 5
  25141. DEFAULT_CHARACTER_SET_NAME, DEFINITION_SCHEMA, 75, 101,
  25142. 538, 569 538, 539, 541, 542, 543,
  25143. DEFAULT_CHARACTER_SET_ 544, 545, 546, 547, 548,
  25144. SCHEMA, 538, 569 549, 550, 551, 552, 553,
  25145. DEFAULT_COLLATE_CATALOG, 554, 555, 556, 557, 558,
  25146. 554, 606, 607, 674 559, 561, 562, 563, 566,
  25147. DEFAULT_COLLATE_NAME, 554, 567
  25148. 606, 607, 674 DEFINITION_SCHEMA Schema,
  25149. DEFAULT_COLLATE_SCHEMA, 567
  25150. 554, 606, 607, 674 degree, 37, 39, 68, 119,
  25151. deferrable, 36, 40, 41, 174, 176, 179, 183, 191,
  25152. 253, 270, 275, 326, 575, 199, 203, 207, 211, 218,
  25153. 587, 598 220, 224, 227, 261, 265,
  25154. DEFERRABLE, 84, 252, 253, 284, 290, 297, 372, 377,
  25155. 270, 301, 325, 401, 402, 378, 388, 452, 457, 469,
  25156. 541, 549, 553, 574, 575, 530, 617, 618
  25157. 585, 587, 598, 633, 679 DELETE, 64, 66, 84, 245,
  25158. deferred, 40, 41, 67, 76, 260, 261, 274, 275, 281,
  25159. 253, 270, 326, 402, 575, 298, 330, 384, 386, 397,
  25160. 587, 599, 655 398, 403, 472, 476, 483,
  25161. DEFERRED, 84, 252, 253,
  25162. 401, 541, 549, 553, 574, 484, 550, 590, 592, 600,
  25163. 575, 585, 587, 598, 599, 601
  25164. 679 <delete rule>, 274, 276,
  25165. Definition, 10 277, 278, 279, 592
  25166. Index 19
  25167. <delete statement: dependent, 10, 13, 14, 15,
  25168. positioned>, 50, 53, 19, 37, 39, 40, 48, 49,
  25169. 55, 57, 59, 279, 369, 50, 51, 64, 65, 66, 69,
  25170. 384, 385, 387, 392, 395, 72, 74, 122, 140, 171,
  25171. 472, 476, 483 174, 192, 197, 199, 200,
  25172. <delete statement: 208, 237, 270, 279, 289,
  25173. searched>, 53, 55, 56, 292, 296, 300, 302, 304,
  25174. 58, 59, 119, 122, 369, 309, 335, 338, 342, 346,
  25175. 384, 386, 387, 392, 403, 350, 351, 373, 379, 380,
  25176. 442, 483, 484, 485, 525, 382, 383, 397, 400, 412,
  25177. 673 435, 436, 440, 441, 448,
  25178. DELETE_RULE, 550, 590, 592 452, 454, 485, 493, 494,
  25179. <delimited identifier>, 76, 495, 526, 530, 531, 557,
  25180. 82, 86, 87, 98, 533 558, 562, 607, 667, 668,
  25181. <delimited identifier body> 669, 670, 671, 672, 673,
  25182. , 82, 86, 87, 88, 100, 674, 677, 678
  25183. 533, 629 dependent privilege
  25184. <delimited identifier part> descriptors still exist,
  25185. , 82, 86 338, 621
  25186. <delimiter token>, 82, 86, deprecated, 47, 75, 346,
  25187. 629, 640 347, 356, 357, 358, 359,
  25188. depend, 12, 35, 41, 44, 59,
  25189. 335, 336, 452 360, 361, 496, 502, 507,
  25190. dependency graph, 335 510, 514, 516, 519, 522,
  25191. dependend on, 292 624
  25192. Deprecated features, 675
  25193. DEPTH, 85
  25194. <derived column>, 122, 182,
  25195. 191, 192, 195, 379, 452
  25196. <derived column list>, 118,
  25197. 119, 120, 641
  25198. derived table, 37
  25199. <derived table>, 118, 119,
  25200. 120, 178, 193, 200, 630,
  25201. 631
  25202. derived table descriptor,
  25203. 40
  25204. 20 Database Language SQL
  25205. DESC, 84, 314, 316, 371, Diagnostics area, 48
  25206. 373 diagnostics area limit, 67,
  25207. DESCRIBE, 84, 450, 483, 679 74, 400
  25208. <describe input statement>, Diagnostics management, 479
  25209. 54, 60, 61, 450, 453, <diagnostics size>, 399
  25210. 456, 635, 638, 673 DICTIONARY, 85
  25211. <describe output statement> <digit>, 79, 82, 90, 94,
  25212. , 54, 60, 61, 450, 451, 96, 98, 148, 150, 619,
  25213. 457, 673 629, 666
  25214. <describe statement>, 369, <direct implementation-
  25215. 441, 450, 483, 663 defined statement>, 525,
  25216. Description, 10 526, 527, 665
  25217. Description of SQL item Direct invocation of SQL,
  25218. descriptor areas, 425 64, 525
  25219. descriptor, 6, 14 directly, 37, 45, 49, 51,
  25220. DESCRIPTOR, 84, 342, 353, 58, 61, 64, 70, 73, 74,
  25221. 354, 355, 431, 433, 434, 93, 100, 101, 121, 125,
  25222. 438, 451, 482, 483, 484, 156, 167, 181, 185, 186,
  25223. 526, 539, 545, 570, 571, 189, 190, 192, 193, 194,
  25224. 572, 573, 581, 679 230, 264, 301, 335, 336,
  25225. <descriptor item name>, 338, 391, 392, 394, 415,
  25226. 434, 435, 438, 439 417, 419, 474, 485, 525,
  25227. <descriptor name>, 62, 99, 643, 656, 673
  25228. 102, 104, 105, 342, 431, directly contain, 11, 121,
  25229. 432, 433, 434, 435, 436, 125, 156, 167, 181, 185,
  25230. 437, 438, 439, 441, 451, 186, 189, 190, 192, 193,
  25231. 453, 455, 457, 458, 526, 230, 264, 301, 392, 394,
  25232. 637, 638 474, 485, 643
  25233. Descriptors, 14 directly dependent on, 335
  25234. deterministic, 40, 189, Directly executable SQL-
  25235. 193, 200, 282, 325 statements, 58
  25236. DIAGNOSTICS, 84, 399, 479, <directly executable
  25237. 484, 679 statement>, 525
  25238. diagnostics area, 41, 48, <direct select statement:
  25239. 49, 67, 74, 348, 350, multiple rows>, 53, 56,
  25240. 351, 400, 479, 482, 485, 57, 58, 59, 119, 483,
  25241. 526, 528, 529, 619, 663, 525, 526, 530
  25242. 668, 669
  25243. Index 21
  25244. <direct SQL data statement> domain, 15, 35, 36, 37, 40,
  25245. , 525, 528, 639, 652 43, 44, 45, 47, 52, 64,
  25246. <direct SQL statement>, 64, 65, 66, 75, 76, 98, 103,
  25247. 67, 71, 73, 74, 93, 100, 105, 109, 115, 144, 145,
  25248. 101, 349, 415, 417, 419, 154, 192, 236, 255, 256,
  25249. 525, 526, 527, 528, 529, 257, 258, 262, 263, 264,
  25250. 614, 625, 627, 640, 651, 265, 266, 267, 268, 281,
  25251. 655, 656 282, 290, 301, 302, 303,
  25252. dirty read, 68 304, 305, 306, 307, 308,
  25253. DISCONNECT, 84, 355, 412, 309, 310, 318, 329, 330,
  25254. 483, 679 331, 333, 334, 336, 337,
  25255. disconnect error, 413, 623 338, 368, 446, 482, 483,
  25256. <disconnect object>, 412
  25257. <disconnect statement>, 54, 533, 539, 540, 541, 562,
  25258. 71, 369, 412, 413, 483, 564, 565, 569, 570, 572,
  25259. 636, 672 573, 574, 575, 581, 593,
  25260. distinct, 5, 6, 7, 19, 20, 595, 596, 605, 633, 634,
  25261. 22, 29, 38, 39, 183, 640, 644, 646
  25262. 187, 273, 277, 278, 279, DOMAIN, 84, 258, 301, 304,
  25263. 298, 373, 493, 494, 495, 309, 329, 338, 482, 564,
  25264. 496, 531, 668, 670, 673, 565, 680
  25265. 677 domain constraint, 40, 43
  25266. DISTINCT, 84, 124, 126, <domain constraint>, 35,
  25267. 193, 194, 195, 208, 539, 115, 154, 301, 302, 307,
  25268. 541, 544, 617, 630, 631, 564
  25269. 670 domain constraint
  25270. division by zero, 158, 620 descriptor, 36, 40,
  25271. 43, 302, 309, 337, 338
  25272. Domain constraints, 43
  25273. domain definition, 35
  25274. <domain definition>, 52,
  25275. 109, 115, 255, 256, 257,
  25276. 266, 281, 301, 302, 303,
  25277. 310, 368, 483, 644, 646
  25278. 22 Database Language SQL
  25279. domain descriptor, 36, 44, DOMAIN_CONSTRAINTS_FOREIGN_
  25280. 75, 236, 267, 268, 301, KEY_CHECK_CONSTRAINTS,
  25281. 302, 304, 305, 306, 307, 574
  25282. 308, 318, 330, 331, 337, DOMAIN_CONSTRAINTS_FOREIGN_
  25283. 338, 573 KEY_DOMAINS, 574
  25284. <domain name>, 35, 98, 103, DOMAIN_CONSTRAINTS_FOREIGN_
  25285. 105, 144, 145, 154, 192, KEY_SCHEMATA, 574
  25286. 258, 262, 263, 264, 265, DOMAIN_CONSTRAINTS_
  25287. 301, 302, 304, 305, 306, INITIALLY_DEFERRED_
  25288. 307, 308, 309, 329, 331, NOT_NULL, 574
  25289. 333, 338, 446, 581, 640, DOMAIN_CONSTRAINTS_PRIMARY_
  25290. 644 KEY, 574
  25291. Domains, 35 DOMAIN_DEFAULT, 539, 573
  25292. DOMAINS, 539, 562, 572, DOMAIN_NAME, 539, 541, 544,
  25293. 573, 574, 580, 604, 616, 545, 562, 570, 571, 572,
  25294. 640 573, 574, 575, 580, 581,
  25295. DOMAINS base table, 573 604
  25296. DOMAINS view, 539 DOMAIN_NAME_NOT_NULL, 574
  25297. DOMAINS_CHECK_DATA_TYPE, DOMAIN_SCHEMA, 539, 541,
  25298. 573 544, 545, 562, 570, 571,
  25299. DOMAINS_FOREIGN_KEY_ 572, 573, 574, 575, 580,
  25300. SCHEMATA, 573 581, 604
  25301. DOMAINS_PRIMARY_KEY, 573 DOMAIN_SCHEMA_NOT_NULL, 574
  25302. DOMAIN_CATALOG, 539, 541, dormant SQL-connection, 71,
  25303. 544, 545, 562, 570, 571, 72, 408
  25304. 572, 573, 574, 575, 580, dormant SQL-session, 72,
  25305. 581, 604 408, 411
  25306. DOMAIN_CATALOG_NOT_NULL, DOUBLE, 19, 27, 34, 84,
  25307. 574 108, 110, 352, 357, 358,
  25308. DOMAIN_CONSTRAINTS, 541, 359, 425, 426, 429, 440,
  25309. 574, 593, 616 500, 502, 507, 512, 513,
  25310. DOMAIN_CONSTRAINTS base 571, 658
  25311. table, 574 <double period>, 83, 500,
  25312. DOMAIN_CONSTRAINTS view, 517
  25313. 541 <double quote>, 79, 80, 82,
  25314. DOMAIN_CONSTRAINTS_CHECK_ 86, 87
  25315. DEFERRABLE, 574 <doublequote symbol>, 82,
  25316. 86, 87
  25317. Index 23
  25318. DROP, 84, 258, 259, 288, <drop translation
  25319. 289, 290, 292, 294, 300, statement>, 53, 259,
  25320. 306, 308, 309, 313, 318, 323, 324, 368, 483, 634,
  25321. 323, 328, 338, 398, 483, 635, 637, 639
  25322. 680 <drop view statement>, 52,
  25323. <drop assertion statement>, 258, 290, 300, 338, 368,
  25324. 52, 259, 328, 338, 368, 483, 646
  25325. 483, 634, 635, 637, 639 duplicate, 6, 7, 126, 181,
  25326. <drop behavior>, 258, 289, 194, 195, 201, 202, 223,
  25327. 292, 294, 300, 309, 333 332, 619
  25328. <drop character set dyadic, 24, 157, 158, 161,
  25329. statement>, 52, 259, 443
  25330. 313, 368, 483, 646 dyadic operator, 6, 24, 443
  25331. <drop collation statement>, DYNAMIC, 483
  25332. 53, 259, 318, 319, 368, <dynamic close statement>,
  25333. 483, 634, 635, 637, 639 50, 53, 55, 57, 58, 59,
  25334. <drop column default 62, 369, 471, 483
  25335. clause>, 286, 288, 645 <dynamic cursor name>, 99,
  25336. <drop column definition>, 104, 105, 467, 469, 471,
  25337. 283, 289, 290, 645 472, 474, 475, 638, 640
  25338. <drop domain constraint <dynamic declare cursor>,
  25339. definition>, 304, 308, 49, 53, 56, 57, 58, 60,
  25340. 634 62, 341, 343, 448, 464,
  25341. <drop domain default 467, 469, 471, 472, 474,
  25342. clause>, 304, 306, 634 476, 477, 489, 492, 494,
  25343. <drop domain statement>, 495, 638, 647, 651
  25344. 52, 258, 309, 310, 338, <dynamic delete statement:
  25345. 368, 483, 646 positioned>, 50, 53,
  25346. <drop schema statement>, 55, 57, 59, 60, 62, 369,
  25347. 52, 258, 259, 368, 483, 472, 483
  25348. 644 <dynamic fetch statement>,
  25349. <drop table constraint 50, 53, 55, 57, 58, 59,
  25350. definition>, 283, 292, 62, 369, 441, 451, 456,
  25351. 293, 646 457, 469, 470, 483, 638,
  25352. <drop table statement>, 52, 663
  25353. 258, 294, 295, 368, 398,
  25354. 483, 644
  25355. 24 Database Language SQL
  25356. <dynamic open statement>, effective, 12, 13, 19, 23,
  25357. 50, 53, 55, 57, 58, 59, 26, 31, 33, 34, 35, 38,
  25358. 62, 369, 441, 455, 464, 39, 41, 49, 51, 72, 73,
  25359. 465, 467, 468, 483, 663 74, 87, 94, 96, 112,
  25360. <dynamic parameter 119, 123, 139, 166, 171,
  25361. specification>, 63, 183, 184, 185, 190, 198,
  25362. 114, 115, 116, 168, 281, 208, 209, 236, 248, 253,
  25363. 296, 325, 436, 439, 443, 256, 258, 259, 273, 276,
  25364. 450, 453, 454, 455, 456, 280, 282, 289, 290, 292,
  25365. 460, 462, 467, 525, 641, 294, 299, 300, 302, 310,
  25366. 672 313, 315, 317, 318, 321,
  25367. <dynamic select statement>, 323, 326, 330, 331, 332,
  25368. 53, 56, 57, 58, 59, 60, 338, 342, 349, 373, 375,
  25369. 61, 62, 350, 442, 452, 376, 385, 386, 387, 389,
  25370. 455, 456, 459, 462 393, 395, 397, 398, 403,
  25371. <dynamic single row select 417, 439, 455, 456, 457,
  25372. statement>, 53, 56, 57, 458, 485, 493, 526, 527,
  25373. 58, 59, 61, 62, 350, 531, 570, 573, 574, 576,
  25374. 442, 452, 456, 459, 460, 578, 580, 585, 598, 600,
  25375. 462, 483, 637 602, 604, 656, 668, 669
  25376. Dynamic SQL, 425 effectively, 12
  25377. dynamic SQL error, 431, ELSE, 84, 141, 142, 543,
  25378. 435, 439, 448, 455, 456, 544, 680
  25379. 457, 458, 459, 460, 465, <else clause>, 141, 142,
  25380. 467, 621 143
  25381. <dynamic update statement: ELSEIF, 85
  25382. positioned>, 50, 53, Embeddable SQL-statements,
  25383. 55, 57, 59, 60, 62, 299, 55
  25384. 369, 474, 475, 483
  25385. DYNAMIC_FUNCTION, 83, 479,
  25386. 481, 482, 488
  25387. - E -
  25388. EACH, 85
  25389. Index 25
  25390. embedded, 1, 2, 49, 51, <embedded SQL declare
  25391. 52, 55, 56, 57, 58, 60, section>, 61, 489, 490,
  25392. 61, 62, 63, 75, 79, 114, 491, 495, 496, 501, 505,
  25393. 115, 116, 489, 490, 491, 509, 512, 515, 517, 521
  25394. 492, 493, 494, 495, 496, <embedded SQL end declare>,
  25395. 497, 498, 499, 500, 501, 61, 489, 490, 491, 495,
  25396. 502, 504, 505, 506, 507, 517
  25397. 508, 509, 510, 512, 513, <embedded SQL Fortran
  25398. 514, 515, 516, 517, 518, program>, 61, 489, 491,
  25399. 519, 520, 521, 522, 613, 493, 495, 496, 498, 512,
  25400. 614, 625, 627, 639, 651, 513, 514
  25401. 655, 661, 662, 663, 673, <embedded SQL host program>
  25402. 674, 675, 678 , 61, 63, 489, 490, 491,
  25403. <embedded character set 492, 493, 496, 497, 499,
  25404. declaration>, 489, 490, 614, 625, 627, 673, 674,
  25405. 492, 493, 495, 496, 651, 678
  25406. 663 <embedded SQL MUMPS
  25407. <embedded exception declare>, 489, 490,
  25408. declaration>, 55, 489, 491, 495
  25409. 495, 497, 498, 499 <embedded SQL MUMPS
  25410. Embedded SQL, 489 program>, 61, 489, 491,
  25411. <embedded SQL Ada program>, 493, 498, 515, 516
  25412. 61, 489, 491, 493, 495, <embedded SQL Pascal
  25413. 498, 500, 501, 502 program>, 61, 489, 491,
  25414. <embedded SQL begin 493, 495, 498, 517, 518,
  25415. declare>, 61, 489, 490, 519
  25416. 491, 495, 517 <embedded SQL PL/I program>
  25417. <embedded SQL COBOL , 61, 489, 491, 493,
  25418. program>, 61, 489, 491, 495, 498, 520, 521, 522
  25419. 493, 495, 498, 508, 509, <embedded SQL statement>,
  25420. 510, 675 61, 115, 489, 490, 491,
  25421. <embedded SQL C program>, 492, 493, 495, 501, 505,
  25422. 61, 489, 491, 493, 495, 509, 512, 515, 517, 521,
  25423. 498, 504, 505, 506, 507 639, 651
  25424. Embedded syntax, 61
  25425. 26 Database Language SQL
  25426. <embedded variable name>, <escape character>, 214,
  25427. 114, 115, 116, 490, 493, 215, 217, 447, 643
  25428. 494, 673 <exact numeric literal>,
  25429. END, 84, 141, 142, 490, 90, 94, 95, 147, 149,
  25430. 543, 544 267
  25431. END-EXEC, 84, 489, 491, 680 <exact numeric type>, 28,
  25432. <end field>, 171, 238, 239, 107, 109, 356, 453, 454,
  25433. 240, 241, 242 502, 658, 661
  25434. end-of-line indicator, 83, exact numeric value, 28
  25435. 656 EXCEPT, 84, 196, 197, 201,
  25436. Entry SQL, 625, 629, 640 202, 576, 643, 680
  25437. Entry SQL Specifications, exception, 10, 12, 13, 34,
  25438. 640 35, 36, 41, 47, 48, 52,
  25439. environment, 2, 14, 16, 45, 55, 56, 57, 58, 60, 64,
  25440. 46, 70, 71, 72, 74, 75, 67, 69, 71, 86, 95, 111,
  25441. 77, 246, 344, 654, 655, 112, 126, 135, 136, 137,
  25442. 663, 669 146, 147, 148, 149, 150,
  25443. EQUALS, 85 151, 152, 153, 154, 158,
  25444. <equals operator>, 80, 207, 163, 167, 203, 215, 231,
  25445. 391, 434, 438, 479, 500, 233, 234, 235, 236, 253,
  25446. 505 279, 299, 338, 348, 349,
  25447. EQUAL_KEY_DEGREES, 617
  25448. EQUAL_KEY_DEGREES assertion 350, 363, 375, 378, 379,
  25449. , 617 380, 381, 382, 383, 384,
  25450. equivalent, 1, 14, 15, 61, 386, 389, 392, 393, 394,
  25451. 62, 71, 86, 87, 92, 93, 400, 403, 404, 405, 407,
  25452. 94, 100, 108, 121, 142, 408, 409, 410, 412, 413,
  25453. 146, 147, 174, 191, 197, 415, 417, 419, 420, 422,
  25454. 198, 211, 212, 214, 229, 431, 433, 435, 439, 441,
  25455. 241, 245, 246, 263, 264, 443, 447, 448, 449, 450,
  25456. 333, 388, 397, 492, 496, 451, 455, 456, 457, 458,
  25457. 501, 502, 506, 507, 510, 459, 460, 462, 465, 466,
  25458. 513, 516, 518, 519, 521, 467, 479, 482, 485, 486,
  25459. 522, 533 489, 495, 497, 498, 499,
  25460. error in assignment, 435, 526, 527, 528, 624, 654,
  25461. 439, 620 655, 662, 666, 667, 672
  25462. ESCAPE, 84, 214, 215, 353 EXCEPTION, 84, 479, 680
  25463. exception condition, 10
  25464. Index 27
  25465. Exceptions, 10 explicit, 8, 10, 15, 20,
  25466. EXEC, 84, 489, 491 23, 31, 35, 41, 44, 45,
  25467. EXECUTE, 84, 354, 459, 462, 50, 66, 67, 68, 69, 70,
  25468. 483, 680 71, 72, 74, 86, 101,
  25469. <execute immediate 102, 104, 111, 125, 130,
  25470. statement>, 14, 44, 143, 152, 153, 174, 196,
  25471. 45, 54, 59, 61, 63, 64, 197, 198, 202, 241, 242,
  25472. 73, 93, 100, 101, 115, 253, 256, 258, 260, 270,
  25473. 369, 415, 417, 419, 462, 272, 283, 284, 292, 294,
  25474. 483, 653, 654, 656 296, 297, 300, 301, 302,
  25475. <execute statement>, 14, 304, 309, 311, 312, 313,
  25476. 54, 59, 61, 64, 369, 315, 316, 318, 321, 323,
  25477. 441, 447, 448, 455, 456, 325, 326, 328, 329, 333,
  25478. 457, 459, 460, 483, 663 334, 335, 341, 348, 377,
  25479. <existing character set 379, 392, 400, 446, 447,
  25480. name>, 311, 312 469, 474, 488, 493, 579,
  25481. EXISTS, 84, 222, 271, 273,
  25482. 303, 544, 576, 617, 618 584, 594, 629, 632, 654,
  25483. <exists predicate>, 191, 655, 656, 661, 662, 667
  25484. 205, 222 Explicit, 23, 24, 25, 26,
  25485. 35, 161, 187, 372
  25486. <explicit table>, 196, 197,
  25487. 202, 632
  25488. explicit type conversion,
  25489. 35
  25490. <exponent>, 90, 95
  25491. exposed, 118, 119
  25492. <extended cursor name>, 62,
  25493. 99, 102, 104, 443, 462,
  25494. 465, 466, 467, 629, 657
  25495. <extended statement name>,
  25496. 62, 99, 102, 104, 447,
  25497. 448, 465, 629, 657, 672
  25498. Extensions and options, 626
  25499. EXTERNAL, 84, 314, 320,
  25500. 661, 680
  25501. <external collation>, 314,
  25502. 317
  25503. 28 Database Language SQL
  25504. <external collation name>, fixed-length, 93, 94, 115,
  25505. 314, 315 145, 147, 148, 150, 151,
  25506. <external translation>, 320 161, 162, 163, 231, 232,
  25507. <external translation name> 234, 235, 237, 268, 506,
  25508. , 320, 321 507, 658
  25509. EXTRACT, 84, 128, 130, 444, fixed-length coding, 5, 6
  25510. 680 flagger, 76, 77, 626, 656
  25511. <extract expression>, 29, Flagger requirements, 626
  25512. 34, 128, 129, 130, 131, FLOAT, 19, 27, 34, 84, 108,
  25513. 641, 659 110, 361, 425, 426, 429,
  25514. <extract field>, 128, 129, 440, 520, 522, 571, 657,
  25515. 130, 444 658
  25516. <extract source>, 128, 129, <fold>, 22, 132, 133, 135,
  25517. 130 136, 137, 444, 630
  25518. - F - FOR, 84, 132, 133, 149,
  25519. <factor>, 157, 168, 169 151, 314, 320, 333, 335,
  25520. FALSE, 84, 229, 230, 356, 336, 337, 362, 363, 364,
  25521. 680 366, 371, 372, 373, 374,
  25522. feature not supported, 407, 392, 445, 464, 465, 474,
  25523. 410, 621 635, 638
  25524. FETCH, 84, 377, 469, 483 FOREIGN, 84, 264, 274, 569,
  25525. <fetch orientation>, 377, 573, 574, 576, 580, 583,
  25526. 378, 379, 380, 469, 635, 584, 585, 587, 588, 590,
  25527. 638 591, 595, 596, 598, 600,
  25528. <fetch statement>, 50, 53, 602, 605, 606, 608, 610,
  25529. 55, 57, 58, 59, 350, 618
  25530. 368, 377, 380, 483, 635, Format, 9, 11, 12, 15, 86,
  25531. 647, 671, 677 407, 408, 415, 417, 419,
  25532. <fetch target list>, 377, 420, 431, 443, 447, 459,
  25533. 379, 380, 470, 647, 671 462, 465, 525, 526, 625,
  25534. Fields in datetime items, 663, 665, 667
  25535. 30 form-of-use, 6, 20, 21, 22,
  25536. Fields in day-time INTERVAL 99, 103, 104, 132, 133,
  25537. items, 32 134, 136, 137, 148, 149,
  25538. Fields in year-month
  25539. INTERVAL items, 32 151, 248, 249, 250, 444,
  25540. FIRST, 84, 352, 377, 378, 607, 619, 630, 657, 659,
  25541. 379, 680 660
  25542. Index 29
  25543. form-of-use conversion, 6, FROM, 84, 128, 130, 132,
  25544. 20, 22, 103, 104, 133, 133, 134, 149, 151, 152,
  25545. 134, 136, 137, 444, 630, 153, 154, 178, 180, 182,
  25546. 657, 659 183, 184, 197, 198, 271,
  25547. <form-of-use conversion>, 272, 273, 276, 289, 294,
  25548. 22, 132, 133, 136, 137, 300, 303, 310, 311, 313,
  25549. 444, 630, 659 314, 318, 320, 323, 333,
  25550. <form-of-use conversion 362, 363, 364, 366, 377,
  25551. name>, 99, 103, 104, 380, 384, 386, 403, 407,
  25552. 132, 133, 134, 136, 630, 408, 415, 417, 419, 420,
  25553. 657 431, 442, 444, 445, 447,
  25554. FORM_OF_USE, 554, 606, 607, 465, 469, 472, 476, 485,
  25555. 665 537, 538, 539, 541, 542,
  25556. FORTRAN, 83, 243, 359, 364, 543, 544, 545, 546, 547,
  25557. 493, 612, 613, 614 548, 549, 550, 551, 552,
  25558. <Fortran host identifier>,
  25559. 490, 512, 513 553, 554, 555, 556, 557,
  25560. <Fortran type specifica- 558, 559, 561, 562, 563,
  25561. tion>, 512, 513, 514, 571, 572, 573, 576, 578,
  25562. 639, 651 580, 581, 583, 584, 585,
  25563. <Fortran variable 586, 588, 591, 593, 595,
  25564. definition>, 490, 512, 596, 604, 606, 608, 610,
  25565. 513 611, 616, 617, 618, 647
  25566. FOUND, 84, 352, 497, 499 <from clause>, 118, 177,
  25567. 178, 179, 185, 187, 189,
  25568. 193, 631, 635, 636, 638
  25569. FULL, 42, 84, 180, 182,
  25570. 184, 224, 225, 274, 276,
  25571. 277, 278, 590, 591, 613,
  25572. 618, 680
  25573. Full SQL, 625
  25574. Function, 9, 10
  25575. 30 Database Language SQL
  25576. - G - <get diagnostics statement>
  25577. GENERAL, 85 , 54, 369, 479, 481,
  25578. <general literal>, 89, 97 482, 484, 485, 488, 651
  25579. generally contain, 11, 127, <get item information>, 434
  25580. 139, 186, 281, 282, 296, GLOBAL, 38, 84, 99, 104,
  25581. 301, 307, 325, 375, 387, 260, 261, 576, 577, 633,
  25582. 390, 392, 396, 474, 636, 680
  25583. 641 global temporary table, 37,
  25584. generally underlying table, 38, 39, 72, 258, 260,
  25585. 38, 193, 299, 372, 387, 261, 275, 281, 633, 655,
  25586. 389, 390, 392, 396, 474 668
  25587. General Rules, 9, 10, 12, GO, 84, 497, 499
  25588. 13, 14, 15, 40, 44, 69, GOTO, 84, 497
  25589. 70, 76, 146, 187, 202, <go to>, 497, 498, 499
  25590. <goto target>, 497, 498
  25591. 205, 253, 258, 261, 278, GRANT, 65, 75, 84, 248,
  25592. 279, 282, 284, 289, 292, 315, 321, 329, 330, 331,
  25593. 294, 300, 350, 351, 376, 332, 333, 335, 336, 337,
  25594. 379, 383, 389, 393, 395, 484, 533, 601, 603, 605
  25595. 403, 413, 441, 443, 456, grantable privilege, 66
  25596. 457, 458, 460, 463, 464, GRANTEE, 539, 542, 545,
  25597. 465, 467, 468, 469, 470, 546, 547, 548, 554, 555,
  25598. 471, 472, 475, 476, 477, 556, 600, 601, 602, 603,
  25599. 485, 495, 528, 530, 625, 604, 605
  25600. 662, 663, 672, 673, 677 <grantee>, 245, 246, 329,
  25601. <general set function>, 330, 331, 332, 333, 338
  25602. 124, 126, 630, 641 GRANTOR, 546, 547, 548,
  25603. <general value specifica- 600, 602, 603, 604, 605
  25604. tion>, 114, 116, 117, <grant statement>, 52, 65,
  25605. 302, 362, 641, 658 66, 245, 248, 255, 315,
  25606. GET, 84, 311, 434, 479, 321, 329, 330, 331, 332,
  25607. 483, 484, 680 368, 484
  25608. <get count>, 434 <greater than operator>,
  25609. <get descriptor informa- 80, 207, 373, 531
  25610. tion>, 434 <greater than or equals
  25611. <get descriptor statement>, operator>, 83, 207
  25612. 54, 60, 62, 369, 434, GROUP, 84, 187, 616, 617
  25613. 435, 436, 483, 672
  25614. Index 31
  25615. <group by clause>, 38, 118, - I -
  25616. 177, 187, 189, 193, 203, identified privilege
  25617. 296, 383, 631, 635, 643 descriptor, 335
  25618. grouped table, 38, 124, <identifier>, 44, 46, 62,
  25619. 177, 187, 189, 192, 194 71, 73, 98, 99, 100,
  25620. grouped view, 177, 179, 102, 105, 408, 419, 431,
  25621. 195, 203, 296, 383, 631, 447, 451, 465, 481, 533,
  25622. 632, 635, 643 534, 564, 630, 656, 657,
  25623. <grouping column reference> 677
  25624. , 187 <identifier>s for use
  25625. <grouping column reference with <get diagnostics
  25626. list>, 187 statement>, 481
  25627. - H - <identifier body>, 82, 86,
  25628. HAVING, 84, 189 87, 88, 100, 533, 629,
  25629. <having clause>, 38, 118, 640
  25630. 125, 177, 181, 185, 189, <identifier part>, 82, 86
  25631. 193, 203, 296, 383, 631, <identifier start>, 82, 85,
  25632. 635, 643, 678 86
  25633. <hexit>, 89, 90, 92, 94 IDENTITY, 84, 320, 321, 680
  25634. <hex string literal>, 82, IF, 85
  25635. 86, 89, 92, 94, 95, 97, IGNORE, 85
  25636. 266, 267, 629 immediate, 40, 41, 253,
  25637. <high>, 16, 17 270, 326, 350, 401, 528,
  25638. <host identifier>, 490, 575, 587, 599
  25639. 492, 495, 496 IMMEDIATE, 84, 252, 253,
  25640. <host label identifier>, 270, 301, 325, 401, 403,
  25641. 497, 498, 499 462, 483, 633, 680
  25642. <host PL/I label variable>, immediate base, 299
  25643. 497, 498, 499 immediately contain, 11,
  25644. host variable, 23, 24 14, 118, 119, 122, 129,
  25645. <host variable definition>, 155, 157, 166, 167, 173,
  25646. 489, 490, 492, 494, 495, 174, 191, 192, 193, 200,
  25647. 496 203, 263, 271, 272, 297,
  25648. HOUR, 30, 31, 32, 33, 73, 302, 311, 315, 320, 335,
  25649. 84, 95, 112, 113, 123, 390, 392, 396, 408, 422,
  25650. 130, 166, 167, 238, 239, 431, 444, 465, 474, 648
  25651. 240, 422, 430, 441, 680
  25652. <hours value>, 91, 94
  25653. 32 Database Language SQL
  25654. immediately-executable <implementation-defined
  25655. SQL-statement, 57 collation name>, 314,
  25656. implementation-defined, 6, 315, 661
  25657. 20, 21, 28, 29, 34, 44, Implementation-defined
  25658. 45, 46, 47, 51, 56, 61, elements, 653
  25659. 64, 67, 69, 71, 72, 73, <implementation-defined
  25660. 74, 77, 83, 87, 93, 101, translation name>, 320,
  25661. 102, 103, 104, 108, 109, 321, 661
  25662. 110, 112, 115, 116, 125, <implementation-defined
  25663. 129, 133, 134, 146, 147, universal character
  25664. 157, 158, 161, 162, 171, form-of-use name>, 248,
  25665. 233, 235, 238, 240, 248, 249, 660
  25666. 249, 250, 256, 311, 314, implementation-dependent,
  25667. 315, 317, 320, 321, 341, 6, 10, 12, 13, 19, 37,
  25668. 344, 348, 356, 357, 358, 39, 40, 48, 49, 50, 51,
  25669. 359, 360, 361, 362, 363, 64, 65, 66, 69, 72, 74,
  25670. 364, 365, 366, 373, 400, 122, 140, 171, 174, 192,
  25671. 404, 407, 408, 420, 422, 197, 199, 200, 208, 237,
  25672. 431, 432, 440, 441, 442, 270, 279, 296, 302, 309,
  25673. 443, 445, 447, 452, 454, 342, 346, 350, 351, 373,
  25674. 481, 485, 486, 488, 492, 379, 380, 382, 383, 397,
  25675. 501, 502, 506, 509, 510, 400, 412, 435, 436, 440,
  25676. 513, 516, 518, 521, 522, 441, 448, 452, 454, 485,
  25677. 525, 526, 527, 528, 529, 493, 494, 495, 526, 530,
  25678. 531, 564, 565, 586, 607, 531, 607, 667, 668, 669,
  25679. 609, 612, 613, 614, 615, 670, 671, 672, 673, 674,
  25680. 619, 624, 626, 630, 653, 677, 678
  25681. 654, 655, 656, 657, 658, Implementation-dependent
  25682. 659, 660, 661, 662, 663, elements, 667
  25683. 664, 665, 666
  25684. <implementation-defined
  25685. character repertoire
  25686. name>, 20, 248, 249,
  25687. 311, 660
  25688. Index 33
  25689. implicit, 13, 20, 31, 41, IN, 84, 128, 212, 445, 539,
  25690. 44, 67, 69, 70, 71, 72, 542, 543, 545, 546, 547,
  25691. 73, 74, 101, 102, 103, 548, 554, 555, 556, 570,
  25692. 104, 108, 109, 110, 111, 571, 572, 573, 574, 576,
  25693. 115, 121, 122, 124, 125, 578, 580, 581, 583, 584,
  25694. 130, 134, 142, 143, 149, 585, 586, 588, 590, 591,
  25695. 151, 152, 153, 166, 174, 593, 595, 596, 598, 600,
  25696. 181, 182, 232, 240, 241, 602, 604, 606, 608, 611,
  25697. 242, 252, 253, 255, 256, 612, 613, 618
  25698. 258, 260, 263, 266, 268, include, 6, 13, 14, 15, 19,
  25699. 270, 272, 275, 276, 283, 21, 22, 30, 32, 34, 36,
  25700. 284, 292, 294, 296, 297, 37, 39, 40, 41, 42, 43,
  25701. 300, 301, 302, 304, 309, 44, 48, 50, 75, 76, 86,
  25702. 311, 312, 313, 315, 316, 100, 111, 119, 121, 122,
  25703. 318, 320, 321, 323, 325, 126, 135, 145, 153, 186,
  25704. 326, 328, 329, 333, 334, 192, 193, 194, 236, 246,
  25705. 335, 341, 344, 362, 363, 248, 249, 250, 251, 253,
  25706. 364, 365, 366, 367, 372, 260, 261, 264, 265, 268,
  25707. 377, 379, 388, 392, 397, 270, 271, 273, 275, 276,
  25708. 399, 400, 403, 405, 407, 282, 283, 284, 288, 289,
  25709. 417, 431, 446, 447, 469, 291, 292, 294, 296, 297,
  25710. 474, 476, 477, 488, 492, 299, 300, 301, 302, 304,
  25711. 493, 501, 506, 510, 513, 308, 309, 310, 311, 312,
  25712. 518, 521, 579, 584, 594, 313, 315, 316, 318, 321,
  25713. 633, 655, 656, 657, 660, 323, 325, 326, 328, 329,
  25714. 661, 662, 663, 664, 669, 330, 331, 335, 336, 337,
  25715. 672 372, 383, 384, 386, 389,
  25716. Implicit, 23, 24, 25, 26, 392, 394, 397, 452, 454,
  25717. 35, 122, 134 495, 496, 505, 506, 521,
  25718. implicit type conversion, 569, 581, 635, 640, 641,
  25719. 35 643, 668, 686
  25720. implicit zero-bit padding, Incompatibilities with
  25721. 149, 151, 152, 232, 268, ISO/IEC 9075:1989, 677
  25722. 623 independent, 14, 335, 336
  25723. independent node, 335, 336
  25724. Index typography, 15
  25725. indicator, 231, 656
  25726. 34 Database Language SQL
  25727. INDICATOR, 84, 114, 352, INFORMATION_SCHEMA, 20, 45,
  25728. 353, 427, 434, 435, 436, 75, 103, 249, 355, 533,
  25729. 439, 452, 453, 455, 456, 535, 536, 537, 538, 539,
  25730. 458, 500, 502, 673 541, 542, 543, 545, 546,
  25731. indicator overflow, 231, 547, 548, 549, 550, 551,
  25732. 620 552, 553, 554, 555, 556,
  25733. indicator parameter, 48, 557, 558, 559, 561, 562,
  25734. 114, 115, 116, 192, 231, 568, 569, 570, 573, 574,
  25735. 356, 435, 436, 439, 630, 576, 578, 580, 583, 584,
  25736. 659, 661 585, 588, 590, 593, 595,
  25737. <indicator parameter>, 114, 596, 598, 600, 602, 604,
  25738. 115, 116, 192, 436, 439, 606, 607, 608, 609, 610,
  25739. 630, 659 612, 665
  25740. Indicator parameters, 48 INFORMATION_SCHEMA Schema,
  25741. indicator variable, 47, 48, 535
  25742. 114, 115, 116 INFORMATION_SCHEMA_CATALOG_
  25743. <indicator variable>, 114, NAME, 536, 537, 538,
  25744. 115, 116, 192, 630, 659 539, 541, 542, 543, 545,
  25745. Information Schema, 1, 10,
  25746. 45, 63, 66, 69, 75, 77, 546, 547, 548, 549, 550,
  25747. 282, 299, 326, 398, 533, 551, 552, 553, 554, 555,
  25748. 534, 535, 536, 538, 540, 556, 557, 558, 559, 561,
  25749. 541, 542, 543, 545, 546, 562
  25750. 547, 548, 549, 550, 551, INFORMATION_SCHEMA_CATALOG_
  25751. 552, 553, 554, 557, 558, NAME base table, 536
  25752. 560, 561, 562, 563, 567, INFORMATION_SCHEMA_CATALOG_
  25753. 568, 640, 652, 667 NAME_CARDINALITY, 537
  25754. Information Schema and INFORMATION_SCHEMA_
  25755. Definition Schema, 533 CATALOG_NAME_CARDINALITY
  25756. assertion, 537
  25757. INFORMATION_SCHEMA_CATALOG_
  25758. NAME_PRIMARY_KEY, 536
  25759. Informative elements, 9
  25760. INITIALLY, 84, 252, 253,
  25761. 270, 301, 325, 541, 549,
  25762. 553, 574, 575, 585, 587,
  25763. 598, 599, 633, 680
  25764. Index 35
  25765. initially deferred, 575, insufficient item
  25766. 587, 599 descriptor areas, 452,
  25767. initially immediate, 253, 453, 623
  25768. 575, 587, 599 INT, 84, 108, 356, 357,
  25769. INITIALLY_DEFERRED, 541, 366, 500, 502, 515, 516
  25770. 549, 553, 574, 575, 585, INTEGER, 19, 27, 34, 84,
  25771. 587, 598, 599 108, 110, 209, 352, 357,
  25772. INNER, 84, 180, 181, 182, 358, 359, 360, 361, 425,
  25773. 183, 680 426, 429, 440, 502, 507,
  25774. innermost, 8, 11, 118 510, 512, 513, 514, 516,
  25775. <in predicate>, 205, 212, 517, 519, 522, 565, 571,
  25776. 444, 446 657, 662
  25777. <in predicate value>, 212 integrity constraint, 1,
  25778. INPUT, 84, 450, 680 40, 67, 69, 74, 154,
  25779. input parameter, 61, 62,
  25780. 347, 348, 350, 357, 362, 236, 253, 270, 325, 385,
  25781. 363, 364, 365, 366, 367, 387, 403, 486
  25782. 459, 467, 661 Integrity constraints, 40
  25783. INSENSITIVE, 50, 84, 371, integrity constraint
  25784. 372, 374, 376, 464, 465, violation, 154, 236,
  25785. 635, 638, 680 253, 403, 486, 621, 622
  25786. INSERT, 64, 66, 84, 245, <integrity no>, 16, 17
  25787. 246, 261, 284, 289, 298, <integrity yes>, 16, 17
  25788. 329, 330, 333, 334, 388, <intermediate>, 16, 17
  25789. Intermediate SQL, 625, 629
  25790. 389, 398, 484, 600, 601, Intermediate SQL
  25791. 602, 603, 632 Specifications, 629
  25792. <insert column list>, 174, INTERSECT, 84, 196, 197,
  25793. 388, 389, 446 200, 201, 202, 208, 643,
  25794. <insert columns and source> 670, 680
  25795. , 388, 390, 648 INTERVAL, 19, 30, 31, 32,
  25796. <insert statement>, 53, 55, 33, 49, 73, 83, 84, 91,
  25797. 56, 58, 59, 119, 173, 94, 108, 112, 113, 123,
  25798. 174, 176, 202, 299, 369, 166, 167, 169, 170, 209,
  25799. 388, 390, 442, 444, 446, 227, 228, 353, 422, 426,
  25800. 484, 485, 525, 631, 632, 427, 429, 434, 436, 439,
  25801. 636, 642, 648, 673 440, 441, 445, 453, 454,
  25802. 455, 456, 457, 571, 663,
  25803. 680
  25804. 36 Database Language SQL
  25805. interval data type <interval value expression>
  25806. descriptor, 29, 30 , 128, 129, 130, 155,
  25807. <interval factor>, 168, 169 156, 165, 166, 167, 168,
  25808. interval field overflow, 169, 170, 171, 422, 642
  25809. 154, 233, 235, 620 intervening, 11, 36, 118,
  25810. <interval fractional 178, 193, 197, 200
  25811. seconds precision>, INTO, 84, 377, 382, 388,
  25812. 33, 96, 113, 129, 239, 451, 459, 469
  25813. 240, 241, 242, 427, 445, <introducer>, 46, 89, 93,
  25814. 453, 455, 660 98, 100
  25815. <interval leading field Introduction, 533, 566, 625
  25816. precision>, 32, 112, in usage by, 301, 307
  25817. 170, 209, 239, 240, 241, invalid authorization
  25818. 242, 427, 445, 453, 455, specification, 348,
  25819. 660 407, 408, 420, 621
  25820. <interval literal>, 89, 91, invalid catalog name, 415,
  25821. 94, 95, 96, 97, 267, 640 621
  25822. <interval primary>, 168, invalid character set name,
  25823. 169 419, 621
  25824. <interval qualifier>, 30, invalid character value
  25825. 32, 91, 94, 95, 96, 108, for cast, 146, 147, 148,
  25826. 111, 113, 168, 170, 171, 149, 150, 151, 152, 153,
  25827. 239, 240, 241, 242, 267, 154, 620
  25828. 427, 429, 445, 453, 455, invalid condition number,
  25829. 644 400, 485, 621
  25830. Intervals, 32 invalid connection name,
  25831. <interval string>, 82, 86, 408, 622
  25832. 91 invalid cursor name, 443,
  25833. <interval term 1>, 168, 462, 465, 466, 467, 622
  25834. 169, 170 invalid cursor state, 375,
  25835. <interval term 2>, 168, 169 378, 381, 384, 392, 449,
  25836. <interval term>, 165, 166, 487, 622
  25837. 167, 168, 169, 445 invalid datetime format,
  25838. <interval type>, 107, 108, 112, 620
  25839. 111, 113, 427, 453, 455, invalid descriptor count,
  25840. 640 455, 457, 621
  25841. <interval value expression invalid descriptor index,
  25842. 1>, 168, 169, 170 431, 435, 439, 621
  25843. Index 37
  25844. invalid escape character, ISO/IEC 9075, xi, xiii,
  25845. 215, 620 xvi, 75, 76, 85, 677,
  25846. invalid escape sequence, 678, 685, 686
  25847. 215, 620 ISO/IEC 9579-2, 3, 619, 622
  25848. invalid parameter value, ISO/IEC 9899, 3, 243, 505
  25849. 348, 620 ISO/IEC DIS 10032, 1
  25850. invalid schema name, 417, ISO 1989, 3, 243, 509
  25851. 622 ISO 2022, 3, 249
  25852. invalid SQL descriptor ISO 6160, 3, 243, 521
  25853. name, 431, 433, 435, ISO 7185, 3, 243, 517
  25854. 439, 451, 622 ISO 8601, 3, 5
  25855. invalid SQL statement name, ISO 8652, 3, 243, 501
  25856. ISO 9075, 612, 613, 614,
  25857. 449, 450, 459, 465, 467, 663, 665
  25858. 622 ISOLATION, 84, 399, 680
  25859. invalid time zone isolation level, 68, 69,
  25860. displacement value, 70, 74, 76, 350, 399,
  25861. 167, 422, 620 400, 528, 662
  25862. invalid transaction state, <isolation level>, 399
  25863. 350, 384, 386, 389, 392, IS_DEFERRABLE, 541, 549,
  25864. 394, 400, 412, 420, 527, 553, 574, 575, 585, 587,
  25865. 528, 622 598
  25866. invalid transaction IS_GRANTABLE, 546, 547,
  25867. termination, 403, 405, 548, 600, 601, 602, 603,
  25868. 622 604, 605
  25869. <in value list>, 212, 213, IS_NULLABLE, 544, 580, 582
  25870. 444, 446, 632 IS_UPDATABLE, 543, 578, 579
  25871. IS, 36, 84, 142, 218, 229, IS_UPDATABLE_CHECK, 578
  25872. 230, 264, 272, 500, 504, IS_UPDATABLE_NOT_NULL, 578
  25873. 506, 508, 512, 517, 520, <item number>, 434, 435,
  25874. 562, 570, 571, 580, 581, 436, 438, 439
  25875. 612, 613, 618 - J -
  25876. ISO/IEC 10206, 3, 243, 517 JOIN, 84, 180, 182, 184,
  25877. ISO/IEC 10646, 3, 5, 249 539, 541, 545, 549, 550,
  25878. ISO/IEC 11756, 4, 243, 515 551, 552, 553, 557, 558,
  25879. ISO/IEC 1539, 3, 243, 512 559, 561, 562, 631, 680
  25880. ISO/IEC 646, 3 <join column list>, 180,
  25881. ISO/IEC 8824, 3 181
  25882. join columns, 181, 182, 183
  25883. 38 Database Language SQL
  25884. <join condition>, 118, 180, KEY_COLUMN_USAGE view, 552
  25885. 181, 183, 200 KEY_COLUMN_USAGE_FOREIGN_
  25886. <joined table>, 45, 118, KEY_COLUMNS, 588
  25887. 120, 121, 178, 180, 181, KEY_COLUMN_USAGE_PRIMARY_
  25888. 182, 184, 191, 196, 198, KEY, 588
  25889. 199, 200, 201, 202, 641, KEY_COLUMN_USAGE_UNIQUE,
  25890. 643 588
  25891. <join specification>, 180, KEY_DEGREE_GREATER_THAN_OR_
  25892. 181 EQUAL_TO_1, 618
  25893. <join type>, 180, 181, 183 KEY_DEGREE_GREATER_THAN_
  25894. - K - OR_EQUAL_TO_1 assertion,
  25895. KEY, 36, 41, 42, 84, 264, 618
  25896. 270, 272, 273, 274, 275, known not nullable, 36,
  25897. 481, 536, 552, 561, 568, 199, 200, 582
  25898. 569, 571, 573, 574, 576, - L -
  25899. 578, 580, 583, 584, 585, LANGUAGE, 84, 243, 563,
  25900. 586, 587, 588, 590, 591, 612, 613, 614, 615, 640,
  25901. 593, 595, 596, 598, 600, 665
  25902. 602, 604, 605, 606, 608, <language clause>, 46, 243,
  25903. 610, 617, 618, 640, 645 244, 341, 342, 344, 346,
  25904. <key word>, 19, 21, 82, 83, 352, 357, 358, 359, 360,
  25905. 85, 87, 101, 120, 427, 361, 362, 363, 364, 365,
  25906. 631, 641, 653, 666 366, 367, 452, 454, 493,
  25907. KEY_COLUMN_CONSTRAINT_TYPE_ 644, 670, 671
  25908. CHECK, 588 <language name>, 243
  25909. KEY_COLUMN_ORDINAL_ LAST, 84, 377, 378, 379,
  25910. POSITION_NOT_NULL, 588 680
  25911. KEY_COLUMN_TABLE_CATALOG_ LEADING, 84, 132, 137, 680
  25912. NOT_NULL, 588 leaf generally underlying
  25913. KEY_COLUMN_TABLE_NAME_NOT_ table, 38, 372, 387,
  25914. NULL, 588 389, 390, 392, 396, 474
  25915. KEY_COLUMN_TABLE_SCHEMA_ leaf underlying table, 38,
  25916. NOT_NULL, 588 298, 330
  25917. KEY_COLUMN_USAGE, 552, 561, LEAVE, 85
  25918. 588, 617, 618, 640 LEFT, 84, 180, 182, 183,
  25919. KEY_COLUMN_USAGE base table 539, 545, 680
  25920. , 588 <left bracket>, 79, 80, 83,
  25921. 504, 517
  25922. Index 39
  25923. <left paren>, 16, 79, 80, levels of conformance, 75
  25924. 107, 108, 118, 124, 128, Lexical elements, 79
  25925. 132, 133, 139, 141, 144, LIKE, 23, 84, 214, 215, 216
  25926. 155, 168, 173, 180, 196, <like predicate>, 23, 205,
  25927. 203, 212, 229, 239, 245, 214, 216, 447
  25928. 260, 272, 274, 281, 296, LIMIT, 85
  25929. 297, 314, 320, 325, 346, <limited collation
  25930. 388, 390, 489, 491, 500, definition>, 311
  25931. literal, 23, 24
  25932. 508, 515, 520 <literal>, 19, 89, 102,
  25933. LENGTH, 83, 356, 425, 426, 114, 116, 146, 147, 149,
  25934. 427, 434, 436, 439, 440, 151, 152, 153, 154, 191,
  25935. 441, 452, 453, 454, 455, 266, 267, 268, 432, 433,
  25936. 456, 457, 663 437, 441, 443, 458, 530,
  25937. <length>, 63, 93, 107, 108, 629, 637, 638, 640
  25938. 109, 356, 357, 358, 359, LOCAL, 38, 40, 84, 99, 102,
  25939. 360, 361, 445, 447, 500, 104, 165, 166, 167, 260,
  25940. 501, 502, 504, 505, 506, 261, 296, 299, 397, 422,
  25941. 507, 508, 509, 510, 512, 576, 577, 578, 579, 680
  25942. 513, 515, 516, 517, 518, <local table name>, 98,
  25943. 519, 520, 521, 522, 639 103, 397, 486, 487
  25944. <length expression>, 23, local temporary table, 37,
  25945. 27, 29, 128, 129, 131, 38, 39, 72, 101, 103,
  25946. 630, 641, 659 245, 258, 260, 261, 275,
  25947. LESS, 85 281, 283, 294, 397, 398,
  25948. <less than operator>, 80, 459, 486, 487, 577, 655,
  25949. 207, 373, 531 668
  25950. <less than or equals LOOP, 85
  25951. operator>, 83, 207 <low>, 16, 17
  25952. LEVEL, 84, 399, 680 LOWER, 22, 84, 132, 136,
  25953. Leveling, 75 681
  25954. Leveling Rules, 9, 12, 15, lower case, 22, 81, 87, 88,
  25955. 625 135, 136, 506, 534, 640
  25956. Leveling the SQL Language,
  25957. 629
  25958. <level of isolation>, 399,
  25959. 400, 662
  25960. <levels clause>, 296, 297,
  25961. 299, 633
  25962. 40 Database Language SQL
  25963. - M - MINUTE, 30, 31, 32, 33, 73,
  25964. Maintenance and interpreta- 84, 95, 112, 113, 123,
  25965. tion of SQL, 685 130, 166, 238, 239, 240,
  25966. <mantissa>, 90, 94, 95, 422, 430, 441, 681
  25967. 148, 150 <minutes value>, 91, 94
  25968. marked modified privilege mixing of data types, 34
  25969. descriptor, 336 modified, 335
  25970. MATCH, 42, 43, 84, 224, modified privilege
  25971. 274, 276, 280, 353, 354, descriptor, 335
  25972. 550, 590, 591, 633, 681 MODIFY, 85
  25973. matching rows, 224, 277, module, 38, 39, 45, 46, 47,
  25974. 278, 279 48, 49, 55, 56, 61, 62,
  25975. <match predicate>, 205, 63, 65, 67, 71, 72, 73,
  25976. 206, 224, 225, 226, 276, 74, 76, 85, 86, 92, 93,
  25977. 447, 632 99, 100, 101, 102, 103,
  25978. <match type>, 42, 271, 274, 104, 115, 116, 256, 260,
  25979. 276, 277, 278, 591 261, 297, 302, 312, 316,
  25980. <match value>, 214, 217, 321, 326, 341, 342, 343,
  25981. 447, 643 344, 345, 346, 348, 349,
  25982. MATCH_OPTION, 550, 590, 591 350, 352, 371, 375, 377,
  25983. MAX, 84, 124, 125, 126, 381, 384, 391, 397, 403,
  25984. 189, 193, 208, 431, 539, 405, 408, 409, 411, 449,
  25985. 544, 570, 571, 572, 616, 450, 459, 464, 467, 469,
  25986. 663, 670 471, 472, 474, 490, 493,
  25987. MESSAGE_LENGTH, 83, 480, 495, 496, 613, 614, 625,
  25988. 481, 488 627, 634, 646, 647, 654,
  25989. MESSAGE_OCTET_LENGTH, 83, 655, 656, 657, 658, 661,
  25990. 480, 481, 488 662, 668, 669, 670, 671,
  25991. MESSAGE_TEXT, 83, 480, 481,
  25992. 488, 663 673, 674, 678
  25993. MIN, 84, 124, 125, 126, Module, 341
  25994. 189, 193, 208, 670 MODULE, 39, 84, 98, 344,
  25995. <minus sign>, 80, 83, 86, 397, 486, 487, 612, 613,
  25996. 90, 91, 157, 158, 165, 614
  25997. 168, 169, 241, 242
  25998. Index 41
  25999. <module>, 38, 39, 45, 46, <module name clause>, 341,
  26000. 47, 48, 49, 51, 55, 56, 344, 493
  26001. 61, 62, 63, 65, 67, 71, Modules, 46
  26002. 72, 73, 74, 93, 100, monadic, 24, 95, 133, 134,
  26003. 101, 103, 104, 115, 116, 158
  26004. 256, 260, 261, 297, 302, monadic operator, 6, 24,
  26005. 312, 316, 321, 326, 341, 133, 134
  26006. 342, 343, 344, 346, 348, MONTH, 30, 31, 32, 33, 84,
  26007. 349, 350, 352, 371, 375, 95, 111, 112, 113, 238,
  26008. 377, 381, 384, 391, 397, 239, 240, 430, 445, 681
  26009. <months value>, 91, 94, 241
  26010. 403, 405, 408, 409, 411, MORE, 83, 479, 481, 482
  26011. 449, 450, 459, 464, 467, multiple server transac-
  26012. 469, 471, 472, 474, 493, tions, 407, 410, 621
  26013. 495, 496, 614, 625, 627, multiset, 6, 7, 36, 37, 38,
  26014. 634, 646, 654, 655, 656, 178, 183, 184, 332
  26015. 657, 658, 661, 662, 668, MUMPS, 4, 61, 83, 243, 244,
  26016. 669, 670, 671, 673, 674, 359, 360, 365, 489, 490,
  26017. 678 491, 493, 495, 498, 515,
  26018. <module authorization 516, 613, 614, 626, 644,
  26019. clause>, 45, 46, 72, 664
  26020. 101, 102, 341, 343, 493, <MUMPS character variable>,
  26021. 654, 657, 669 515, 516, 664
  26022. <module authorization <MUMPS host identifier>,
  26023. identifier>, 46, 65, 490, 515
  26024. 256, 341, 342, 348, 408, <MUMPS length specifica-
  26025. 656, 661, 662, 673, 678 tion>, 515, 516
  26026. <module character set <MUMPS numeric variable>,
  26027. specification>, 46, 515, 516
  26028. <MUMPS type specification>,
  26029. 85, 86, 92, 93, 100, 515
  26030. 344, 345, 493, 647, 661 <MUMPS variable definition>
  26031. <module contents>, 341, , 490, 515, 516
  26032. 343, 647
  26033. module language, 46, 75
  26034. <module name>, 46, 61, 74,
  26035. 99, 103, 344, 352, 493,
  26036. 669, 673
  26037. 42 Database Language SQL
  26038. - N - <nondoublequote character>,
  26039. n-adic operator, 6 82, 86
  26040. NAME, 84, 427, 434, 438, NONE, 85
  26041. 452, 454, 673 <non-join query expression>
  26042. <named columns join>, 180, , 196, 197, 198, 199,
  26043. 181, 183, 184 200
  26044. NAMES, 84, 344, 419, 484, <non-join query primary>,
  26045. 490, 681 196, 197, 198, 199, 670
  26046. Names and identifiers, 98 <non-join query term>, 196,
  26047. NATIONAL, 20, 21, 84, 107, 197, 198, 199, 670
  26048. 108, 653, 657, 681 non-null, 223, 277
  26049. <national character string non-null value, 19, 42, 89,
  26050. literal>, 82, 86, 89, 111, 208, 225, 234, 278,
  26051. 92, 93, 97, 640 279, 373, 531, 662, 665
  26052. <national character string <nonquote character>, 83,
  26053. type>, 107, 113, 640 89, 92
  26054. NATURAL, 84, 180, 181, 183, non-repeatable read, 68
  26055. 184, 289, 352, 681 <non-reserved word>, 83
  26056. NCHAR, 84, 107, 108, 681 <non-second datetime field>
  26057. NEW, 85 , 239, 241
  26058. <newline>, 83, 86, 92, 656 Normative references, 3
  26059. NEXT, 84, 377, 378, 379, no subclass, 619, 620, 621,
  26060. 469, 681 622, 623
  26061. NO, 21, 35, 84, 208, 249, NOT, 23, 36, 84, 142, 211,
  26062. 250, 274, 276, 314, 315, 212, 214, 218, 228, 229,
  26063. 590, 591, 592, 608, 609, 230, 252, 253, 262, 264,
  26064. 660, 670, 681 270, 271, 272, 273, 301,
  26065. No collating sequence, 23, 303, 325, 497, 499, 562,
  26066. 24, 25, 26, 297 569, 570, 571, 574, 576,
  26067. no data, 47, 350, 351, 379, 578, 580, 585, 588, 590,
  26068. 382, 383, 387, 389, 395, 598, 600, 602, 604, 606,
  26069. 435, 499, 528, 530, 622, 608, 610, 612, 617, 618,
  26070. 624 633, 645
  26071. non-deferrable, 36, 41 Notation, 7
  26072. <nondelimiter token>, 82, <not equals operator>, 83,
  26073. 86 207
  26074. non-deterministic, 40, 189,
  26075. 193, 200, 282, 325
  26076. Index 43
  26077. null, 6, 7, 19, 36, 42, 43, <null predicate> semantics,
  26078. 48, 116, 126, 129, 130, 218
  26079. 131, 135, 136, 137, 142, <null specification>, 173,
  26080. 145, 156, 158, 162, 163, 174, 391
  26081. 166, 169, 173, 174, 182, null value, 6, 7, 19, 36,
  26082. 183, 192, 205, 207, 215, 42, 126, 129, 130, 131,
  26083. 218, 224, 225, 228, 231, 135, 136, 137, 142, 145,
  26084. 234, 267, 268, 278, 279, 156, 158, 162, 163, 166,
  26085. 373, 391, 422, 436, 444, 169, 174, 183, 207, 215,
  26086. 452, 454, 456, 458, 506, 218, 224, 225, 228, 231,
  26087. 525, 531, 573, 579, 581, 234, 267, 268, 278, 279,
  26088. 594, 614, 644, 662, 665, 435, 436, 454, 456, 458,
  26089. 668, 671, 674 525, 579, 594, 614, 662,
  26090. NULL, 19, 36, 84, 141, 142, 665, 668, 671, 674
  26091. 144, 145, 173, 192, 218, null value, no indicator
  26092. 262, 264, 266, 267, 272, parameter, 231, 435, 620
  26093. 273, 274, 278, 279, 543, null value eliminated in
  26094. 544, 562, 569, 570, 571, set function, 126, 623
  26095. 574, 576, 578, 580, 581, number, 27
  26096. NUMBER, 84, 479, 481, 482
  26097. 585, 588, 590, 591, 592, <number of conditions>,
  26098. 598, 600, 602, 604, 606, 399, 400, 672
  26099. 608, 610, 612, 613, 618, Numbers, 27
  26100. 645 NUMBER_OF_CHARACTERS, 554,
  26101. nullability, 36, 265 606, 607, 665
  26102. nullability characteristic, NUMERIC, 19, 27, 34, 84,
  26103. 36, 37, 265 107, 109, 110, 353, 358,
  26104. nullable, 42, 47, 182, 192, 425, 426, 429, 440, 445,
  26105. 199, 200, 452, 582 510, 539, 544, 565, 570,
  26106. NULLABLE, 84, 427, 434, 571, 572, 658
  26107. 436, 438, 452, 453, 454, numeric data type
  26108. 544, 580, 582 descriptor, 27
  26109. null character, 363, 506, <numeric primary>, 157, 158
  26110. 661 <numeric type>, 107
  26111. NULLIF, 84, 141, 142, 444, <numeric value expression>,
  26112. 446, 681 133, 155, 157, 158
  26113. <null predicate>, 205, 218, <numeric value function>,
  26114. 444 128, 131, 157, 630, 641
  26115. 44 Database Language SQL
  26116. numeric value out of range, octet, 3, 5, 22, 23, 27,
  26117. 126, 146, 147, 158, 233, 102, 103, 128, 131, 250,
  26118. 235, 620 356, 357, 358, 359, 360,
  26119. NUMERIC_PRECISION, 539, 361, 362, 363, 364, 365,
  26120. 544, 565, 570, 571, 572 366, 367, 436, 452, 453,
  26121. NUMERIC_PRECISION_RADIX, 454, 458, 488, 501, 506,
  26122. 539, 544, 565, 570, 571, 509, 513, 518, 521, 572,
  26123. 572 619
  26124. NUMERIC_SCALE, 539, 544, <octet length expression>,
  26125. 570, 571, 572 128, 131
  26126. - O - OCTET_LENGTH, 83, 84, 128,
  26127. OBJECT, 85 130, 427, 434, 436, 438,
  26128. <object column>, 391, 392, 445, 452, 453, 454, 458,
  26129. 393, 394, 395, 396, 447, 488, 539, 544, 570, 571,
  26130. 474, 475, 648 572, 681
  26131. object identifier, 16, 625 OF, 84, 360, 361, 371, 384,
  26132. Object identifier for 391, 472, 474, 476, 477,
  26133. Database Language SQL, 517, 518, 519, 639
  26134. 16 OFF, 85
  26135. <object name>, 245, 246, OID, 85
  26136. 329, 332, 333, 634, 646 OLD, 85
  26137. OBJECT_CATALOG, 539, 548, ON, 84, 180, 248, 260, 274,
  26138. 554, 555, 556, 604, 605 275, 281, 289, 294, 300,
  26139. OBJECT_NAME, 539, 548, 554, 310, 313, 315, 318, 321,
  26140. 555, 556, 604, 605 323, 329, 330, 331, 332,
  26141. OBJECT_SCHEMA, 539, 548, 333, 397, 403, 539, 541,
  26142. 554, 555, 556, 604, 605 545, 549, 550, 551, 552,
  26143. OBJECT_TYPE, 539, 548, 554, 553, 557, 558, 559, 561,
  26144. 555, 556, 604, 605 562
  26145. <occurrences>, 431, 432, ONLY, 84, 371, 372, 399,
  26146. 435, 439, 451, 453, 455, 400, 681
  26147. 457, 637, 663 OPEN, 84, 375, 467, 483,
  26148. 484
  26149. Index 45
  26150. <open statement>, 50, 53, OPTION, 40, 65, 75, 84,
  26151. 55, 57, 58, 59, 342, 248, 296, 297, 299, 329,
  26152. 368, 371, 375, 464, 465, 330, 331, 333, 335, 336,
  26153. 484, 493, 494, 495, 496, 337, 356, 389, 393, 395,
  26154. 673 487, 533, 543, 550, 578,
  26155. OPERATION, 85 579, 590, 591, 601, 603,
  26156. Operations involving bit 605, 677
  26157. strings, 27 OR, 36, 84, 228, 229, 230,
  26158. Operations involving 539, 546, 547, 548, 571,
  26159. character strings, 22 573, 580, 581, 583, 584,
  26160. Operations involving 585, 586, 591, 595, 596,
  26161. datetimes and intervals, 606, 608, 611, 612, 613
  26162. 34 ORDER, 84, 371, 372, 374,
  26163. Operations involving 464, 530, 635, 638
  26164. numbers, 29 <order by clause>, 50, 371,
  26165. operator, 6, 7, 8, 12, 13, 372, 373, 391, 474, 530,
  26166. 22, 23, 24, 27, 29, 34, 531, 668, 671, 674
  26167. 35, 80, 83, 95, 133, <ordering specification>,
  26168. 134, 157, 158, 160, 161, 371
  26169. 166, 169, 170, 197, 198, ORDINAL_POSITION, 544, 552,
  26170. 200, 201, 202, 207, 208, 580, 581, 588, 589
  26171. 229, 237, 373, 391, 434, Other operators involving
  26172. 438, 443, 445, 479, 500, bit strings, 27
  26173. 505, 531, 659, 670 Other operators involving
  26174. OPERATORS, 85 character strings, 23
  26175. Operators that operate on OTHERS, 85
  26176. bit strings and return Other terms, 14
  26177. bit strings, 27 OUTER, 84, 180, 618, 681
  26178. Operators that operate <outer join type>, 180
  26179. on character strings outermost, 11, 118
  26180. and return character outer reference, 122, 124,
  26181. strings, 22 126, 181, 185, 189, 190,
  26182. 192, 194, 386, 395, 641,
  26183. 678
  26184. OUTPUT, 84, 450, 681
  26185. output parameter, 347, 348,
  26186. 357, 362, 363, 364, 365,
  26187. 366, 367, 661
  26188. 46 Database Language SQL
  26189. OVERLAPS, 34, 84, 227, 681 <parameter declaration
  26190. <overlaps predicate>, 34, list>, 346
  26191. 205, 206, 227, 228, 444, <parameter name>, 75, 99,
  26192. 446, 643, 644 103, 114, 115, 116, 346,
  26193. - P - 347, 350, 371, 494, 673,
  26194. <1989 package>, 16, 17 677
  26195. PAD, 21, 35, 85, 208, 249, Parameters, 47
  26196. 250, 314, 315, 608, 609, PARAMETERS, 85
  26197. 660, 670, 681 <parameter specification>,
  26198. <pad attribute>, 314, 315 114, 115, 116, 525
  26199. PAD_ATTRIBUTE, 555, 608, <parameter using clause>,
  26200. 609, 665 455, 459, 460
  26201. parameter, 28, 29, 47, 48, PARTIAL, 42, 43, 85, 224,
  26202. 61, 62, 63, 70, 75, 99, 225, 274, 276, 277, 278,
  26203. 103, 114, 115, 116, 168, 279, 590, 591, 681
  26204. 192, 231, 281, 296, 325, Pascal, 3, 49, 61, 360,
  26205. 346, 347, 348, 350, 351, 361, 366, 489, 490, 491,
  26206. 352, 356, 357, 358, 359, 493, 495, 498, 517, 518,
  26207. 360, 361, 362, 363, 364, 519, 615, 626, 639, 651,
  26208. 365, 366, 367, 371, 435, 662
  26209. PASCAL, 84, 243, 360, 366,
  26210. 436, 439, 443, 450, 453, 493, 518, 612, 613, 614,
  26211. 454, 455, 456, 459, 460, 615
  26212. 462, 467, 482, 486, 494, <Pascal host identifier>,
  26213. 495, 496, 502, 507, 510, 490, 517, 518
  26214. 514, 516, 519, 522, 525, <Pascal type specification>
  26215. 619, 624, 630, 635, 641, , 517, 518, 519, 639,
  26216. 647, 654, 659, 661, 662, 651
  26217. 664, 665, 666, 671, 672, <Pascal variable
  26218. 673, 674, 675, 677 definition>, 490, 517,
  26219. <parameter declaration>, 518, 519
  26220. 47, 346, 347, 350, 351, <pattern>, 214, 217, 447,
  26221. 352, 356, 357, 358, 359, 643
  26222. 360, 361, 362, 371, 494, PENDANT, 85
  26223. 495, 496, 635, 647, 674, <percent>, 79, 80, 215
  26224. <period>, 80, 90, 91, 94,
  26225. 675 98, 99, 121, 148, 150,
  26226. 191, 242, 508
  26227. Index 47
  26228. persist, 37, 39, 44, 51, possibly non-deterministic,
  26229. 52, 67, 72, 258, 260, 40, 189, 193, 200, 282,
  26230. 261, 275, 281, 397, 398, 325
  26231. 577 possibly nullable, 36, 182,
  26232. persistent, 7, 37, 39, 44, 192, 452, 582
  26233. 46, 51, 52, 67, 258, precede, 12, 242, 297, 341,
  26234. 260, 261, 275, 281, 397, 363, 373, 403, 492, 493,
  26235. 577 505, 509, 512, 521, 531,
  26236. persistent base table, 37 667
  26237. persistent table, 44 PRECISION, 19, 27, 34, 85,
  26238. phantom, 68 108, 110, 352, 357, 358,
  26239. <PL/I host identifier>, 359, 425, 426, 427, 429,
  26240. 490, 520, 521 434, 436, 439, 440, 441,
  26241. <PL/I type fixed binary>, 453, 454, 455, 456, 457,
  26242. 520 500, 502, 507, 512, 513,
  26243. <PL/I type fixed decimal>, 539, 544, 565, 570, 571,
  26244. 520 572, 658, 663
  26245. <PL/I type float binary>, <precision>, 63, 107, 108,
  26246. 520 109, 110, 358, 361, 445,
  26247. <PL/I type specification>,
  26248. 520, 521, 522, 523, 639, 515, 516, 520, 522, 657,
  26249. 651, 664, 665 658
  26250. <PL/I variable definition>, <predicate>, 205, 206, 216,
  26251. 490, 520, 521, 522, 664 229, 632
  26252. PLI, 84, 243, 355, 361, Predicates, 205
  26253. 367, 493, 612, 613, 614, PREORDER, 85
  26254. 615 Preparable and immediately
  26255. <plus sign>, 80, 90, 157, executable SQL-
  26256. 158, 165, 168 statements, 56
  26257. POSITION, 85, 128, 445, <preparable dynamic delete
  26258. 544, 552, 580, 581, 588, statement: positioned>,
  26259. 589, 681 53, 56, 59, 60, 62, 442,
  26260. <position expression>, 23, 443, 460, 462, 463, 476,
  26261. 27, 29, 128, 129, 130, 484, 638
  26262. 131, 444, 630, 659
  26263. possible qualifiers, 121
  26264. 48 Database Language SQL
  26265. <preparable dynamic update PRIMARY, 36, 41, 42, 85,
  26266. statement: positioned>, 270, 272, 273, 275, 536,
  26267. 54, 56, 59, 60, 62, 299, 568, 569, 571, 573, 574,
  26268. 442, 443, 460, 462, 463, 576, 578, 580, 583, 584,
  26269. 477, 484, 639 585, 586, 587, 588, 590,
  26270. <preparable implementation- 591, 593, 595, 596, 598,
  26271. defined statement>, 56, 600, 602, 604, 606, 608,
  26272. 442, 443, 663 610, 618, 645
  26273. <preparable SQL data PRIOR, 85, 377, 378, 379,
  26274. statement>, 442, 637 681
  26275. <preparable SQL schema PRIVATE, 85
  26276. statement>, 442, 637 privilege, 44, 64, 65, 66,
  26277. <preparable SQL session 75, 77, 103, 119, 122,
  26278. statement>, 442, 637 135, 145, 234, 245, 246,
  26279. preparable SQL-statement, 248, 249, 251, 256, 261,
  26280. 56, 57 264, 276, 282, 284, 298,
  26281. <preparable SQL transaction 302, 310, 312, 315, 316,
  26282. statement>, 442, 637 321, 326, 329, 330, 331,
  26283. <preparable statement>, 332, 333, 334, 335, 336,
  26284. 44, 45, 64, 73, 93, 100, 337, 338, 342, 384, 386,
  26285. 101, 115, 415, 417, 419, 389, 392, 394, 398, 420,
  26286. 442, 443, 460, 462, 463, 487, 526, 533, 546, 547,
  26287. 653, 654, 656 548, 568, 600, 601, 602,
  26288. PREPARE, 85, 354, 442, 447,
  26289. 449, 462, 483, 484, 681 603, 604, 605, 632, 633,
  26290. prepared statement not a 655, 660, 669, 677, 678
  26291. cursor specification, <privilege column list>,
  26292. 465, 621 245, 246, 333, 632
  26293. <prepare statement>, 14, privilege dependency graph,
  26294. 44, 45, 54, 60, 61, 63, 335
  26295. 64, 73, 93, 101, 103, privilege descriptor, 44,
  26296. 104, 115, 369, 415, 417, 65, 66, 246, 248, 261,
  26297. 419, 442, 449, 450, 459, 284, 298, 302, 312, 315,
  26298. 464, 465, 484, 653, 654, 316, 321, 329, 330, 331,
  26299. 656 332, 333, 334, 335, 336,
  26300. PRESERVE, 85, 260, 281, 337, 338, 398, 420, 600,
  26301. 397, 681 602, 604
  26302. Index 49
  26303. privilege not granted, 332, PUBLIC, 66, 75, 85, 102,
  26304. 623 245, 246, 248, 315, 321,
  26305. privilege not revoked, 338, 334, 533, 539, 542, 545,
  26306. 623 546, 547, 548, 554, 555,
  26307. Privileges, 64 556, 601, 603, 605
  26308. PRIVILEGES, 85, 245, 246,
  26309. 294, 300, 332, 338, 539, - Q -
  26310. 542, 545, 546, 547, 548, <qualified identifier>, 98,
  26311. 554, 555, 556, 600, 602, 102, 119, 252, 325, 486,
  26312. 604, 605, 640 487
  26313. <privileges>, 245, 329, <qualified join>, 180, 181
  26314. 330, 331, 332, 333, 338, <qualified local table
  26315. 389 name>, 98, 101, 104, 397
  26316. PRIVILEGE_TYPE, 546, 547, <qualified name>, 39, 44,
  26317. 548, 600, 601, 602, 603 73, 98, 99, 101, 102,
  26318. procedure, 47 417, 656
  26319. PROCEDURE, 85, 346 <qualifier>, 121, 125, 191,
  26320. <procedure>, 14, 39, 46, 390, 643
  26321. 47, 48, 49, 55, 56, 61, <quantified comparison
  26322. 63, 65, 67, 71, 72, 74, predicate>, 205, 220,
  26323. 103, 256, 341, 342, 346, 447
  26324. 347, 348, 349, 350, 352, <quantifier>, 220, 221
  26325. 371, 397, 408, 409, 411, <query expression>, 11,
  26326. 413, 460, 463, 493, 494, 15, 37, 38, 40, 75, 119,
  26327. 495, 496, 527, 528, 627, 173, 176, 193, 196, 197,
  26328. 655, 661, 662, 670, 671, 200, 202, 203, 204, 237,
  26329. 673, 674, 675 282, 284, 289, 294, 296,
  26330. <procedure name>, 47, 61, 297, 298, 299, 300, 309,
  26331. 99, 103, 346, 348, 352, 313, 318, 323, 325, 330,
  26332. 493, 494, 661, 671, 673 331, 334, 335, 336, 371,
  26333. Procedures, 47 372, 375, 387, 388, 389,
  26334. Processing methods, 627 390, 392, 396, 444, 446,
  26335. programming languages, 49, 467, 474, 530, 579, 581,
  26336. 243 583, 584, 631, 632, 636,
  26337. PROTECTED, 85 642, 643, 646, 648, 671,
  26338. 677
  26339. Query expressions, 173
  26340. 50 Database Language SQL
  26341. query expression too long RECURSIVE, 85
  26342. for information schema, redundant duplicates, 7
  26343. 299, 623 REF, 85
  26344. <query primary>, 196, 198, <reference column list>,
  26345. 643 274, 275, 280, 289
  26346. <query specification>, 40, referenced columns, 42,
  26347. 102, 118, 191, 192, 193, 271, 275, 276, 292, 336,
  26348. 194, 195, 196, 197, 200, 337
  26349. 203, 204, 282, 296, 299, referenced table, 42, 43,
  26350. 325, 382, 384, 390, 391, 271, 274, 275, 276, 277,
  26351. 442, 460, 472, 474, 631, 278, 279, 280, 289, 292
  26352. 632, 643, 646, 648, 670 <referenced table and
  26353. <query term>, 196, 199, columns>, 42, 271, 274,
  26354. 202, 643 275, 276, 289
  26355. <question mark>, 63, 80, Reference Model of Data
  26356. 114 Management, 1
  26357. <quote>, 79, 80, 83, 87, REFERENCES, 65, 66, 85,
  26358. 89, 90, 91, 92, 93, 97, 245, 246, 261, 274, 276,
  26359. 314, 320 282, 284, 289, 298, 302,
  26360. <quote symbol>, 87, 89, 93 326, 329, 330, 331, 332,
  26361. - R - 333, 336, 337, 398, 569,
  26362. READ, 68, 69, 85, 371, 372, 571, 573, 574, 576, 580,
  26363. 399, 400, 681 583, 584, 585, 588, 591,
  26364. read-only, 38, 40, 50, 67, 595, 596, 598, 600, 601,
  26365. 70, 182, 296, 350, 372, 602, 603, 604, 605, 606,
  26366. 384, 386, 388, 389, 392, 608, 610, 611, 633
  26367. 394, 400, 528 <references specification>,
  26368. READ ONLY, 372, 400 262, 264, 274, 280, 633
  26369. read-write, 67, 70, 350, REFERENCING, 85
  26370. 400, 528 referencing columns, 42,
  26371. READ WRITE, 399, 400 271, 274, 275, 276, 588
  26372. REAL, 19, 27, 34, 85, 108, <referencing columns>, 42,
  26373. 110, 352, 357, 358, 359, 271, 274, 275, 276
  26374. 360, 361, 366, 425, 426, referencing table, 42, 43,
  26375. 429, 440, 500, 502, 507, 274, 275, 276, 277
  26376. 512, 513, 515, 516, 517, <referential action>, 274,
  26377. 519, 571, 657, 658 276, 278, 279, 591, 592
  26378. Index 51
  26379. referential constraint, 41, Remote Database Access, 3,
  26380. 42 622
  26381. <referential constraint REPEATABLE, 68, 69, 84, 399
  26382. definition>, 42, 45, repertoire, 5, 7, 20, 21,
  26383. 270, 271, 274, 276, 280, 23, 24, 35, 46, 74, 76,
  26384. 645 85, 86, 92, 93, 100,
  26385. <referential triggered 109, 111, 129, 133, 134,
  26386. action>, 265, 274, 280, 135, 136, 145, 147, 148,
  26387. 633, 645 149, 150, 151, 160, 208,
  26388. REFERENTIAL_CONSTRAINTS, 237, 248, 249, 250, 266,
  26389. 550, 559, 586, 590, 617, 311, 312, 315, 316, 506,
  26390. 640 607, 660, 669, 674
  26391. REFERENTIAL_CONSTRAINTS REPLACE, 85
  26392. base table, 590 requires, 6, 42, 71, 583
  26393. REFERENTIAL_CONSTRAINTS reserved, 61, 73, 83, 84,
  26394. view, 550 85, 87, 100, 408, 411,
  26395. REFERENTIAL_CONSTRAINTS_ 448, 466, 619, 626, 655,
  26396. CONSTRAINT_TYPE_CHECK, 678
  26397. 590 <reserved word>, 83, 84,
  26398. REFERENTIAL_CONSTRAINTS_ 85, 87, 100, 626, 678
  26399. PRIMARY_KEY, 590 RESIGNAL, 85
  26400. REFERENTIAL_DELETE_RULE_ RESTRICT, 85, 258, 289,
  26401. CHECK, 590 292, 294, 300, 309, 337,
  26402. REFERENTIAL_DELETE_RULE_ 354, 681
  26403. NOT_NULL, 590 restricted data type
  26404. REFERENTIAL_MATCH_OPTION_ attribute violation,
  26405. CHECK, 590 456, 458, 621
  26406. REFERENTIAL_MATCH_OPTION_ <result>, 141, 142, 143
  26407. NOT_NULL, 590 <result expression>, 141,
  26408. REFERENTIAL_UPDATE_RULE_ 142
  26409. CHECK, 590 <result using clause>, 451,
  26410. REFERENTIAL_UPDATE_RULE_ 456, 457, 459, 460, 638
  26411. NOT_NULL, 590 Retrieval assignment, 231
  26412. <regular identifier>, 82, RETURN, 85
  26413. 86, 87, 88, 98, 533, RETURNED_LENGTH, 84, 427,
  26414. 534, 629 434, 436, 438, 458
  26415. RELATIVE, 85, 377, 378, RETURNED_OCTET_LENGTH, 84,
  26416. 379, 681 427, 434, 436, 438, 458
  26417. 52 Database Language SQL
  26418. RETURNED_SQLSTATE, 84, 479, <row value constructor 2>,
  26419. 481, 485, 486, 487, 488 227, 228
  26420. RETURNS, 85 <row value constructor>,
  26421. REVOKE, 85, 289, 294, 300, 36, 156, 173, 174, 175,
  26422. 310, 313, 318, 323, 333, 176, 207, 211, 212, 218,
  26423. 355, 484, 681 219, 220, 224, 227, 390,
  26424. <revoke statement>, 52, 444, 446, 447, 631, 642,
  26425. 245, 289, 294, 300, 310, 644, 648, 669
  26426. 313, 318, 323, 333, 339, <row value constructor
  26427. 368, 484, 646 element>, 173, 174, 175,
  26428. RIGHT, 85, 180, 182, 184, 390, 444, 446, 631, 642
  26429. 353, 356, 681 <row value constructor
  26430. <right bracket>, 79, 81, list>, 173, 174, 176,
  26431. 83, 504, 517 390, 669
  26432. <right paren>, 16, 79, 80, ROW_COUNT, 84, 479, 481,
  26433. 107, 108, 118, 124, 128, 484, 485, 673
  26434. 132, 133, 139, 141, 144, Rule evaluation order, 12
  26435. 155, 168, 173, 180, 196, Rules determining collating
  26436. 203, 212, 229, 239, 245, sequence usage, 23
  26437. 260, 272, 274, 281, 296, - S -
  26438. 297, 314, 320, 325, 346, SAVEPOINT, 85
  26439. 388, 390, 489, 491, 500, Scalar expressions, 107
  26440. 508, 515, 520 <scalar subquery>, 155,
  26441. ROLE, 85 156, 203, 642
  26442. ROLLBACK, 68, 70, 85, 355, <scalar subquery>, <row
  26443. 405, 484 subquery>, and <table
  26444. <rollback statement>, 41, subquery>, 203
  26445. 50, 54, 67, 69, 70, 342, SCALE, 84, 425, 426, 427,
  26446. 369, 405, 484, 526, 655, 434, 436, 439, 440, 441,
  26447. 671, 674 453, 454, 455, 456, 457,
  26448. ROUTINE, 85 539, 544, 570, 571, 572,
  26449. ROW, 85 663
  26450. ROWS, 85, 260, 275, 281, <scale>, 63, 107, 108, 109,
  26451. 397, 681 110, 358, 361, 515, 516,
  26452. <row subquery>, 173, 174, 520, 522, 658
  26453. 203 SCHEMA, 85, 255, 258, 341,
  26454. <row value constructor 1>, 417, 483, 484, 535, 567
  26455. 227, 228
  26456. Index 53
  26457. <schema authorization SCHEMATA, 538, 541, 543,
  26458. identifier>, 65, 255, 544, 549, 550, 551, 552,
  26459. 256 553, 557, 558, 559, 561,
  26460. <schema character set name> 562, 569, 571, 573, 574,
  26461. , 311 576, 580, 583, 584, 585,
  26462. <schema character set 586, 591, 595, 596, 598,
  26463. specification>, 93, 606, 608, 610, 611, 640
  26464. 100, 255, 256, 257, 263, SCHEMATA base table, 569
  26465. 644, 660 SCHEMATA view, 538
  26466. <schema collation name>, SCHEMATA_FOREIGN_KEY, 569
  26467. 314, 315 SCHEMATA_PRIMARY_KEY, 569
  26468. <schema definition>, 44, <schema translation name>,
  26469. 52, 65, 93, 100, 101, 320, 321
  26470. 252, 255, 256, 260, 261, SCHEMA_NAME, 84, 354, 480,
  26471. 263, 296, 301, 311, 315, 481, 486, 487, 538, 541,
  26472. 320, 325, 368, 484, 566, 543, 544, 549, 550, 551,
  26473. 568, 660 552, 553, 557, 558, 559,
  26474. Schema definition and 561, 562, 569
  26475. manipulation, 255 SCHEMA_OWNER, 538, 541,
  26476. <schema element>, 255, 256, 543, 544, 549, 550, 551,
  26477. 632, 644 552, 553, 557, 558, 559,
  26478. <schema name>, 15, 39, 44, 561, 562, 569
  26479. 45, 46, 64, 72, 73, 98, SCHEMA_OWNER_NOT_NULL, 569
  26480. 99, 101, 102, 103, 104, scope, 1, 10, 14, 39, 62,
  26481. 249, 252, 255, 256, 257, 63, 70, 99, 102, 103,
  26482. 258, 260, 263, 283, 294, 104, 118, 119, 121, 122,
  26483. 296, 297, 300, 301, 302, 125, 260, 283, 356, 386,
  26484. 304, 309, 311, 312, 313, 392, 394, 397, 431, 433,
  26485. 315, 316, 318, 320, 321, 447, 449, 450, 451, 459,
  26486. 323, 325, 326, 328, 341, 465, 466, 467, 475, 492,
  26487. 397, 398, 415, 417, 486, 501, 669
  26488. 487, 493, 616, 644, 654, Scope, 1
  26489. 656, 657, 661, 668, 669 scope clause, 118, 119,
  26490. <schema name clause>, 101, 431, 433
  26491. 255, 257, 644, 657 <scope option>, 99, 102,
  26492. 104, 431, 433, 447, 451
  26493. 54 Database Language SQL
  26494. SCROLL, 85, 371, 372, 374, SELECT, 65, 66, 75, 85,
  26495. 377, 464, 465, 469, 635, 119, 122, 180, 182, 183,
  26496. 638, 647, 681 184, 191, 197, 198, 245,
  26497. SEARCH, 85 261, 271, 272, 273, 276,
  26498. <search condition>, 15, 36, 284, 289, 298, 303, 329,
  26499. 42, 43, 68, 119, 122, 330, 334, 335, 336, 382,
  26500. 141, 142, 143, 180, 181, 398, 483, 484, 485, 533,
  26501. 183, 185, 186, 187, 189, 537, 538, 539, 541, 542,
  26502. 190, 229, 230, 264, 271, 543, 544, 545, 546, 547,
  26503. 272, 281, 282, 284, 289, 548, 549, 550, 551, 552,
  26504. 294, 300, 301, 302, 307, 553, 554, 555, 556, 557,
  26505. 309, 313, 318, 323, 325, 558, 559, 561, 562, 563,
  26506. 326, 330, 337, 386, 387, 571, 572, 573, 576, 578,
  26507. 394, 395, 396, 485, 593, 580, 581, 583, 584, 585,
  26508. 594, 595, 596, 633, 636, 586, 588, 591, 593, 595,
  26509. 643, 677, 678 596, 600, 601, 602, 603,
  26510. search condition too long 604, 606, 608, 610, 611,
  26511. for information schema, 616, 617, 618, 677
  26512. 282, 326, 623 <select list>, 75, 118,
  26513. <searched case>, 141, 142 119, 124, 181, 182, 185,
  26514. <searched when clause>, 191, 192, 193, 194, 195,
  26515. 141, 142, 143 198, 382, 436, 443, 450,
  26516. SECOND, 30, 31, 32, 33, 85,
  26517. 95, 111, 112, 113, 129, 451, 457, 460, 632, 672
  26518. 238, 239, 240, 241, 242, <select statement: single
  26519. 430, 441, 445, 659, 681 row>, 53, 55, 57, 58,
  26520. <seconds fraction>, 91, 94, 59, 102, 118, 119, 350,
  26521. 95, 96, 242, 629 368, 382, 484, 672, 677
  26522. <seconds integer value>, <select sublist>, 191, 195,
  26523. 91, 95, 242 643
  26524. <seconds value>, 91, 94 <select target list>, 382,
  26525. SECTION, 85, 490 383, 671, 672
  26526. <semicolon>, 80, 346, 489,
  26527. 491, 504, 515, 517, 520,
  26528. 525
  26529. SENSITIVE, 85
  26530. Index 55
  26531. <separator>, 82, 83, 86, set, 3, 5, 6, 7, 11, 19,
  26532. 89, 92, 93, 100, 491, 20, 21, 22, 23, 30, 32,
  26533. 512 35, 36, 37, 38, 41, 44,
  26534. sequence, 5, 7, 9, 12, 20, 45, 46, 47, 48, 52, 54,
  26535. 21, 22, 23, 24, 25, 26, 60, 62, 64, 65, 66, 67,
  26536. 32, 35, 37, 47, 67, 69, 68, 70, 71, 72, 73, 74,
  26537. 72, 92, 95, 97, 104, 80, 85, 86, 87, 89, 92,
  26538. 115, 122, 125, 133, 134, 93, 97, 98, 99, 100,
  26539. 145, 155, 161, 187, 191, 102, 103, 104, 105, 107,
  26540. 207, 208, 214, 215, 216, 108, 109, 115, 124, 126,
  26541. 220, 224, 237, 249, 250, 127, 133, 134, 136, 142,
  26542. 251, 264, 297, 314, 315, 153, 155, 173, 176, 178,
  26543. 316, 317, 318, 372, 388, 181, 183, 184, 185, 186,
  26544. 497, 501, 506, 509, 521, 187, 189, 190, 191, 192,
  26545. 660, 661 193, 194, 195, 197, 198,
  26546. SEQUENCE, 85 199, 200, 201, 202, 208,
  26547. SERIALIZABLE, 68, 69, 84, 222, 231, 232, 233, 234,
  26548. 350, 399, 528 235, 237, 238, 246, 248,
  26549. serialization failure, 69, 249, 250, 253, 255, 256,
  26550. 622 257, 258, 259, 261, 263,
  26551. SERVER_NAME, 84, 479, 481,
  26552. 488 267, 273, 275, 278, 279,
  26553. SESSION, 85, 420, 484, 682 281, 286, 287, 298, 301,
  26554. Session management, 415 302, 304, 305, 306, 311,
  26555. SESSION_USER, 85, 114, 115, 312, 313, 314, 315, 316,
  26556. 116, 117, 266, 267, 268, 317, 318, 320, 321, 323,
  26557. 269, 282, 325, 375, 530, 329, 330, 331, 332, 333,
  26558. 641, 645, 658, 682 334, 335, 336, 337, 338,
  26559. 344, 345, 348, 349, 350,
  26560. 351, 362, 363, 364, 365,
  26561. 366, 367, 368, 369, 382,
  26562. 391, 392, 393, 394, 395,
  26563. 396, 398, 399, 400, 401,
  26564. 402, 403, 409, 410, 411,
  26565. 415, 417, 418, 419, 420,
  26566. 421, 422, 423, 426, 427,
  26567. 428, 436, 438, 439, 440,
  26568. 441, 444, 447, 450, 452,
  26569. 453, 454, 455, 456, 457,
  26570. 458, 474, 475, 477, 482,
  26571. 483, 484, 488, 489, 490,
  26572. 56 Database Language SQL 492, 493, 495, 496, 500,
  26573. 501, 503, 504, 506, 507,
  26574. 508, 510, 511, 512, 513,
  26575. 514, 516, 517, 518, 519,
  26576. 520, 521, 523, 527, 528,
  26577. 554, 569, 605, 606, 607,
  26578. 609, 611, 619, 625, 629,
  26579. 630, 632, 633, 635, 636,
  26580. 637, 639, 641, 644, 645,
  26581. 646, 647, 648, 649, 651,
  26582. 653, 654, 656, 657, 658,
  26583. 660, 661, 662, 663, 664,
  26584. 665, 670, 672, 673, 674,
  26585. 678
  26586. SET, 85, 107, 108, 113, <set domain default clause>
  26587. 248, 255, 259, 274, 278, , 304, 305, 633
  26588. 279, 287, 305, 311, 313, <set function specifica-
  26589. 329, 349, 391, 394, 399, tion>, 11, 124, 127,
  26590. 401, 403, 410, 415, 417, 155, 181, 185, 186, 189,
  26591. 419, 420, 422, 438, 474, 190, 192, 193, 194, 195,
  26592. 477, 482, 484, 500, 501, 281, 392, 394, 444, 474,
  26593. 504, 505, 506, 508, 509, 632, 641, 678
  26594. 512, 513, 517, 518, 520, <set function type>, 124
  26595. 521, 527, 564, 590, 591, <set item information>,
  26596. 592, 604, 640, 658 438, 439
  26597. <set catalog statement>, <set local time zone
  26598. 45, 54, 64, 73, 369, statement>, 54, 73,
  26599. 415, 447, 484, 635, 636, 369, 422, 423, 447, 484,
  26600. 637, 639 649, 651
  26601. <set clause>, 391, 392, <set names statement>, 54,
  26602. 393, 394, 395, 447, 474, 64, 73, 369, 419, 447,
  26603. 475, 636 484, 635, 637, 639
  26604. <set clause list>, 391, Set operation result data
  26605. 392, 394, 396, 474, 477 types, 237
  26606. <set column default clause> <set quantifier>, 124, 191,
  26607. , 286, 287, 645 193, 194, 195, 382
  26608. <set connection statement>, <set schema statement>, 44,
  26609. 54, 71, 72, 74, 349, 54, 64, 73, 369, 417,
  26610. 369, 410, 411, 484, 488, 418, 447, 484, 635, 637,
  26611. 527, 636 639, 653
  26612. <set constraints mode <set session authorization
  26613. statement>, 41, 54, identifier statement>,
  26614. 253, 369, 401, 402, 484, 54, 65, 369, 420, 421,
  26615. 635, 636, 637, 639 447, 484, 647, 649, 651
  26616. <set count>, 438 <set time zone value>, 422
  26617. <set descriptor informa- <set transaction statement>
  26618. tion>, 438 , 48, 54, 67, 68, 349,
  26619. <set descriptor statement>, 350, 369, 399, 400, 484,
  26620. 54, 60, 62, 369, 438, 528, 647, 648
  26621. 439, 441, 484, 672 <sign>, 90, 91, 95, 157,
  26622. 168, 169
  26623. SIGNAL, 85
  26624. Index 57
  26625. <signed integer>, 90 <simple value specifica-
  26626. <signed numeric literal>, tion>, 62, 71, 99, 102,
  26627. 89, 90, 95, 146, 147, 114, 116, 167, 347, 377,
  26628. 267 378, 399, 408, 425, 426,
  26629. significant, 27, 28, 31, 431, 433, 434, 438, 442,
  26630. 33, 34, 146, 149, 151, 443, 447, 451, 465, 480,
  26631. 154, 158, 166, 169, 170, 657
  26632. 171, 209, 238, 240, 241, <simple when clause>, 141
  26633. 242, 267, 363, 512, 518, simply contain, 11, 24, 36,
  26634. 653 119, 124, 156, 158, 162,
  26635. SIMILAR, 85 163, 165, 166, 167, 168,
  26636. <simple case>, 141, 142 169, 173, 174, 175, 191,
  26637. <simple Latin letter>, 22, 192, 193, 197, 201, 267,
  26638. 79, 98 372, 375, 443, 444, 446,
  26639. <simple Latin lower case 467, 579, 631, 642
  26640. letter>, 79, 81, 87, 88, simply underlying table,
  26641. 135, 136, 640 38, 193, 200, 299, 372,
  26642. <simple Latin upper case 384, 391, 472, 474
  26643. letter>, 79, 81, 87, <single datetime field>,
  26644. 135, 136, 619, 666 239, 240, 241, 242
  26645. <simple table>, 196, 197, SIZE, 85, 399, 682
  26646. 200, 201, 202, 632, 670 SMALLINT, 19, 27, 34, 85,
  26647. <simple target specifi- 108, 110, 352, 356, 357,
  26648. cation 1>, 434, 435, 358, 359, 361, 362, 425,
  26649. 672 426, 429, 440, 500, 502,
  26650. <simple target specifi- 507, 510, 522, 571, 657,
  26651. cation 2>, 434, 435, 662
  26652. 672 <solidus>, 80, 157, 158,
  26653. <simple target specifica- 168
  26654. tion>, 114, 116, 347, SOME, 85, 220
  26655. 425, 426, 434, 435, 447, <some>, 220, 221
  26656. 479, 480, 482, 485 <sort key>, 371
  26657. <simple value specification <sort specification>, 371,
  26658. 1>, 438 372, 373, 530, 531, 675
  26659. <simple value specification <sort specification list>,
  26660. 2>, 438, 439 371
  26661. 58 Database Language SQL
  26662. <source character set specifies, 1, 8, 9, 17, 20,
  26663. specification>, 320, 22, 28, 30, 32, 34, 35,
  26664. 335 36, 38, 41, 47, 49, 50,
  26665. SOURCE_CHARACTER_SET_ 62, 63, 65, 66, 67, 68,
  26666. CATALOG, 556, 610, 611 72, 87, 94, 100, 108,
  26667. SOURCE_CHARACTER_SET_NAME, 109, 110, 112, 115, 116,
  26668. 556, 610, 611 126, 142, 145, 168, 169,
  26669. SOURCE_CHARACTER_SET_SCHEMA 189, 192, 193, 197, 218,
  26670. , 556, 610, 611 238, 240, 241, 242, 243,
  26671. SPACE, 21, 35, 85, 249, 245, 246, 249, 263, 264,
  26672. 250, 314, 315, 608, 609, 265, 268, 272, 273, 275,
  26673. 660, 682 276, 277, 278, 279, 281,
  26674. <space>, 20, 35, 62, 71,
  26675. 79, 80, 83, 86, 90, 91, 282, 284, 301, 302, 315,
  26676. 136, 146, 147, 148, 149, 316, 321, 326, 329, 330,
  26677. 151, 163, 208, 216, 232, 333, 342, 344, 347, 352,
  26678. 234, 235, 268, 363, 364, 356, 357, 358, 359, 360,
  26679. 365, 366, 367, 486, 487, 361, 362, 363, 364, 365,
  26680. 488, 491, 512 366, 367, 371, 373, 376,
  26681. spans, 72, 299 378, 379, 382, 388, 393,
  26682. Specification of syntactic 395, 403, 408, 428, 429,
  26683. elements, 9 446, 449, 452, 454, 464,
  26684. Specification of the 482, 492, 493, 494, 495,
  26685. Information Schema, 496, 497, 499, 501, 502,
  26686. 10 506, 507, 510, 513, 514,
  26687. 516, 518, 519, 522, 526,
  26688. 531, 564, 619, 624, 625,
  26689. 626, 630, 632, 638, 641,
  26690. 644, 648, 659, 661, 668,
  26691. 669, 685
  26692. SQL, 85, 489
  26693. Index 59
  26694. SQL-agent, 48, 66, 68, 70, SQL-data, 1, 10, 12, 31,
  26695. 71, 72, 74, 96, 342, 35, 40, 43, 45, 46, 50,
  26696. 343, 348, 349, 350, 352, 51, 52, 53, 55, 56, 57,
  26697. 399, 400, 401, 403, 405, 58, 59, 60, 67, 68, 69,
  26698. 408, 409, 410, 411, 412, 70, 231, 234, 281, 351,
  26699. 413, 526, 527, 528, 646, 379, 382, 403, 404, 405,
  26700. 654, 656, 661, 668, 669, 528, 655, 662, 668
  26701. 670, 671, 672 <SQL data change statement>
  26702. SQL-agents, 66 , 368, 369
  26703. SQL-client, 70, 71, 74, <SQL data statement>, 350,
  26704. 409, 656, 669 368
  26705. SQL-client unable to SQL descriptor area, 62,
  26706. establish SQL-connection 64, 104, 431, 432, 433,
  26707. , 409, 620 434, 435, 436, 438, 439,
  26708. SQLCODE, 47, 48, 49, 85, 451, 453, 457, 458, 460,
  26709. 346, 347, 352, 356, 357, 469, 470, 663, 667
  26710. 358, 359, 360, 361, 482, <sql diagnostics
  26711. 485, 492, 494, 495, 496, information>, 479
  26712. 500, 502, 507, 510, 514, <SQL diagnostics statement>
  26713. 516, 519, 522, 624, 654, , 48, 74, 349, 351, 368,
  26714. 661, 662, 664, 665, 666, 369, 647
  26715. 668, 675 <SQL dynamic data
  26716. SQLCODE values, 624 statement>, 67, 350,
  26717. <SQL conformance>, 16, 17 369, 655
  26718. SQL-connection, 52, 54, 55, <SQL dynamic statement>,
  26719. 57, 58, 60, 70, 71, 72, 104, 368, 369, 451, 635,
  26720. 104, 407, 408, 409, 410, 647
  26721. 411, 412, 413, 662, 672 SQL dynamic statements, 61
  26722. SQL-connections, 70 <SQL edition>, 16, 17
  26723. <SQL connection statement>, <SQL embedded language
  26724. 74, 348, 349, 368, 369, character>, 79
  26725. 488, 525, 526, 527, 635, SQL-environment, 45, 46,
  26726. 640 70, 71, 72, 74, 75, 344,
  26727. 654, 655, 663
  26728. SQLERROR, 85, 497, 499
  26729. SQLEXCEPTION, 85
  26730. SQL Flagger, 76, 77, 626
  26731. 60 Database Language SQL
  26732. SQL-implementation, 1, 6, <SQL-server name>, 70, 71,
  26733. 7, 16, 45, 46, 48, 71, 99, 103, 407, 408, 409,
  26734. 74, 76, 77, 350, 352, 488, 655, 663
  26735. 528, 563, 616, 625, 656, SQL-server rejected
  26736. 662 establishment of SQL-
  26737. <SQL language character>, connection, 409, 620
  26738. 20, 46, 79, 86, 92, 93, SQL-session, 7, 31, 38, 39,
  26739. 100, 147, 148, 149, 150, 44, 45, 46, 51, 52, 54,
  26740. 151, 344, 492, 658, 661 55, 56, 58, 60, 62, 63,
  26741. <SQL language identifier>, 65, 69, 71, 72, 73, 74,
  26742. 98, 99, 100 93, 94, 96, 100, 101,
  26743. <SQL language identifier 103, 104, 112, 115, 116,
  26744. part>, 98, 100 122, 139, 153, 167, 256,
  26745. <SQL language identifier 309, 342, 343, 348, 349,
  26746. start>, 98, 100 350, 397, 398, 401, 408,
  26747. <SQL object identifier>, 16 409, 410, 411, 413, 415,
  26748. <SQL prefix>, 489, 490, 491 417, 419, 420, 421, 422,
  26749. <SQL procedure statement>,
  26750. 47, 55, 56, 74, 346, 440, 487, 526, 527, 528,
  26751. 347, 348, 368, 370, 489, 653, 654, 655, 656, 663,
  26752. 494, 495, 496, 497, 499, 668, 669
  26753. 526, 635, 647, 656, 673, SQL-sessions, 72
  26754. 674 <SQL session statement>,
  26755. <SQL provenance>, 16 368, 369, 442, 525, 635,
  26756. SQL-schema, 44 639, 647, 651
  26757. <SQL schema definition <SQL special character>,
  26758. statement>, 368, 370 79, 83
  26759. <SQL schema manipulation SQLSTATE, 47, 48, 49, 75,
  26760. statement>, 368 84, 85, 253, 346, 347,
  26761. SQL-schemas, 44 352, 353, 354, 355, 356,
  26762. <SQL schema statement>, 44, 357, 358, 359, 360, 361,
  26763. 350, 368, 442, 525, 528, 481, 482, 485, 486, 487,
  26764. 529, 533, 635, 639, 647, 488, 492, 494, 495, 496,
  26765. 651 500, 502, 507, 510, 513,
  26766. SQL-server, 70, 71, 72, 74, 514, 516, 519, 522, 619,
  26767. 99, 103, 407, 408, 409, 624, 665, 668, 682
  26768. 410, 411, 488, 655, 662, SQLSTATE class and subclass
  26769. 663, 669 values, 619
  26770. Index 61
  26771. SQL-statement, 1, 10, 12, SQL-transaction, 7, 41, 45,
  26772. 14, 41, 45, 48, 50, 51, 49, 50, 52, 54, 55, 56,
  26773. 52, 55, 56, 57, 58, 59, 58, 60, 67, 68, 69, 70,
  26774. 60, 61, 63, 64, 65, 66, 71, 75, 76, 349, 350,
  26775. 67, 68, 69, 71, 72, 116, 384, 386, 389, 392, 394,
  26776. 139, 140, 174, 192, 197, 399, 400, 401, 403, 404,
  26777. 199, 200, 253, 256, 277, 405, 407, 410, 420, 448,
  26778. 279, 280, 342, 349, 368, 527, 528, 654, 655, 662,
  26779. 407, 410, 449, 482, 484, 668, 672, 677
  26780. 485, 486, 492, 497, 526, SQL-transaction isolation
  26781. 533, 654, 658, 667, 668, levels and the three
  26782. 669, 673, 674 phenomena, 68
  26783. SQL-statement character SQL-transactions, 67
  26784. codes for use in the <SQL transaction statement>
  26785. diagnostics area, 482 , 368, 369, 442, 525,
  26786. <SQL statement name>, 14, 635, 639, 647
  26787. 59, 99, 105, 442, 447, <SQL variant>, 16
  26788. 448, 449, 450, 459, 640 SQLWARNING, 85
  26789. SQL-statements, 51 SQL_IDENTIFIER, 536, 564,
  26790. SQL-statements and 568, 569, 570, 573, 574,
  26791. transaction states, 576, 578, 580, 583, 584,
  26792. 59 585, 588, 590, 593, 595,
  26793. SQL-statements classified 596, 598, 600, 602, 604,
  26794. by function, 52 606, 608, 610
  26795. <SQL statement variable>, SQL_IDENTIFIER domain, 564
  26796. 14, 59, 442, 443, 462 SQL_LANGUAGES, 563, 612,
  26797. <SQL terminal character>, 640
  26798. 79 SQL_LANGUAGES base table,
  26799. <SQL terminator>, 489, 490, 612
  26800. 491 SQL_LANGUAGES view, 563
  26801. SQL_LANGUAGES_SOURCE_NOT_
  26802. NULL, 612
  26803. SQL_LANGUAGES_STANDARD_
  26804. VALID_CHECK, 612
  26805. SQL_LANGUAGE_BINDING_STYLE,
  26806. 563, 612, 613, 614
  26807. SQL_LANGUAGE_CONFORMANCE,
  26808. 563, 612, 613, 614
  26809. 62 Database Language SQL
  26810. SQL_LANGUAGE_IMPLEMENTATION <statement information item
  26811. , 563, 612, 614, 665 name>, 479, 480, 481
  26812. SQL_LANGUAGE_INTEGRITY, <statement name>, 62, 99,
  26813. 563, 612, 613, 614 103, 448, 449, 450, 459,
  26814. SQL_LANGUAGE_PROGRAMMING_ 464, 467, 672
  26815. LANGUAGE, 563, 612, 613, <statement or declaration>,
  26816. 614, 615 489
  26817. SQL_LANGUAGE_SOURCE, 563, Status codes, 619
  26818. 612, 613, 614, 665 status parameter, 47
  26819. SQL_LANGUAGE_YEAR, 563, <status parameter>, 346,
  26820. 612, 613 347
  26821. SQL_TEXT, 20, 30, 87, 100, Status parameters, 47
  26822. 109, 115, 248, 267, 427, Store assignment, 234
  26823. 428, 564, 607, 609, 658, string data, length
  26824. 665 mismatch, 235, 620
  26825. <standard character string data, right
  26826. repertoire name>, 248, truncation, 147, 148,
  26827. 249, 311, 660 149, 150, 151, 152, 163,
  26828. <standard collation name>, 232, 234, 235, 621, 623
  26829. 314, 315, 317, 661 <string length>, 132, 133,
  26830. Standard programming 135, 137
  26831. languages, 49, 243 <string value expression>,
  26832. <standard translation name> 128, 130, 131, 135, 155,
  26833. , 320, 321, 661 160, 533
  26834. <standard universal <string value function>,
  26835. character form-of-use 132, 160, 161
  26836. name>, 248, 249, 660 STRUCTURE, 85
  26837. <start field>, 171, 238, structured collection, 14
  26838. 239, 240, 241, 242 SUBCLASS_ORIGIN, 84, 479,
  26839. <start position>, 132, 133, 481, 485, 663
  26840. 135, 137 <subquery>, 11, 102, 119,
  26841. statement completion 124, 125, 156, 185, 189,
  26842. unknown, 71, 622 190, 191, 192, 195, 203,
  26843. <statement information>, 204, 281, 282, 296, 386,
  26844. 479 395, 631, 632, 633, 635,
  26845. <statement information 636, 638, 643, 678
  26846. item>, 479, 480, 482
  26847. Index 63
  26848. SUBSTRING, 22, 85, 132, Syntax Rules, 9, 10, 12,
  26849. 133, 149, 151, 353, 362, 13, 14, 15, 64, 77, 82,
  26850. 363, 364, 366, 445, 682 89, 139, 162, 208, 237,
  26851. substring error, 135, 137, 270, 284, 302, 342, 347,
  26852. 621 371, 377, 382, 388, 392,
  26853. successful completion, 47, 394, 407, 408, 415, 417,
  26854. 351, 622, 624 419, 420, 431, 435, 439,
  26855. SUM, 85, 124, 125, 126, 659 442, 443, 447, 456, 458,
  26856. Syntactic containment, 11 459, 462, 465, 469, 475,
  26857. syntactic element, 11, 12,
  26858. 13, 72 476, 477, 495, 496, 497,
  26859. Syntactic substitution, 13 500, 501, 504, 505, 506,
  26860. syntax error or access rule 508, 509, 512, 513, 515,
  26861. violation, 12, 13, 486, 517, 518, 520, 521, 525,
  26862. 487, 622 526, 530, 625, 663, 665,
  26863. syntax error or access rule 667, 677, 678
  26864. violation in direct SQL _SYSTEM, 66, 248, 261, 289,
  26865. statement, 12, 486, 487, 290, 294, 298, 300, 302,
  26866. 526, 622 310, 312, 313, 316, 318,
  26867. syntax error or access rule 321, 323, 330, 331, 332,
  26868. violation in dynamic SQL 334, 335, 336, 398
  26869. statement, 12, 443, 462, <system descriptor
  26870. 486, 487, 622 statement>, 369
  26871. SYSTEM_USER, 85, 114, 115,
  26872. 116, 117, 192, 266, 267,
  26873. 268, 269, 282, 325, 375,
  26874. 530, 641, 645, 658, 682
  26875. - T -
  26876. table, 37
  26877. 64 Database Language SQL
  26878. TABLE, 85, 196, 197, 258, <table expression>, 119,
  26879. 260, 283, 292, 294, 329, 122, 125, 177, 191, 192,
  26880. 332, 338, 397, 398, 482, 193, 195, 203, 382, 383,
  26881. 483, 484, 568, 569, 570, 631, 632, 635, 643, 677
  26882. 573, 574, 576, 577, 578, <table name>, 11, 44, 98,
  26883. 580, 583, 584, 585, 588, 101, 103, 118, 119, 121,
  26884. 590, 593, 595, 596, 598, 122, 179, 193, 196, 197,
  26885. 600, 602, 604, 606, 608, 200, 245, 258, 260, 261,
  26886. 610, 612, 646 263, 272, 274, 282, 283,
  26887. table check constraint, 41, 289, 291, 292, 294, 296,
  26888. 43 297, 298, 299, 300, 326,
  26889. table constraint, 41, 42 329, 330, 331, 333, 334,
  26890. <table constraint>, 264, 335, 338, 384, 386, 388,
  26891. 270, 271, 309, 487 389, 391, 392, 394, 395,
  26892. <table constraint 459, 472, 474, 475, 476,
  26893. definition>, 260, 263, 477, 485, 492, 631, 635,
  26894. 264, 270, 291, 309, 310, 636, 638
  26895. 586 table privilege descriptor,
  26896. table constraint descriptor 66
  26897. , 40, 41, 42, 270, 271, <table reference>, 118,
  26898. 275, 289, 291, 336, 338 119, 120, 121, 122, 125,
  26899. Table constraints, 41 178, 179, 180, 192, 193,
  26900. <table definition>, 37, 38, 197, 199, 200, 281, 296,
  26901. 52, 255, 260, 261, 262, 298, 331, 630, 631, 641
  26902. 263, 265, 272, 274, 281, Tables, 37
  26903. 284, 368, 484, 566 TABLES, 542, 543, 576, 578,
  26904. table descriptor, 15, 39, 580, 583, 585, 586, 595,
  26905. 40, 44, 75, 260, 261, 600, 640
  26906. 265, 273, 275, 283, 289, TABLES base table, 576
  26907. 291, 292, 296, 309, 326, <table subquery>, 118, 119,
  26908. 375, 576, 581 203, 212, 220, 222, 223,
  26909. <table element>, 260, 261 224, 225, 446, 447
  26910. <table element list>, 260, TABLES view, 542
  26911. 397 TABLES_CHECK_NOT_VIEW, 576
  26912. TABLES_FOREIGN_KEY_SCHEMATA
  26913. , 576
  26914. TABLES_PRIMARY_KEY, 576
  26915. TABLES_TYPE_CHECK, 576
  26916. Index 65
  26917. <table value constructor>, TABLE_CONSTRAINTS_TABLE_
  26918. 175, 176, 196, 197, 200, SCHEMA_NOT_NULL, 585
  26919. 202, 212, 390, 444, 446, TABLE_CONSTRAINTS_UNIQUE_
  26920. 631, 632, 642, 648 CHECK, 586
  26921. <table value constructor TABLE_NAME, 84, 480, 481,
  26922. list>, 176 486, 487, 542, 543, 544,
  26923. TABLE_CATALOG, 542, 543, 545, 546, 547, 549, 552,
  26924. 544, 545, 546, 547, 549, 557, 558, 559, 561, 562,
  26925. 552, 557, 558, 559, 561, 572, 576, 578, 580, 581,
  26926. 562, 572, 576, 578, 580, 583, 584, 585, 586, 587,
  26927. 581, 583, 584, 585, 586, 588, 589, 595, 596, 597,
  26928. 587, 588, 589, 591, 595, 600, 601, 602, 603
  26929. 596, 597, 600, 601, 602, TABLE_OR_DOMAIN_CATALOG,
  26930. 603 539, 545, 570, 571, 572,
  26931. TABLE_CONSTRAINTS, 549, 573, 581
  26932. 559, 561, 585, 586, 588, TABLE_OR_DOMAIN_CHECK_
  26933. 590, 591, 593, 616, 618 COMBINATIONS, 570
  26934. TABLE_CONSTRAINTS base TABLE_OR_DOMAIN_DATA_TYPE_
  26935. table, 585 NOT_NULL, 570
  26936. TABLE_CONSTRAINTS view, 549 TABLE_OR_DOMAIN_NAME, 539,
  26937. TABLE_CONSTRAINTS_CHECK_ 545, 570, 571, 572, 573,
  26938. REFERENCES_TABLES, 585 581
  26939. TABLE_CONSTRAINTS_CHECK_ TABLE_OR_DOMAIN_SCHEMA,
  26940. VIEWS, 586 539, 545, 570, 571, 572,
  26941. TABLE_CONSTRAINTS_DEFERRED_ 573, 581
  26942. CHECK, 585 TABLE_PRIVILEGES, 542, 546,
  26943. TABLE_CONSTRAINTS_ 600, 640
  26944. INITIALLY_DEFERRED_ TABLE_PRIVILEGES base table
  26945. NOT_NULL, 585 , 600
  26946. TABLE_CONSTRAINTS_IS_ TABLE_PRIVILEGES view, 546
  26947. DEFERRABLE_NOT_NULL, TABLE_PRIVILEGES_FOREIGN_
  26948. 585 KEY_TABLES, 600
  26949. TABLE_CONSTRAINTS_PRIMARY_ TABLE_PRIVILEGES_GRANTABLE_
  26950. KEY, 585 CHECK, 600
  26951. TABLE_CONSTRAINTS_TABLE_ TABLE_PRIVILEGES_GRANTABLE_
  26952. CATALOG_NOT_NULL, 585 NOT_NULL, 600
  26953. TABLE_CONSTRAINTS_TABLE_ TABLE_PRIVILEGES_GRANTEE_
  26954. NAME_NOT_NULL, 585 FOREIGN_KEY_USERS, 600
  26955. 66 Database Language SQL
  26956. TABLE_PRIVILEGES_GRANTOR_ temporary table, 37, 38,
  26957. FOREIGN_KEY_USERS, 600 39, 46, 53, 56, 57, 58,
  26958. TABLE_PRIVILEGES_PRIMARY_ 60, 72, 73, 76, 101,
  26959. KEY, 600 103, 245, 258, 260, 261,
  26960. TABLE_SCHEMA, 542, 543, 262, 265, 275, 281, 283,
  26961. 544, 545, 546, 547, 549, 294, 296, 325, 343, 384,
  26962. 552, 557, 558, 559, 561, 386, 389, 392, 394, 397,
  26963. 562, 572, 576, 578, 580, 398, 403, 420, 459, 486,
  26964. 581, 583, 584, 585, 586, 487, 492, 494, 495, 577,
  26965. 587, 588, 589, 595, 596, 633, 634, 636, 639, 652,
  26966. 597, 600, 601, 602, 603 655, 668
  26967. TABLE_TYPE, 542, 576, 578, <temporary table
  26968. 586 declaration>, 39, 46,
  26969. TABLE_TYPE_NOT_NULL, 576 53, 56, 57, 58, 60, 72,
  26970. <target character set 262, 265, 281, 296, 341,
  26971. specification>, 320, 343, 397, 398, 489, 492,
  26972. 335 494, 495, 525, 634, 636,
  26973. <target specification>, 10,
  26974. 62, 114, 115, 281, 296, 639, 652
  26975. 325, 347, 350, 375, 377, temporary view, 668
  26976. 380, 382, 383, 436, 439, <term>, 157, 168, 169
  26977. 451, 456, 457, 458, 460, Terms denoting rule
  26978. 469, 470, 647, 667 requirements, 12
  26979. TARGET_CHARACTER_SET_ TEST, 85
  26980. THEN, 85, 141, 142, 314,
  26981. CATALOG, 556, 610, 611 316, 318, 543, 544, 682
  26982. TARGET_CHARACTER_SET_NAME, THERE, 85
  26983. 556, 610, 611 TIME, 19, 29, 30, 31, 49,
  26984. TARGET_CHARACTER_SET_SCHEMA 85, 90, 94, 108, 110,
  26985. , 556, 610, 611 111, 112, 122, 123, 129,
  26986. TEMPORARY, 37, 38, 85, 260, 139, 152, 153, 165, 166,
  26987. 261, 397, 576, 577, 633, 167, 422, 429, 440, 446,
  26988. 682 484, 571, 682
  26989. <time fractional seconds
  26990. precision>, 30, 31, 108,
  26991. 110, 111, 112, 129, 658
  26992. <time interval>, 91
  26993. <time literal>, 90, 94, 96
  26994. Index 67
  26995. <time precision>, 108, 110, transaction, 7, 41, 45, 48,
  26996. 111, 113, 139, 140, 426, 49, 50, 51, 52, 54, 55,
  26997. 453, 454, 630 56, 58, 59, 60, 67, 68,
  26998. TIMESTAMP, 19, 29, 30, 31, 69, 70, 71, 74, 75, 76,
  26999. 49, 85, 90, 94, 108, 253, 349, 350, 368, 369,
  27000. 110, 111, 122, 123, 129, 384, 386, 389, 392, 394,
  27001. 139, 153, 166, 429, 440, 399, 400, 401, 403, 404,
  27002. 446, 571, 682 405, 407, 410, 412, 420,
  27003. <timestamp literal>, 90, 442, 448, 484, 486, 525,
  27004. 94, 96 526, 527, 528, 635, 637,
  27005. <timestamp precision>, 108, 639, 647, 648, 654, 655,
  27006. 110, 111, 113, 139, 140, 662, 665, 668, 672, 677
  27007. 426, 453, 454, 630 TRANSACTION, 85, 353, 354,
  27008. <timestamp string>, 82, 86, 355, 399, 484, 682
  27009. 90 <transaction access mode>,
  27010. <time string>, 82, 90 399, 400
  27011. <time value>, 90, 91, 96 transaction-initiating, 67,
  27012. <time zone>, 165, 166, 167 349, 407, 410, 526, 527
  27013. <time zone field>, 128, 129 Transaction management, 399
  27014. <time zone interval>, 90, <transaction mode>, 399
  27015. 94, 95, 96 transaction resolution
  27016. <time zone specifier>, 165, unknown, 71, 620
  27017. 166, 167 transaction rollback, 69,
  27018. TIMEZONE_HOUR, 30, 85, 112, 71, 253, 403, 404, 486,
  27019. 128, 130, 682 622, 655, 662
  27020. TIMEZONE_MINUTE, 30, 85, transaction states, 59
  27021. 112, 128, 682 TRANSLATE, 85, 132, 682
  27022. TO, 31, 85, 123, 154, 166,
  27023. 170, 209, 238, 239, 240,
  27024. 248, 315, 320, 321, 329,
  27025. 330, 331, 332, 349, 407,
  27026. 422, 430, 441, 497, 499,
  27027. 527
  27028. <token>, 82, 86, 491
  27029. <token> and <separator>, 82
  27030. TRAILING, 85, 132, 136, 682
  27031. 68 Database Language SQL
  27032. translation, 7, 22, 44, 53, TRANSLATIONS_CHECK_
  27033. 64, 65, 66, 76, 99, 103, REFERENCES_SOURCE, 610
  27034. 104, 132, 134, 135, 136, TRANSLATIONS_CHECK_
  27035. 137, 255, 256, 257, 258, REFERENCES_TARGET, 611
  27036. 259, 302, 314, 316, 320, TRANSLATIONS_FOREIGN_KEY_
  27037. 321, 322, 323, 324, 329, SCHEMATA, 610
  27038. 331, 333, 334, 335, 336, TRANSLATIONS_PRIMARY_KEY,
  27039. 337, 368, 444, 483, 484, 610
  27040. 556, 605, 610, 611, 630, TRANSLATIONS_SOURCE_
  27041. 632, 634, 635, 637, 639, CHARACTER_SET_CATALOG_
  27042. 659, 661 NOT_NULL, 610
  27043. TRANSLATION, 85, 259, 314, TRANSLATIONS_SOURCE_
  27044. 320, 321, 323, 329, 331, CHARACTER_SET_NAME_
  27045. 332, 483, 484, 556, 604, NOT_NULL, 610
  27046. TRANSLATIONS_SOURCE_
  27047. 605, 610, 611, 634, 682 CHARACTER_SET_SCHEMA_
  27048. <translation collation>, NOT_NULL, 610
  27049. 314, 316, 323 TRANSLATIONS_TARGET_
  27050. <translation definition>, CHARACTER_SET_CATALOG_
  27051. 53, 255, 257, 320, 321, NOT_NULL, 610
  27052. 322, 331, 335, 368, 484, TRANSLATIONS_TARGET_
  27053. 632, 634, 635, 637, 639 CHARACTER_SET_NAME_
  27054. translation descriptor, 22, NOT_NULL, 610
  27055. 44, 313, 321 TRANSLATIONS_TARGET_
  27056. <translation name>, 22, 99, CHARACTER_SET_SCHEMA_
  27057. 103, 104, 132, 134, 135, NOT_NULL, 610
  27058. 259, 302, 314, 316, 320, TRANSLATION_CATALOG, 556,
  27059. 321, 323, 329, 331, 333, 604, 610, 611
  27060. 335, 630 TRANSLATION_NAME, 556, 604,
  27061. TRANSLATIONS, 556, 604, 610, 611
  27062. 610, 611 TRANSLATION_SCHEMA, 556,
  27063. TRANSLATIONS base table, 604, 610, 611
  27064. 610 TRIGGER, 85
  27065. <translation source>, 320 triggered data change
  27066. <translation specification> violation, 279, 486,
  27067. , 320 622
  27068. TRANSLATIONS view, 556
  27069. Index 69
  27070. TRIM, 85, 132, 134, 152, Type conversions and mixing
  27071. 153, 154, 353, 407, 408, of data types, 34
  27072. 415, 417, 419, 420, 431, - U -
  27073. 447, 465, 682 UNCOMMITTED, 68, 69, 84,
  27074. <trim character>, 132, 134, 399, 400
  27075. 136, 444 UNDER, 85
  27076. trim error, 136, 621 underlying column, 122,
  27077. <trim function>, 22, 132, 155, 177, 192, 200, 201,
  27078. 134, 136, 137, 138, 444, 297, 298, 331
  27079. 641 underlying data type, 144
  27080. <trim operands>, 132 underlying table, 37, 38,
  27081. <trim source>, 132, 134, 193, 200, 298, 299, 330,
  27082. 136, 444 334, 372, 384, 387, 389,
  27083. <trim specification>, 132, 390, 391, 392, 396, 472,
  27084. 134, 136 474, 476, 477
  27085. TRUE, 85, 229, 230, 356, <underscore>, 80, 81, 82,
  27086. 682 87, 88, 89, 98, 101,
  27087. Truth table for the AND 215, 629
  27088. boolean, 230 UNION, 85, 176, 180, 181,
  27089. Truth table for the IS 182, 183, 184, 196, 197,
  27090. boolean, 230 200, 201, 202, 208, 542,
  27091. Truth table for the OR
  27092. boolean, 230 559, 561, 572, 586, 593,
  27093. <truth value>, 229, 230, 604, 616, 631, 643, 670
  27094. 632 UNIQUE, 41, 85, 223, 224,
  27095. TYPE, 84, 85, 352, 353, 225, 270, 272, 273, 550,
  27096. 354, 355, 356, 425, 426, 559, 580, 585, 586, 587,
  27097. 427, 434, 436, 439, 440, 588, 590, 591, 616, 617,
  27098. 441, 452, 453, 454, 455, 618, 645
  27099. 456, 457, 458, 500, 502, <unique column list>, 41,
  27100. 539, 542, 544, 545, 546, 270, 272, 273, 275, 645
  27101. 547, 548, 549, 554, 555, unique constraint, 41, 42
  27102. 556, 570, 571, 572, 573, <unique constraint
  27103. 576, 578, 580, 581, 585, definition>, 36, 270,
  27104. 586, 587, 588, 590, 591, 272, 273, 275, 677
  27105. 600, 601, 602, 603, 604, unique matching rows, 277,
  27106. 605, 618, 663, 664 278, 279
  27107. Type conversions, 34
  27108. 70 Database Language SQL
  27109. <unique predicate>, 205, <unsigned numeric literal>,
  27110. 206, 223, 643, 644 82, 89, 90
  27111. <unique specification>, 36, <unsigned value specifi-
  27112. 262, 264, 272 cation>, 114, 115, 116,
  27113. UNIQUE_CONSTRAINT_CATALOG, 155
  27114. 550, 559, 590, 591, 617 unterminated C string, 363,
  27115. UNIQUE_CONSTRAINT_CATALOG_ 621
  27116. NOT_NULL, 590 <updatability clause>, 371,
  27117. UNIQUE_CONSTRAINT_CHECK_ 372, 373, 374, 392, 464,
  27118. REFERENCES_UNIQUE_ 474, 635, 638, 647
  27119. CONSTRAINT, 591 updatable, 38, 40, 50, 119,
  27120. UNIQUE_CONSTRAINT_NAME, 193, 195, 197, 296, 297,
  27121. 550, 559, 590, 591, 616, 298, 299, 330, 334, 372,
  27122. 617 373, 384, 391, 394, 467,
  27123. UNIQUE_CONSTRAINT_NAME 472, 474, 579, 643
  27124. assertion, 616 UPDATE, 64, 66, 85, 245,
  27125. UNIQUE_CONSTRAINT_NAME_NOT_ 246, 261, 274, 284, 289,
  27126. NULL, 590 298, 329, 330, 333, 334,
  27127. UNIQUE_CONSTRAINT_SCHEMA, 371, 372, 373, 374, 391,
  27128. 550, 559, 590, 591, 617 392, 394, 398, 464, 474,
  27129. UNIQUE_CONSTRAINT_SCHEMA_ 477, 483, 484, 550, 590,
  27130. NOT_NULL, 590 591, 600, 601, 602, 603,
  27131. UNIQUE_TABLE_PRIMARY_KEY_
  27132. CHECK, 586 635, 638
  27133. UNKNOWN, 85, 229, 230, 353, update operation, 299
  27134. 355, 682 <update rule>, 274, 276,
  27135. UNNAMED, 84, 427, 434, 436, 278, 279, 280, 633
  27136. 438, 452, 453, 454, 672 <update source>, 119, 122,
  27137. unordered collection, 6 391, 392, 393, 395, 396,
  27138. <unqualified schema name>, 474, 648
  27139. 98, 101, 102, 256, 417, <update statement:
  27140. 486, 487, 533 positioned>, 50, 53,
  27141. <unsigned integer>, 90, 91, 55, 57, 59, 60, 279,
  27142. 92, 96, 108, 148, 150, 299, 369, 385, 387, 391,
  27143. 239, 371, 372, 497, 498, 392, 393, 395, 475, 477,
  27144. 499, 530, 629, 675 484, 648
  27145. <unsigned literal>, 89,
  27146. 114, 629, 640
  27147. Index 71
  27148. <update statement: USAGE_PRIVILEGES_IS_
  27149. searched>, 53, 55, 56, GRANTABLE_CHECK, 604
  27150. 58, 60, 119, 122, 299, USAGE_PRIVILEGES_IS_
  27151. 369, 385, 392, 394, 396, GRANTABLE_NOT_NULL,
  27152. 442, 484, 485, 525, 648, 604
  27153. 673 USAGE_PRIVILEGES_OBJECT_
  27154. UPDATE_RULE, 550, 590, 591 TYPE_CHECK, 604
  27155. UPPER, 22, 85, 132, 135, USAGE_PRIVILEGES_PRIMARY_
  27156. 682 KEY, 604
  27157. upper case, 22, 81, 87, Use of terms, 10
  27158. 135, 136, 506, 534, 619, USER, 85, 114, 115, 117,
  27159. 666 266, 407
  27160. USAGE, 65, 66, 85, 135, <user-defined character
  27161. 145, 245, 248, 249, 251, repertoire name>, 248,
  27162. 264, 302, 310, 312, 313, 249
  27163. 315, 316, 318, 321, 323, <user name>, 72, 99, 103,
  27164. 329, 330, 331, 333, 336, 407, 408, 409, 662
  27165. 337, 358, 359, 508, 510, USERS, 568, 569, 600, 602,
  27166. 533, 539, 548, 552, 554, 605
  27167. USERS base table, 568
  27168. 555, 556, 557, 558, 559, USERS_PRIMARY_KEY, 568
  27169. 561, 562, 583, 584, 588, USER_NAME, 568
  27170. 595, 596, 604, 605, 617, USING, 85, 132, 180, 354,
  27171. 618, 640, 664, 682 451, 539, 561, 618, 682
  27172. usage privilege descriptor, <using arguments>, 451,
  27173. 66 455, 456, 457, 459, 469,
  27174. USAGE_PRIVILEGES, 539, 548, 470
  27175. 554, 555, 556, 604, 605, <using clause>, 451, 455,
  27176. 640 456, 457, 459, 467, 469
  27177. USAGE_PRIVILEGES base table using clause does not
  27178. , 604 match dynamic parameter
  27179. USAGE_PRIVILEGES view, 548 specifications, 455, 621
  27180. USAGE_PRIVILEGES_CHECK_ using clause does not match
  27181. REFERENCES_OBJECT, 604 target specifications,
  27182. USAGE_PRIVILEGES_GRANTEE_ 457, 621
  27183. FOREIGN_KEY_USERS, 605 using clause required for
  27184. USAGE_PRIVILEGES_GRANTOR_ dynamic parameters, 460,
  27185. FOREIGN_KEY_USERS, 605 467, 621
  27186. 72 Database Language SQL
  27187. using clause required for <value specification>, 114,
  27188. result fields, 460, 621 115, 116, 213, 217, 282,
  27189. <using descriptor>, 450, 325, 347, 375, 390, 415,
  27190. 451, 455, 456, 457, 459, 417, 419, 420, 444, 446,
  27191. 460, 469 447, 525, 530, 632, 642,
  27192. UTC, 5, 31, 32, 96, 123, 643, 658, 665
  27193. 167 <value specification> and
  27194. - V - <target specification>,
  27195. Valid operators involving 114
  27196. datetimes and intervals, VARCHAR, 85, 107, 108, 113,
  27197. 34 504, 505, 506, 507, 515,
  27198. Valid values for fields in 516, 640, 651, 664, 682
  27199. datetime items, 112 variable, 14, 23, 24, 47,
  27200. Valid values for fields in 48, 49, 59, 61, 62, 63,
  27201. INTERVAL items, 32, 112 114, 115, 116, 192, 442,
  27202. value, 19 443, 451, 462, 489, 490,
  27203. VALUE, 36, 85, 114, 115, 492, 493, 494, 495, 496,
  27204. 116, 309, 434, 438, 509, 497, 498, 499, 500, 501,
  27205. 565, 641, 664, 682 502, 504, 505, 506, 507,
  27206. <value expression>, 119, 508, 509, 510, 512, 513,
  27207. 122, 124, 125, 126, 127, 514, 515, 516, 517, 518,
  27208. 141, 142, 144, 145, 155, 519, 520, 521, 522, 525,
  27209. 156, 173, 176, 181, 185, 630, 639, 651, 655, 664,
  27210. 186, 187, 191, 192, 193, 673
  27211. 194, 212, 213, 382, 391, VARIABLE, 85
  27212. 392, 393, 394, 395, 396, variable-length, xiii, 76,
  27213. 443, 444, 445, 446, 447, 109, 115, 133, 134, 145,
  27214. 474, 475, 630, 632, 636, 148, 149, 150, 151, 152,
  27215. 641, 642, 643, 648, 677 161, 162, 163, 216, 232,
  27216. <value expression primary>, 234, 235, 237, 266, 268,
  27217. 155, 156, 157, 160, 161, 365, 366, 506, 516, 564,
  27218. 165, 168, 642 658, 663
  27219. VALUES, 85, 176, 212, 388, variable-length coding, 5,
  27220. 574, 578, 586, 598, 648 6
  27221. <variable specification>,
  27222. 114, 115, 116, 525
  27223. Index 73
  27224. VARYING, 19, 20, 26, 35, VIEW, 85, 258, 290, 296,
  27225. 85, 107, 108, 109, 113, 300, 338, 483, 484, 538,
  27226. 263, 301, 351, 357, 360, 539, 541, 542, 543, 544,
  27227. 361, 362, 363, 364, 365, 546, 547, 548, 549, 550,
  27228. 366, 367, 425, 426, 429, 551, 552, 553, 554, 555,
  27229. 440, 445, 447, 458, 506, 556, 557, 558, 559, 561,
  27230. 516, 520, 521, 522, 523, 562, 563, 576, 577, 578,
  27231. 564, 570, 635, 639, 640, 579, 583, 584, 586, 640
  27232. 647, 651, 682 <view column list>, 296,
  27233. <vertical bar>, 80, 81 297, 334, 335
  27234. view, 10, 11, 37, 38, 39, <view definition>, 11, 37,
  27235. 40, 44, 45, 52, 64, 67, 52, 119, 255, 296, 297,
  27236. 75, 77, 119, 177, 179, 299, 334, 335, 368, 484,
  27237. 195, 203, 255, 256, 258, 579, 646
  27238. 267, 268, 284, 289, 290, view descriptor, 39, 40,
  27239. 294, 296, 297, 299, 300, 44, 284, 289, 294, 297,
  27240. 309, 318, 323, 326, 330, 299, 300, 313, 318, 323,
  27241. 331, 334, 335, 336, 337, 326, 336, 338, 578, 581
  27242. 338, 368, 383, 389, 393, viewed table, 10, 37, 38,
  27243. 395, 398, 483, 484, 487, 67, 75, 296, 300, 543,
  27244. 533, 538, 539, 540, 541, 557, 558, 577, 578, 668
  27245. 542, 543, 544, 546, 547, VIEWS, 543, 576, 578, 583,
  27246. 548, 549, 550, 551, 552, 584, 586, 640
  27247. 553, 554, 555, 556, 557, VIEWS base table, 578
  27248. VIEWS view, 543
  27249. 558, 559, 560, 561, 562, VIEWS_IN_TABLES_CHECK, 578
  27250. 563, 576, 577, 578, 579, VIEWS_IS_UPDATABLE_CHECK_
  27251. 581, 583, 584, 631, 632, OPTION_CHECK, 578
  27252. 633, 635, 643, 646, 652, VIEWS_PRIMARY_KEY, 578
  27253. 667, 668, 677, 678 VIEW_CATALOG, 557, 558,
  27254. 583, 584
  27255. VIEW_COLUMN_USAGE, 558,
  27256. 584, 640
  27257. VIEW_COLUMN_USAGE base
  27258. table, 584
  27259. VIEW_COLUMN_USAGE view, 558
  27260. VIEW_COLUMN_USAGE_CHECK_
  27261. REFERENCES_COLUMNS, 584
  27262. 74 Database Language SQL
  27263. VIEW_COLUMN_USAGE_FOREIGN_ WHERE, 85, 185, 271, 273,
  27264. KEY_VIEWS, 584 303, 384, 386, 391, 394,
  27265. VIEW_COLUMN_USAGE_PRIMARY_ 472, 474, 476, 477, 483,
  27266. KEY, 584 484, 485, 538, 539, 541,
  27267. VIEW_DEFINITION, 543, 578, 542, 543, 544, 545, 546,
  27268. 579 547, 548, 549, 550, 551,
  27269. VIEW_NAME, 557, 558, 583, 552, 553, 554, 555, 556,
  27270. 584 557, 558, 559, 561, 562,
  27271. VIEW_SCHEMA, 557, 558, 583, 576, 578, 586, 588, 591,
  27272. 584 617, 618
  27273. VIEW_TABLE_USAGE, 557, 583, <where clause>, 118, 177,
  27274. 640 185, 187, 189, 193, 195,
  27275. VIEW_TABLE_USAGE base table
  27276. , 583 631, 643
  27277. VIEW_TABLE_USAGE view, 557 WHILE, 85
  27278. VIEW_TABLE_USAGE_CHECK_ WITH, 29, 30, 31, 65, 75,
  27279. REFERENCES_TABLES, 583 85, 94, 108, 110, 111,
  27280. VIEW_TABLE_USAGE_FOREIGN_ 112, 122, 123, 129, 139,
  27281. KEY_VIEWS, 583 153, 248, 296, 297, 299,
  27282. VIEW_TABLE_USAGE_PRIMARY_ 329, 330, 331, 356, 389,
  27283. KEY, 583 393, 395, 429, 431, 440,
  27284. VIRTUAL, 85 446, 487, 533, 571, 579,
  27285. visible, 50, 51, 70, 668 601, 603, 605, 663, 677
  27286. VISIBLE, 85 WITH CHECK OPTION, 75, 297,
  27287. - W - 389, 393, 395, 677
  27288. WAIT, 85 with check option violation
  27289. warning, 47, 67, 126, 148, , 299, 487, 623
  27290. 149, 151, 152, 232, 268, WITH GRANT OPTION, 75, 248,
  27291. 279, 282, 299, 326, 332, 330, 331, 533
  27292. 338, 351, 385, 387, 392, WITHOUT, 85
  27293. 395, 413, 452, 453, 486, WORK, 85, 403, 404, 405,
  27294. 528, 622 482, 484, 648, 649
  27295. WHEN, 85, 142, 543, 544, WRITE, 85, 399, 400, 682
  27296. 682
  27297. WHENEVER, 85, 497
  27298. <when operand>, 141, 142,
  27299. 444, 446
  27300. Index 75
  27301. - Y - <years value>, 91, 94, 95,
  27302. YEAR, 30, 31, 32, 33, 85, 241
  27303. 95, 111, 112, 238, 239, - Z -
  27304. 240, 430, 445, 563, 612, ZONE, 29, 30, 31, 85, 94,
  27305. 613, 682 108, 110, 111, 112, 122,
  27306. <year-month literal>, 91, 123, 129, 139, 153, 165,
  27307. 95, 241 422, 429, 440, 446, 484,
  27308. 571, 683
  27309. 76 Database Language SQL