05-18-2017 9:29 PM
Hi,
I am facing a strange issue with NAtive SQL statement.
I have a DB connection set up from SAP to Oracle and i am writing a query to fetch data from that oracle table.
Issue is when i use value in 'single quotes' in where clause, its fetching correct data but when i give dynamic where clause, its not fetching any data . please see examples below -
Working -
EXEC SQL.
OPEN dbcur FOR Select STYLE_NUMBER,
SERIAL_NUMBER
FROM <VIEW_name> WHERE SERIAL_NUMBER = '1234'
ENDEXEC.
Not working -
data : p_serial_num type string.
p_serial_num = '1234'.
EXEC SQL.
OPEN dbcur FOR Select STYLE_NUMBER,
SERIAL_NUMBER
FROM <VIEW_name> WHERE SERIAL_NUMBER = :p_serial_num
ENDEXEC.
It used to work previously, but we have recently upgraded ho HANA, so not sure if anything causing the issue.
If anyone of you experienced this kind of issue, please post your suggestions .
Thanks in advance!
Sagar
05-19-2017 6:45 AM
Just use ADBC (cl_sql_statement) instead of EXEC SQL. Or even better, create an AMDP and write the whole thing in HANA SQL Script. All nicely modern and up to date technology.