1.dynamic sql format 1
execute immediate sqlstatement ;
eg:string mysql
mysql = "create table employee "&
+"(emp_id integer not null,"&
+"dept_id integer not null, "&
+"emp_fname char(10) not null, "&
+"emp_lname char(20) not null)"
execute immediate :mysql ;
2.dynamic sql format 2
prepare dynamicstagingarea from sqlstatement ;
execute dynamicstagingarea using ;
eg:int emp_id_var = 56
prepare sqlsa
from "delete from employee where emp_id=?" ;
execute sqlsa using :emp_id_var ;
3.dynamic sql format 3
declare cursor | procedure dynamic cursor | procedure for dynamicstagingarea ;
prepare dynamicstagingarea from sqlstatement ;
open dynamic cursor ;
execute dynamic procedure ;
fetch cursor | procedure into hostvariablelist ;
close cursor | procedure ;
eg:integer emp_id_var
declare my_cursor dynamic cursor for sqlsa ;
prepare sqlsa from "select emp_id from employee" ;
open dynamic my_cursor ;
fetch my_cursor into :emp_id_var ;
close my_cursor ;
4.dynamic sql format 4
declare cursor | procedure dynamic cursor | procedure for dynamicstagingarea ;
prepare dynamicstagingarea from sqlstatement ;
describe dynamicstagingarea into dynamicdescriptionarea ;
open dynamic cursor | procedure using descriptor dynamicdescriptionarea ;
execute dynamic cursor | procedure using descriptor dynamicdescriptionarea ;
fetch cursor | procedure using descriptor dynamicdescriptionarea ;
close cursor | procedure ;
eg:string stringvar, sqlstatement
integer intvar
sqlstatement = "select emp_id from employee"
prepare sqlsa from :sqlstatement ;
describe sqlsa into sqlda ;
declare my_cursor dynamic cursor for sqlsa ;
open dynamic my_cursor using descriptor sqlda ;
fetch my_cursor using descriptor sqlda ;
// if the fetch is successful, the output
// descriptor array will contain returned
// values from the first row of the result set.
// sqlda.numoutputs contains the number of
// output descriptors.
// the sqlda.outparmtype array will contain
// numoutput entries and each entry will contain
// an value of the enumerated data type parmtype
// (such as typeinteger!, or typestring!).
choose case sqlda.outparmtype[1]
case typestring!
stringvar = getdynamicstring(sqlda, 1)
case typeinteger!
intvar = getdynamicnumber(sqlda, 1)
end choose
close my_cursor ;
動態sql程式設計語句的四種格式
1,動態sql語句 格式1 直接執行sql宣告 sqlstatement 例程 string mysql mysql create table employee emp id integer not null,dept id integer not null,emp fname char 10 no...
NAT 四種型別
nat主要分為兩大類 錐型 cone 和對稱型 symmetric 1.為什麼需要nat nat緩解了ipv4位址不夠用的問題,同時也也帶了限制,那就是nat外部的主機無法主動跟位於nat內部的主機通訊,nat內部主機想要通訊,必須主動和公網的乙個ip通訊,路由器負責建立乙個對映關係,從而實現資料的...
四種型別轉換
c 中四種型別轉換是 static cast,dynamic cast,const cast,reinterpret cast 1 const cast 用於將const變數轉為非const 2 static cast 用於各種隱式轉換,比如非const轉const,void 轉指標等,static...