1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

ORACLE Tutorials

Example of using REF CURSOR in Oracle

CREATE OR REPLACE PACKAGE emp_data
AS
TYPE emp_cur_typ IS REF CURSOR
RETURN employees%ROWTYPE;

PROCEDURE open_emp_cur_var (
emp_cur_var IN OUT emp_cur_typ,
your_choice IN NUMBER
);
END;
/

CREATE OR REPLACE PACKAGE BODY emp_data
AS
PROCEDURE open_emp_cur_var (
emp_cur_var IN OUT emp_cur_typ,
your_choice IN NUMBER
)
IS
BEGIN
IF your_choice = 1
THEN
OPEN emp_cur_var FOR
SELECT *
FROM employees;
ELSIF your_choice = 2
THEN
OPEN emp_cur_var FOR
SELECT *
FROM employees
WHERE salary > 10000;
ELSE
DBMS_OUTPUT.put_line ('Choice must be 1 or 2 only');
END IF;

CLOSE emp_cur_var;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Errors');
END;
END;
/

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy