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!

Difference between %TYPE and %ROWTYPE

GTS (DBA)Jul 25 2013 — edited Jul 25 2013

Hello ;

Good Morning Everyone ;

I  am  a beginner in PL/SQL area. I  doing self study pl/sql concepts.

I have written plsql program for cursors. i am getting error.

i am need  some claen explantion for

which is recommended for  " %TYPE and %ROWTYPE  " in PL/SQL (explicit cursors)

SQL> DECLARE

  2  disp disp%rowtype;

  3  cursor c1 is select * From tab2;

  4  i number:=0;

  5  BEGIN

  6  open c1;

  7  for i in 1..5 loop

  8  fetch c1 into disp;

  9  dbms_output.put_line(disp.no || 'NO' || disp.first_name || 'first_name' || disp.last_name || 'last_name'

10  || disp.salary || 'salary' ||disp.bonus || 'bonus' || disp.qual || 'qual');

11  end loop;

12  close c1;

13  end;

14  /

disp disp%rowtype;

     *

ERROR at line 2:

ORA-06550: line 2, column 6:

PLS-00320: the declaration of the type of this expression is incomplete or

malformed

ORA-06550: line 2, column 6:

PL/SQL: Item ignored

ORA-06550: line 8, column 15:

PLS-00320: the declaration of the type of this expression is incomplete or

malformed

ORA-06550: line 8, column 1:

PL/SQL: SQL Statement ignored

ORA-06550: line 9, column 22:

PLS-00320: the declaration of the type of this expression is incomplete or

malformed

ORA-06550: line 9, column 1:

PL/SQL: Statement ignored

SQL> desc tab2;

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

NO                                                 NUMBER

FIRST_NAME                                VARCHAR2(10)

LAST_NAME                                  VARCHAR2(15)

SALARY                                         NUMBER

BONUS                                          NUMBER

QUAL                                             VARCHAR2(10)

Thanks in advance !

This post has been answered by Frank Kulash on Jul 25 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2013
Added on Jul 25 2013
12 comments
22,424 views