Is it possible to select from procedure\function when the PDB is an argument without connect?
-
14-03-2021 - |
Domanda
I have the following function in oracle 11g.
Create or Replace function get_col_value(
schema# in varchar2,
table# in varchar2,
column# in varchar2,
rowid# in varchar2)
Return varchar2
Is
v_cmd varchar2(2000)
v_retval varchar2(32767)
BEGIN
Begin
v_cmd := 'select "'||column#||'" from "'||schema#||'"."'||table#||'" Where "ROWID"='''||rowid#||'''';
execute immediate v_cmd into v_retval;
EXCEPTION When others THEN
NULL;
End
return ''''||v_retval||'''';
END
Now I'm trying to make it work on 19c (on CDB) with additional PDB parameter:
Create or Replace function get_col_value(
pdb# in varchar2,
schema# in varchar2,
table# in varchar2,
column# in varchar2,
rowid# in varchar2)
Return varchar2
Is
v_cmd varchar2(2000)
v_retval varchar2(32767)
BEGIN
Begin
-- v_cmd := 'select "'||column#||'" from "'||schema#||'"."'||table#||'" Where "ROWID"='''||rowid#||'''';
execute immediate v_cmd into v_retval;
EXCEPTION When others THEN
NULL;
End
return ''''||v_retval||'''';
END
Can I do it without a 'connect' command?
I don't want to put the DBA password in a procedure/function, and I don't want to change the script every time I change the password.
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange