ERROR Handling in a table

Reply
Frequent Contributor
Posts: 87

ERROR Handling in a table


I am using oracle database

proc sql;

connect to oracle(userr=******* password=***** path='****');

execute (execute PROCEDURE_TEST ((to_date(&DATE1,'yyyymmdd')),(to_date(&DATE6,'yyyymmdd')))) by oracle;

create table SAMPLE_TEST as select * from connection to oracle( select  * from ORACLE_TEST) ;

disconnect from oracle;

quit;

I am executeing orcle procedure in sas and taking final table (ORACLE_TEST)

Some times i am getting error while executing

eg :

ERROR: ORACLE execute error: ORA-01722: invalid number

ORA-06512: at "DEVEL.PROCEDURE_TEST", line 209

ORA-06512: at

i want to handle this error in a table or export this error in text

how to handle this error

Super Contributor
Posts: 578

Re: ERROR Handling in a table

Is it a date error that's causing the procedure to fail?

Frequent Contributor
Posts: 87

Re: ERROR Handling in a table

Date or procedure error i am getting error in log

i want to put this error in a table

or take a data set in sas


data example;
input name$ sal;
datalines;
A 1000
B 200
C 3561
;
run;

proc print data=examp;
run;

i will get this error

ERROR: File WORK.EXAMP.DATA does not exist.

i want this error to put in table or export as text

Occasional Contributor
Posts: 7

Re: ERROR Handling in a table

Hi,

Please check your syntax before print the data.

It should be


proc print data=example;

run;

Super User
Posts: 19,851

Re: ERROR Handling in a table

You can parse your log, but that's the only way I know of.

Use Proc printto to redirect your log to a text file and then scan it for ERROR: and keep those into a table. There's macros floating around the internet that does things like this, so some searching will help.

It really depends on why you want to do this, which you haven't explained.

Super User
Posts: 5,434

Re: ERROR Handling in a table

Since you are using SQL explicit pass-thru, and it is an Oracle error - I can't see how this will fit a SAS discussion forum.

Data never sleeps
Frequent Contributor
Posts: 87

Re: ERROR Handling in a table

Oracle or SAS  ERROR  i just want to handle this error in table or export in text

Trusted Advisor
Posts: 1,137

Re: ERROR Handling in a table

Hi Santosh,

Could you please give more details like what you want.

i mean as per the above code, you got that error because you have created a dataset by name example, however you used the name as examp in proc print procedure. so got that error. if you correct the name in proc print, you can avoid that error.

Is this what you wanted.

I believe this is a very minor issue and you might have easily identified it, i am think you have a different query, could you please elaborate your question with example.

Thanks,

Jagadish

Thanks,
Jag
Super Contributor
Posts: 578

Re: ERROR Handling in a table

I don't think you can trap an error in an oracle procedure like you want.  You can look for the existence of a table prior to performing an operation on it (like printing or select * from.).  I would suggest understanding what is causing the oracle procedure errors and trap them before executing the procedure.

Ask a Question
Discussion stats
  • 8 replies
  • 806 views
  • 0 likes
  • 6 in conversation