Link to home
Start Free TrialLog in
Avatar of toooki
toooki

asked on

Oracle store procedure dies not work

I have a strange problem..

On Oracle 11gR2 database I have a stored procedure (inside a package):
CREATE OR REPLACE MyPkg Is
Procedure MyProd(CoreID         In Varchar2);

The body of the procedure has this UPDATE statement:

    UPDATE MyTab
       SET myid = CoreID
     WHERE
..................;

The procedure (in package) compiles and runs -- no errors. But it does not Update the table.

But If I change the above to:
CREATE OR REPLACE MyPkg Is
Procedure MyProd(Core_ID         In Varchar2);
And The body :

    UPDATE MyTab
       SET myid = Core_ID
     WHERE
.............;

It Works.

I tried is numerous times and it is working this strange.
"CoreID" does not seem to be a reserved work in Oracle. It's strange why it is happening.
I need to keep the input parameter as Core_ID as it is called that way in the front-end code and I cannot change that easily..
Is there any other reason that could cause the issue.?
Thanks.

ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of toooki
toooki

ASKER

Thank you...
Yes the table on which UPDATE is made has a column named "coreid" ... That is the reason then!! Can I still use that parameter name (same as one of the table column names).?
Off the top of my head I cannot remember if I have ever seen a way around this but that is the reason.

It is a bad coding practice to mix and match variable and object names.  You should have a naming convention of some type.

For example 'variables' start or end with v_ or _v.
Avatar of toooki

ASKER

Thank you. I think what you suggested in the right way -- so will do.
Thanks again.