Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

Using %ROWTYPE to Declare a Record


DECLARE

-- Best: use %ROWTYPE instead of specifying each column.

-- Use %ROWTYPE instead of %ROWTYPE because

-- we only want some columns.

-- Declaring the cursor doesn't run the query, so no performance hit.

CURSORC1IS

SELECTDEPARTMENT_ID,

DEPARTMENT_NAME,

LOCATION_ID

FROMDEPARTMENTS;

REC1C1%ROWTYPE;

-- Use %TYPE in field declarations to avoid problems if

-- the column types change.

TYPEDEPTREC2ISRECORD(DEPT_IDDEPARTMENTS.DEPARTMENT_ID%TYPE,

DEPT_NAMEDEPARTMENTS.DEPARTMENT_NAME%TYPE,

DEPT_LOCDEPARTMENTS.LOCATION_ID%TYPE);

REC2DEPTREC2;

-- Final technique, writing out each field name and specifying the type directly,

-- is clumsy and unmaintainable for working with table data.

-- Use only for all-PL/SQL code.

TYPEDEPTREC3ISRECORD(DEPT_IDNUMBER,

DEPT_NAMEVARCHAR2(14),

DEPT_LOCVARCHAR2(13));

REC3DEPTREC3;

BEGIN

NULL;

END;

/



Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-