Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you tell me why I got these errors please. View created. ERROR at line 3: ORA-06550: line 3, column 43: PLS-00382: expression is of

Can you tell me why I got these errors please.

View created.

ERROR at line 3:

ORA-06550: line 3, column 43:

PLS-00382: expression is of wrong type

ORA-06550: line 3, column 11:

PL/SQL: Item ignored

ORA-06550: line 40, column 5:

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

malformed

ORA-06550: line 40, column 1:

PL/SQL: Statement ignored

SQL> SET SERVEROUT ON FORMAT TRUNCATED

SQL> DECLARE

2 Room_rec DDI.LEDGER_VIEW%ROWTYPE;

3 Last_room DDI.LEDGER_VIEW.REGDATE%TYPE := 0;

4 Sub_Total number := 0;

5 Grand_Total number := 0;

6

7 PROCEDURE HEAD_OF_FORM

8 IS

9 BEGIN

10 DBMS_OUTPUT.NEW_LINE;

11 DBMS_OUTPUT.PUT_LINE(' Room Rates from DDI.LEDGER_VIEW by REGDATE ');

12 DBMS_OUTPUT.PUT_LINE('ID RegDate Last First Adults Children Size Beds Rate'

);

13 DBMS_OUTPUT.PUT_LINE('--- --------- ------------ ------------ -------- ----

------- ----- ------ -----');

14 END;

15

16 PROCEDURE FORM_BREAK(v_subtot IN OUT NUMBER)

17 IS

18 BEGIN

19 DBMS_OUTPUT.PUT_LINE(' --------');

20 DBMS_OUTPUT.PUT_LINE('Subtotal ' ||

21 LPAD(TO_CHAR(Sub_Total, '$99,999'),8));

22 DBMS_OUTPUT.NEW_LINE;

23 v_subtot := 0;

24 END;

25

26 PROCEDURE END_OF_FORM (v_gtot IN NUMBER)

27 IS

28 BEGIN

29 DBMS_OUTPUT.PUT_LINE(' --------');

30 DBMS_OUTPUT.PUT_LINE('Grand Total ' ||

31 LPAD(TO_CHAR(v_gtot, '$99,999'),8));

32 END;

33

34 BEGIN

35 FOR Room_rec IN

36 (SELECT *

37 FROM DDI.LEDGER_VIEW

38 ORDER BY REGDATE, LASTNAME)

39 LOOP

40 IF (Last_room = 0) THEN

41 HEAD_OF_FORM;

42 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.REGDATE,'999'), 4));

43 Last_room := Room_rec.REGDATE;

44 Sub_Total := Sub_Total + Room_rec.ROOMRATE;

45 Grand_Total := Grand_Total + Room_rec.ROOMRATE;

46 ELSIF (Room_rec.REGDATE <> Last_room) THEN

47 FORM_BREAK(Sub_Total);

48 HEAD_OF_FORM;

49 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.REGDATE,'999'), 4));

50 Last_room := Room_rec.REGDATE;

51 Sub_Total := Sub_Total + Room_rec.ROOMRATE;

52 Grand_Total := Grand_Total + Room_rec.ROOMRATE;

53 ELSE

54 DBMS_OUTPUT.PUT(' ');

55 Sub_Total := Sub_Total + Room_rec.ROOMRATE;

56 Grand_Total := Grand_Total + Room_rec.ROOMRATE;

57 END IF;

58 DBMS_OUTPUT.PUT(' ');

59 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.REGDATE, '999'), 4));

60 DBMS_OUTPUT.PUT(' ');

61 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.REGID, '999'), 4));

62

63 DBMS_OUTPUT.PUT(' ');

64 DBMS_OUTPUT.PUT(TO_CHAR(Room_rec.REGDATE, 'MM/DD/YY'));

65 DBMS_OUTPUT.PUT(' ');

66 DBMS_OUTPUT.PUT(RPAD(Room_rec.LASTNAME,12));

67 DBMS_OUTPUT.PUT(' ');

68 DBMS_OUTPUT.PUT(RPAD(Room_rec.FIRSTNAME,12));

69 DBMS_OUTPUT.PUT(' ');

70 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.ADULTCNT, '99'), 4));

71 DBMS_OUTPUT.PUT(' ');

72 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.CHILDCNT, '99'), 4));

73 DBMS_OUTPUT.PUT(' ');

74 DBMS_OUTPUT.PUT(RPAD(Room_rec.ROOMSIZE,8));

75 DBMS_OUTPUT.PUT(' ');

76 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.ROOMBEDCNT, '99'), 4));

77 DBMS_OUTPUT.PUT(' ');

78 DBMS_OUTPUT.PUT(LPAD(TO_CHAR(Room_rec.ROOMRATE, '$9,999'),6));

79 DBMS_OUTPUT.NEW_LINE;

80 END LOOP;

81 FORM_BREAK(Sub_Total);

82 END_OF_FORM(Grand_Total);

83 EXCEPTION

84 WHEN NO_DATA_FOUND THEN

85 DBMS_OUTPUT.PUT_LINE('No data found.');

86

87 END;

88 /

Last_room DDI.LEDGER_VIEW.REGDATE%TYPE := 0;

*

ERROR at line 3:

ORA-06550: line 3, column 43:

PLS-00382: expression is of wrong type

ORA-06550: line 3, column 11:

PL/SQL: Item ignored

ORA-06550: line 40, column 5:

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

malformed

ORA-06550: line 40, column 1:

PL/SQL: Statement ignored

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions