Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Newbie PL/SQL question on variable assignment

Peter77Mar 13 2024

DB version: 19c

The way v_role and v_uniqname variables were assinged values in Line 6 is a valid. Right ? It seems to work.
But, I just wanted to make sure there are no pitfalls in this approach.

create or replace procedure testy
as
 v_role varchar2(35) ;
 v_uniqname varchar2(64);
begin
 select database_role, db_unique_name into v_role, v_uniqname from v$database ;  ## Line 6
dbms_output.put_line(v_role);
dbms_output.put_line(v_uniqname);
end;
/

Executing the stored proc

SQL> set serveroutput on
SQL> exec testy;
PRIMARY
CDB_17P

PL/SQL procedure successfully completed.
This post has been answered by mathguy on Mar 13 2024
Jump to Answer
Comments
Post Details
Added on Mar 13 2024
2 comments
218 views