Page 1 of 1

Passing SQL as Parameter

Posted: Wed May 27, 2009 1:06 pm
by gsym
Hey Guys,

Can any one let me know why this query is not working when passed as a parameter?

select cast (count(1) as number(15)) as count,cast (sum(TRANSACTIONAMT) as number(21,2)) as amount, \' 1 \' as flag from TST

Error from director:

PS_NW_GLTXNF_SF: GenericQuery:esqlErrorHandler
Prepare failed for: GenericStmt_1
query is: select cast (count(1) as number(15)) as count,cast (sum(TRANSACTION_AMT) as number(21,2)) as amount, \ 1 \ as flag from TST
sqlcode is: -911
esql complaint: ORA-00911: invalid character

Posted: Wed May 27, 2009 1:12 pm
by chulett
Because (I assume) the slashes are invalid characters after the quotes are stripped, which DataStage is wont to do. Perhaps?

Code: Select all

select cast (count(1) as number(15)) as count,cast (sum(TRANSACTIONAMT) as number(21,2)) as amount, '' 1 '' as flag from TST


Note those are two single quotes, not double quotes.