Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update query with CL_SQL_STATEMENT class

Former Member
0 Likes
2,506

Hi all,

I'm trying to execute an update query with ADBC classes in order to modify two parameters (n_doc and processed) from a row with the following instructions:

l_con_ref = cl_sql_connection=>get_connection( 'DB_7879' ).

l_stmt_ref = l_con_ref->create_statement( ).

CONCATENATE 'update' gv_table ' set n_doc= ? processed = ''X'' where id_ordn = ? ' INTO l_stmt SEPARATED BY space.

GET REFERENCE OF materialdocument INTO l_dref.

l_stmt_ref->set_param( l_dref ).

GET REFERENCE OF ps_zmm_mov-id_ordn INTO l_dref.

l_stmt_ref->set_param( l_dref ).

l_stmt_ref->execute_update( l_stmt ).

However, I got the error ORA-0933: SQL command not properly ended. I guess this error occurs because I am trying to update two parameters with a single query since using the following CONCATENATE instruction

CONCATENATE 'update' gv_table ' set n_doc= ? where id_ordn = ? ' INTO l_stmt SEPARATED BY space.

results ok.

Does anybody know if it is possible to modify two parameters with only one update query with ADBC classes?

Thank you in advance!

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,554

Hi,

I think you should add a comma between the 2 column names -> update <tablename> set n_doc= ?, processed = ''X'' where id_ordn = ?

Sandra

5 REPLIES 5
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,555

Hi,

I think you should add a comma between the 2 column names -> update <tablename> set n_doc= ?, processed = ''X'' where id_ordn = ?

Sandra

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,554

Hello,

Sandra, out-of-curiosity, is this DB specific? Or this is kind of a thumb-rule?

BR,

Suhas

Read only

0 Likes
1,554

Hi Suhas,

Based on Oracle, I see it conforms almost completely ISO/IEC 9075 ([Oracle and Standard SQL|http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/ap_standard_sql.htm#10293])

UPDATE seems to conform completely [UPDATE SET clause|http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_108a.htm#2087215]

So using a comma to separate columns is true for every SQL language that conforms ISO/IEC 9075

Sandra

PS: of course SAP's "Open SQL" language does not conform at all

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,554

Hello Sandra,

So basically we need to check the semantics of the SQL statement beforehand.

of course SAP's "Open SQL" language does not conform at all

Lol

Cheers,

Suhas

Read only

Former Member
0 Likes
1,554

Thanks Sandra!