reg select into [message #21596] |
Fri, 16 August 2002 03:00 |
Victoria
Messages: 152 Registered: July 2002
|
Senior Member |
|
|
Hi,
i have written my procedure like this........
FOR ARTS_rec IN ARTS_cursor LOOP
SELECT 1 FROM URT_CITY CITY
WHERE
.......
IF SQL%FOUND THEN
ARTS_rec.m25 := ARTS_rec.m25||RPAD('Y',31,' ');
ELSE
ARTS_rec.m25 := ARTS_rec.m25||RPAD('N',31,' ');
END IF;
UTL_FILE.PUT_LINE(v_file_handle,
ARTS_rec.a||ARTS_rec.b||ARTS_rec.m25 );
END LOOP;
here am getting an error
LINE/COL ERROR
-------- -----------------------------------------------------------------
318/7 PLS-00428: an INTO clause is expected in this SELECT statement
318/7 PL/SQL: SQL Statement ignored...
so i have used
something like this,
FOR ARTS_rec IN ARTS_cursor LOOP
SELECT count(*) into cnt FROM URT_CITY CITY
WHERE
.......
IF cnt >0 THEN
ARTS_rec.m25 := ARTS_rec.m25||RPAD('Y',31,' ');
ELSE
ARTS_rec.m25 := ARTS_rec.m25||RPAD('N',31,' ');
END IF;
UTL_FILE.PUT_LINE(v_file_handle,
ARTS_rec.a||ARTS_rec.b||ARTS_rec.m25 );
END LOOP;
can any one tell me whats wrong with the first one???i have been told not to use the second one...pls help me
Thanks
Victoria
|
|
|
Re: reg select into [message #21605 is a reply to message #21596] |
Fri, 16 August 2002 08:06 |
Nick
Messages: 64 Registered: February 2000
|
Member |
|
|
You should not use second one coz it takes a count(*) and count is always avoided and that too in a loop.
When you are calling any select call you should either use cursor outside the BEGIN .....
or
Select 'x' into vVar
where Conditions.....
You can use this in both the locations first statement and second one too.
|
|
|
|