*** I didn't realize that this was a dead forum. I will ask my questions elsewhere ***
I am using the following match to search a sql script
if $ScanString =~ m/insert\s.+doc.+[\(|values|select|;]?/is;
It is returning true on the following code fragment. What I want is that if the table name of DOC follows the INSERT, but if it gets to any of "(", SELECT or ";" it will return false. In other words if the DOC is not there before I hit "(", SELECT or ";" it will always return false. The perl match from above is returning a false positive because the string "DOC_NUM" is in the attached select.
Any help would be appreciated.
The script fragment follows
INSERT INTO gl_trn
( CO_CD, GL_ACCT_CD, JRNL_CD, EMP_CD_OP, POST_DT, DES,
REF, DC_CD, AMT, TRN_DT, GL_TRN_ORIGIN_CD, FINAL_DT,
CO_UNIT, TRN_TIME, CMNT, BNK_ACCT_CD, BNK_TRN_TP_CD, DOC_NUM,
POST_ID_NUM, BNK_CO_CD)
SELECT 'RAY', GL_ACCT_CD, NULL, EMP_CD_OP, to_date('&to_post_dt', 'MMDDRR'),
'REVERSAL'||' '||substr(des, 1, 30), 'R'||substr(REF, 1, 18),
decode(dc_cd, 'C', 'D',
'D', 'C'),
amt, TRUNC(SYSDATE), gl_trn_origin_cd,
NULL, co_unit, floor((sysdate-trunc(sysdate))*86400),
'Auto-generated by DEV using ACREV', BNK_ACCT_CD , BNK_TRN_TP_CD,
DOC_NUM, POST_ID_NUM , BNK_CO_CD
FROM gl_trn
WHERE post_dt = to_date('&from_post_dt', 'MMDDRR')
AND jrnl_cd = 'A'
AND co_cd = 'RAY'
AND NOT EXISTS (SELECT 'X'
FROM gl_reversed g
WHERE g.GL_TRN_SEQ_NUM = gl_trn.gl_trn_seq_num);
Bill
Lead Application Developer
New York State, USA
I am using the following match to search a sql script
if $ScanString =~ m/insert\s.+doc.+[\(|values|select|;]?/is;
It is returning true on the following code fragment. What I want is that if the table name of DOC follows the INSERT, but if it gets to any of "(", SELECT or ";" it will return false. In other words if the DOC is not there before I hit "(", SELECT or ";" it will always return false. The perl match from above is returning a false positive because the string "DOC_NUM" is in the attached select.
Any help would be appreciated.
The script fragment follows
INSERT INTO gl_trn
( CO_CD, GL_ACCT_CD, JRNL_CD, EMP_CD_OP, POST_DT, DES,
REF, DC_CD, AMT, TRN_DT, GL_TRN_ORIGIN_CD, FINAL_DT,
CO_UNIT, TRN_TIME, CMNT, BNK_ACCT_CD, BNK_TRN_TP_CD, DOC_NUM,
POST_ID_NUM, BNK_CO_CD)
SELECT 'RAY', GL_ACCT_CD, NULL, EMP_CD_OP, to_date('&to_post_dt', 'MMDDRR'),
'REVERSAL'||' '||substr(des, 1, 30), 'R'||substr(REF, 1, 18),
decode(dc_cd, 'C', 'D',
'D', 'C'),
amt, TRUNC(SYSDATE), gl_trn_origin_cd,
NULL, co_unit, floor((sysdate-trunc(sysdate))*86400),
'Auto-generated by DEV using ACREV', BNK_ACCT_CD , BNK_TRN_TP_CD,
DOC_NUM, POST_ID_NUM , BNK_CO_CD
FROM gl_trn
WHERE post_dt = to_date('&from_post_dt', 'MMDDRR')
AND jrnl_cd = 'A'
AND co_cd = 'RAY'
AND NOT EXISTS (SELECT 'X'
FROM gl_reversed g
WHERE g.GL_TRN_SEQ_NUM = gl_trn.gl_trn_seq_num);
Bill
Lead Application Developer
New York State, USA