Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL syntax 1

Status
Not open for further replies.

jrowden773

Programmer
Oct 19, 2007
9
Hello everyone,

I am new to SQL and I have two statements I'm embedding in a CL program.

Could someone help me with the syntax on this it would be greatly appreciated.


DOSQL STM('DELETE FROM DTALIB/DAMAST WHERE DAUSER = ''' + *CAT &TOUSER *CAT '''')

DOSQL STM('INSERT INTO DTALIB/DAMAST SELECT DAPGM, +
&TOUSER, DALEVL, DAACTV FROM DTALIB/DAMAST +
WHERE DAUSER = &FROMUSER')
 
Code:
dcl &sqlstm *char 1024
dcl &quote  *char    1   X'7D' 
chgvar &sqlstm ('DELETE FROM DTALIB/DAMAST WHERE DAUSER = ' *CAT &QUOTE *CAT &TOUSER *TCAT &QUOTE )
DOSQL   STM(&sqlstm)

chgvar &sqlstm ('INSERT INTO DTALIB/DAMAST SELECT DAPGM,' *CAT &QUOTE *CAT &TOUSER *TCAT &QUOTE *CAT ', DALEVL, DAACTV FROM DTALIB/DAMAST ' *CAT &QUOTE *CAT &TOUSER *TCAT &QUOTE *CAT ' WHERE  DAUSER = ' *CAT  &QUOTE *CAT &FROMUSER *TCAT &QUOTE )
DOSQL   STM(&sqlstm)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top