09-09-08, 16:11 #1Registered User
- Join Date
- Sep 2008
Unanswered: ora-01841 (proc error in prod but not in dev)
Short version - getting an ora error in Prod, but not in Dev.
Background: I have a stored procedure that reads from TableA and inserts into TableB. Along with the insert there are some data translations happening. i.e TO_DATE(D_MAT_DATE,'YYYYMMDD') Table A is populated via a client data file. The stored procedure is run in both Dev and Prod. Both are setup similarly.
D_MAT_DATE in TableA does have some bad data (empty 8 char strings) It is a varchar in TableA, but a date in TableB. So, the to_date function is applied. The empty strings cause an error - ORA-01841: (full) year must be between -4713 and +9999, and not be 0
This is fine. Data can be fixed...
However, the concern here is this same exact proc is run in Dev with same starting exact data in TableA. But, it does not error out and the insert is actually executed!!
What am I missing? As far as I know the tables\procs\constraints\etc are completely identical. Permissions can't come into play b/c its just an execute grant. It does get executed by different db user IDs tho due to the diff env.
I can fix up the bad data and move along, but its so ODD that it didn't error out in DEV.
I even took one line (select TO_DATE(D_MAT_DATE,'YYYYMMDD') from TableA) out of the entire stored proc and ran it and it does error out in BOTH DEV AND PROD. So, why not inside the stored proc???
Does anyone have any ideas? I'm learning here, so I am sure I could be missing some parameter...but I honestly can't think of anything..
Thanks in advance !!!
09-09-08, 18:01 #2Registered User
Provided Answers: 1
- Join Date
- Aug 2003
- Where the Surf Meets the Turf @Del Mar, CA
privs acquired via ROLE do not apply within PL/SQL procedures.
As a test you should use SQLPLUS to invoke SELECT but before doing so on both systems do the following:
SQL> SET ROLE NONE
use CUT & PASTE & post results back here.You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Good judgement comes from experience. Experience comes from bad judgement.
09-10-08, 08:47 #3Registered User
- Join Date
- Jun 2004
- Liverpool, NY USA
do you have exception handling in the procedure, maybe a when others then section?Bill
You do not need a parachute to skydive. You only need a parachute to skydive twice.