DEFINE sql STRING, d DATELET d = TODAYLET sql = "SELECT ... WHERE order_date > '", d, "'"
MAIN DATABASE test1 CREATE TEMP TABLE tt1 ( k INT, t TEXT ) EXECUTE IMMEDIATE "INSERT INTO tt1 VALUES ( 1, FILETOCLOB('xx','client')::TEXT )"END MAIN
PREPARE s FROM "INSERT INTO mytab (pk,b1,b2) VALUES (?,?,?)"EXECUTE s USING rec.pk, rec.b1, rec.b2
PREPARE s1 FROM "INSERT INTO mytab (pk,b1,b2) VALUES (?,NULL,NULL)"EXECUTE s1 USING rec.pkPREPARE s2 FROM "UPDATE mytab SET b1 = ? WHERE pk = ?"EXECUTE s2 USING rec.pk, rec.b1PREPARE s3 FROM "UPDATE mytab SET b2 = ? WHERE pk = ?"EXECUTE s3 USING rec.pk, rec.b2
type t_agendar_query dynamic array of record sql like diacpa.cpasql, tabname like diacpa.tabname, blob dynamic array of record arq like diapab.pabarq, text like diapab.pabtext, varchar like diapab.pabvarchar end record end record
foreach pont_pab into la_cpa[l_indcpa].blob[l_indpab].pabarq, la_cpa[l_indcpa].blob[l_indpab].pabtext, la_cpa[l_indcpa].blob[l_indpab].pabvarchar if la_cpa[l_indcpa].blob[l_indpab].pabarq is not null then let la_cpa[l_indcpa].blobind = la_cpa[l_indcpa].blobind clipped, "A" end if if la_cpa[l_indcpa].blob[l_indpab].pabtext is not null then let la_cpa[l_indcpa].blobind = la_cpa[l_indcpa].blobind clipped, "T" end if if la_cpa[l_indcpa].blob[l_indpab].pabvarchar is not null then let la_cpa[l_indcpa].blobind = la_cpa[l_indcpa].blobind clipped, "V" end if end foreach
case la_cpa[l_i].blobind when "0" execute com_sql when "A" execute com_sql using la_cpa[l_i].blob[1].pabarq when "T" execute com_sql using la_cpa[l_i].blob[1].pabtext when "V" execute com_sql using la_cpa[l_i].blob[1].pabvarchar when "AA" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabarq when "AT" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabtext when "AV" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabvarchar when "TA" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabarq when "TT" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabtext when "TV" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabvarchar when "VA" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabarq when "VT" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabtext when "VV" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabvarchar when "AAA" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabarq when "AAT" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabtext when "AAV" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabvarchar when "ATA" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabarq when "ATT" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabtext when "ATV" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabvarchar when "AVA" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabarq when "AVT" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabtext when "AVV" execute com_sql using la_cpa[l_i].blob[1].pabarq, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabvarchar when "TAA" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabarq when "TAT" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabtext when "TAV" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabvarchar when "TTA" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabarq when "TTT" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabtext when "TTV" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabvarchar when "TVA" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabarq when "TVT" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabtext when "TVV" execute com_sql using la_cpa[l_i].blob[1].pabtext, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabvarchar when "VAA" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabarq when "VAT" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabtext when "VAV" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabarq, la_cpa[l_i].blob[3].pabvarchar when "VTA" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabarq when "VTT" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabtext when "VTV" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabtext, la_cpa[l_i].blob[3].pabvarchar when "VVA" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabarq when "VVT" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabtext when "VVV" execute com_sql using la_cpa[l_i].blob[1].pabvarchar, la_cpa[l_i].blob[2].pabvarchar, la_cpa[l_i].blob[3].pabvarchar otherwise let gg_erro = true end case
DEFINE l_result ARRAY[9] OF VARCHAR(255)... FOREACH list_curs INTO l_result[1], l_result[2], l_result[3], l_result[4], l_result[5], l_result[6], l_result[7], l_result[8], l_result[9]
DEFINE var_table_like DYNAMIC RECORD FOREACH cursor USING tablename INTO column_name, column_datatype -- loop through systables/syscolumns for tablename CALL var_table_like.addField(column_name, column_datatype)END FOREACH SELECT * INTO var_table_like.* FROM tablename LET value = var_table_like.getValueByFieldname(column_name)LET value = var_table_like.getValueByIndex(index)etc
DEFINE dynrec DYNAMIC RECORD... DECLARE c1 CURSOR FOR SELECT * FROM mytableOPEN c1 USING ...DESCRIBE c1 INTO dynrecFETCH c1 INTO dynrec.*...
DEFINE dynrec DYNAMIC RECORD, i INT... DECLARE c1 CURSOR FOR SELECT * FROM mytableFOREACH c1 INTO dynrec -- (No .* notation) FOR i=1 TO dynrec.getFieldCount() DISPLAY dynrec.getFieldName(i), "=", dynrec.getFieldValue() END FOREND FOREACH