Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour,
Est-il possible d'effectuer de requetes dynamiques en pb? a savoir par exemple :
update ls_nom_table set ls_nom_champ='O' where ls_nom_champ='N';
merci d'avance
Hors ligne
regardes dans l'aide en ligne de powerbuilder
au paragraphe
"Dynamic SQL Format"
il y a peut etre une solution ?
Hors ligne
sinon...
exemple de code :
string ls_isql ls_isql="CREATE TABLE dba.cusfin " + & ("cuscode char(6) NOT NULL DEFAULT NULL, " + & "currbal numeric(12,2) DEFAULT NULL, " + & "days_0 numeric(12,2) DEFAULT NULL, " + & "days_30 numeric(12,2) DEFAULT NULL, " + & "days_60 numeric(12,2) DEFAULT NULL, " + & "days_90 numeric(12,2) DEFAULT NULL, " + & "days_120 numeric(12,2) DEFAULT NULL, " + & "credit_limit numeric(12,2) DEFAULT NULL, " + & "credit_stop char(1) DEFAULT NULL , " + & "status char(1) NOT NULL, " + & "PRIMARY KEY (cuscode)) ; " Execute immediate :ls_isql using sqlca;
Hors ligne
je vais tester cela merci pick ( pb god ) ;)
Hors ligne
Bonjour à Tous
Oui c'est possible
Voici un bout de code que j'ai sur un Event Close
Cordialement
t1 = dw_1.getitemdecimal(1, "n1") t2 = dw_1.getitemdecimal(1, "n4") UPDATE CDE SET CDE_MODIF = 0, OPEMOD = NULL, DATMOD = NULL WHERE CDE_COD = :t1 AND CDE_RELIQ = :t2 AND CDE_MODIF = 1 USING SQLCA; if sqlca.sqlcode <> 0 then messageBox ("PB à la mise à Jour du Top de Modification (Event Close) ", & string(sqlca.sqldbcode) + " " + sqlca.sqlerrtext,StopSign!) return -1 end if COMMIT USING SQLCA; if sqlca.sqlcode <> 0 then messageBox ("PB à la mise à Jour du Top de Modification COMMIT(Event Close) ", & string(sqlca.sqldbcode) + " " + sqlca.sqlerrtext,StopSign!) return -1 end if
etc .......
Hors ligne
J'ai Oublié de dire
PB 10.5
Oracle 9I
Xp
Hors ligne
Rebonjour
2eme bout de code
Si ca peut d'aider
Cordialement
string s_req, req_sql s_req = "UPDATE ART ~r~n" s_req += "SET ART_SUP = 1 ~r~n" s_req += "WHERE ART_COD = " + string(dw_listlab.getitemdecimal(dw_listlab.getrow(), "art_art_cod")) EXECUTE IMMEDIATE :s_req USING SQLCA; req_sql = "INSERT INTO ART_TO_MAG (art_cod, lab_cod, art_sup, maj_cod) ~r~n" req_sql += "VALUES (" + string(dw_listlab.getitemdecimal(dw_listlab.getrow(), "art_art_cod")) + ", "+ string(dw_listlab.getitemdecimal(dw_listlab.getrow(), "lab_cod")) +", 1, 'S')" EXECUTE IMMEDIATE :req_sql USING SQLCA;
PB 10.5 Oracle9i Xp
Hors ligne
merci bien
j'ai fait quelque chose du type :
ls_requete ="UPDATE " +ls_nom_table_histo+ & " SET " +ls_nom_champ_exp+"='E' " + & " WHERE " +ls_nom_champ_exp+"='O'" Execute immediate :ls_requete using sqlca;
et ca a l'air de bien fonctionner
merci
Hors ligne
N oublie pas de tester le code retour de SQLCA
Bonne soirée
Hors ligne
oui oui c'était fait merci :D
Hors ligne