ORA-00942:Table or View does not exist-Store procedure [message #612891] |
Sun, 27 April 2014 08:11  |
 |
rvsri
Messages: 26 Registered: February 2014 Location: Chennai India
|
Junior Member |
|
|
CREATE OR REPLACE procedure CORE.WCC_UPDATE_REC_OMEGA1(
v_account_nbr IN NUMBER,
v_schema_name IN VARCHAR2)
IS
[b]s varchar2(20) :=v_schema_name;[/b]
BEGIN
UPDATE omega_contact NOLOGGING
SET customername = 'DELETED CUSTOMER',
contactno =
(CASE
WHEN contactno IS NOT NULL
THEN '0000000000'
ELSE contactno
END
),
feedbackdetail =
(CASE
WHEN feedbackdetail IS NOT NULL
THEN 'DELETED NOTE'
ELSE feedbackdetail
END
)
WHERE accountno IN (
SELECT UNIQUE account_nbr
[b][/b]FROM s.cor_customers[b][/b]
WHERE code_external_credit_ref = '@'
AND COALESCE (v_account_nbr, cor_customers.account_nbr) =
cor_customers.account_nbr)
AND countrycode = v_country_code;
COMMIT;
END WCC_UPDATE_REC_OMEGA1;
/
please look into the above procedure with the bolded ones.
when i am trying to compile this Proc ,by giving database schema name directly say nzl.cor_customers it runs properly.
if the same i do with passing the schema name as parameter (v_schema_name) doen't works.
Getting error as "ORA-00942:Table or View does not exist"
Please pardon me,ihave given only the problamatic statment from the big Proc.
The above proc is created under CORE schema and cor_customers table present under NZL schema.
I tried a lot to fix this,Expecting your help and i would be highly appreciating it.
|
|
|
Re: ORA-00942:Table or View does not exist-Store procedure [message #612892 is a reply to message #612891] |
Sun, 27 April 2014 08:23   |
John Watson
Messages: 8989 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
What you are trying to do is impossible: PL/SQL is a compiled language, and the objects have to be known at compile time. You could use dynamic SQL to construct and the statement at run time, but that is usually a very bad idea. You probably need to look your relational analysis (or lack thereof): I would guess that your data is not properly normalized if you need to do this sort of thing.
|
|
|
|
|
|
Re: ORA-00942:Table or View does not exist-Store procedure [message #612902 is a reply to message #612898] |
Sun, 27 April 2014 09:26   |
 |
rvsri
Messages: 26 Registered: February 2014 Location: Chennai India
|
Junior Member |
|
|
Hello Black,
There is no downside of this..But the requirent given was having a procedure in common to be used by multiple schemas by passing their schema names while compiling PROC.
So my understanding from all yours responce is, inside the proc statement there can't be schema name passed with variable name.
please correct if my understanding is wrong?
Thanks once agian.
[Updated on: Sun, 27 April 2014 09:32] Report message to a moderator
|
|
|
|
|
|