Saturday, 11 August 2018

Simple PL/SQL Program

SET SERVEROUTPUT ON;

DECLARE
   c_id varchar2(100):= 'AR';
   r_id  varchar2(100);
   c_name varchar2(100);
  BEGIN
   SELECT region_id, country_name INTO r_id, c_name
   FROM countries
   WHERE country_id = c_id;
  dbms_output.put_line('Region Id is: '|| c_id || ' Country Name is: '|| c_name);

END;

/

No comments:

Post a Comment

Oracle / PLSQL: FOR LOOP

set serveroutput on; declare a1 varchar2(100); begin select count(*) into a1 from employees; for i in 1..a1 loop dbms_output.put_line...