If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > can someone rectify the code please?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-05, 00:44
xoxo123 xoxo123 is offline
Registered User
 
Join Date: Nov 2005
Posts: 4
can someone rectify the code please?

Create or Replace Procedure Cust_Reservation(p_ID IN VARCHAR2) AS
2 CURSOR c_viewreservation IS
3 SELECT Consumer.FirstName,Consumer.LastName,Restaurant.Na me,Restaurant.Type,Reservation.ReservationDateTime ,Consumer.ConsumerID FROM(Consumer INNER JOIN Reservation ON Consumer.ConsumerID = Reservation.ConsumerID)INNER JOIN Restaurant ON Reservation.RestaurantID = Restaurant.RestaurantID WHERE ConsumerID = p_ID;
4 v_viewreservation c_viewreservation%ROWTYPE;
5 BEGIN
6 OPEN c_viewreservation;
7 FETCH c_viewreservation INTO v_viewreservation;
8 WHILE c_viewreservation%FOUND LOOP
9 DBMA_OUTPUT.PUT_LINE(v_viewreservation.FirstName|| ' '||v_viewreservation.LastName||' '||v_viewreservation.Name||' '||v_viewreservation.Type||' '||v_viewreservation.ReservationDateTime);
10 FETCH c_viewreservation INTO v_viewreservation;
11 END LOOP;
12 CLOSE c_viewreservation;
13 END Cust_Reservation;
14 /

Warning: Procedure created with compilation errors.

SQL> show error
Errors for PROCEDURE CUST_RESERVATION:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/8 PLS-00341: declaration of cursor 'C_VIEWRESERVATION' is
incomplete or malformed

3/2 PL/SQL: SQL Statement ignored
3/318 PL/SQL: ORA-00918: column ambiguously defined
4/20 PL/SQL: Item ignored
7/2 PL/SQL: SQL Statement ignored
7/31 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

9/3 PL/SQL: Statement ignored

LINE/COL ERROR
-------- -----------------------------------------------------------------
9/24 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

10/1 PL/SQL: SQL Statement ignored
10/30 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
Reply With Quote
  #2 (permalink)  
Old 12-07-05, 01:49
ramcha ramcha is offline
Registered User
 
Join Date: Oct 2004
Posts: 14
Try executing the SELECT statement (defined as part of the cursor definition) independently and check if it results in any error.

Also it looks like there is a space between Restaurant.Na and me.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On