BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sameer112217
Quartz | Level 8

I am trying to run an Oracle Passthrough for multiple updates in a table but I am getting an error. If I run only one update, the code runs fine. How can I insert multiple update statement in one passthrough. For example if I remove the second update statement, I dont get any error.

 

proc sql ;
connect to oracle as oracm ( PATH=** USER=**** PASSWORD="***" );
RESET NOPRINT;
EXECUTE (

update customer_sas_dq_output_New set RULE1 =1 where NVL(RULE1,null)<> 1
and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =1);

 

update customer_sas_dq_output_New set RULE1 =0 where NVL(RULE1,null)<> 0
and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =0);


) by oracm;
Disconnect from oracm;
Quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I don't understand. 

Just use two EXECUTE statements to execute your two Oracle statements.

You can do them both in the same PROC step.

EXECUTE (
update customer_sas_dq_output_New set RULE1 =1 
where NVL(RULE1,null)<> 1
  and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =1)
) by oracm;
EXECUTE (
update customer_sas_dq_output_New set RULE1 =0 
where NVL(RULE1,null)<> 0
  and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =0)
) by oracm;

View solution in original post

3 REPLIES 3
sameer112217
Quartz | Level 8

Here is the error

 

ERROR: ORACLE execute error: ORA-00933: SQL command not properly ended.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
40 Disconnect from oracm;
NOTE: Statement not executed due to NOEXEC option.
40 !
41 Quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
cpu time 0.02 seconds

Tom
Super User Tom
Super User

I don't understand. 

Just use two EXECUTE statements to execute your two Oracle statements.

You can do them both in the same PROC step.

EXECUTE (
update customer_sas_dq_output_New set RULE1 =1 
where NVL(RULE1,null)<> 1
  and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =1)
) by oracm;
EXECUTE (
update customer_sas_dq_output_New set RULE1 =0 
where NVL(RULE1,null)<> 0
  and policyno in (select policyno from Customer_Sas_DQ_Output_3yr_new where RULE1 =0)
) by oracm;
sameer112217
Quartz | Level 8

I did the same

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1505 views
  • 0 likes
  • 2 in conversation