Home » Developer & Programmer » Forms » Query Problem
icon5.gif  Query Problem [message #187362] Sat, 12 August 2006 15:54 Go to next message
qadeerahmed
Messages: 63
Registered: July 2006
Location: Pakistan
Member
dECLARE
TOT_COL NUMBER(5);
TOT_ROW NUMBER(5);
COUNT_roomid rooms.room_id%type;
COUNT_SEATID SEATS.SEAT_id%type;

CURSOR R is select count(room_id) from rooms;
CURSOR S is select count(SEAT_ID) from SEATS;

BEGIN
    SELECT ROOMS.TOTAL_ROWS INTO TOT_ROW FROM ROOMS;
TOT_COL:=:COLS;

OPEN R;
    LOOP
      FETCH R into COUNT_roomid;
      EXIT WHEN R%NOTFOUND;
    END LOOP;
CLOSE R;

  :ROOM_ID := COUNT_roomid + 1;
  
OPEN S;
  LOOP
      FETCH S into COUNT_SEATID;
      EXIT WHEN S%NOTFOUND;
  END LOOP;

 :SEAT_ID := COUNT_SEATID + 1;

CLOSE S;
 
   
    
  FOR J IN 1..TOT_COL LOOP
     FOR K IN 1..TOT_ROW LOOP
        INSERT INTO SEATS(ROOMS_NO,COL_NO)
	VALUES(J,K);
        commit;
     END LOOP;
  END LOOP;
:SEAT_ID := COUNT_SEATID + 1;
 
EXCEPTION
  WHEN OTHERS THEN
  message(SQLERRM);
END;


The Values of J and K are not inserted in table? Can anyone tell me WHY?

Actually, I want to implement the Class Room Seating Plan. i.e let's say
in col 1, row 3 is assigned to a user whose id is 3.
That's Why i'm using nested For Loops.

Is there anyother way to generate and assign that seat no to the user of specific ID....???

Thanks In Advance

Regards
Qadeer Ahmed
Re: Query Problem [message #187381 is a reply to message #187362] Sun, 13 August 2006 03:18 Go to previous messageGo to next message
qadeerahmed
Messages: 63
Registered: July 2006
Location: Pakistan
Member
Is There Anyone To Help Me in this problem?
Re: Query Problem [message #187429 is a reply to message #187362] Mon, 14 August 2006 00:20 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I think the problem is in here..

TOT_COL:=:COLS;

What value TOT_COL got? Is it zero. Then the outer loop won't work so as the inner loop.
Previous Topic: Query in Oracle report
Next Topic: Getting the item type
Goto Forum:
  


Current Time: Thu Dec 08 14:41:59 CST 2016

Total time taken to generate the page: 0.11110 seconds