Home » Developer & Programmer » Forms » cursor for loop returns all records
cursor for loop returns all records [message #606295] Wed, 22 January 2014 02:04 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi,
Why the cursor for loop returns all(14) records (in form in the find button)? It is worked fine in the TOAD& SQL*PLUS
BEGIN
    FOR e_cursor  IN ( SELECT ename  FROM emp where deptno=10 ) LOOP
      dbms_output.put_line( e_cursor.ename );
    END LOOP;
    --EXECUTE_QUERY;
END;
output
------
KING
CLARK
MILLER

/forum/fa/11638/0/
Thank You
  • Attachment: image1.png
    (Size: 10.55KB, Downloaded 1148 times)

[Updated on: Wed, 22 January 2014 02:04]

Report message to a moderator

Re: cursor for loop returns all records [message #606296 is a reply to message #606295] Wed, 22 January 2014 02:09 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This code won't do anything in Forms. You should post a query you used in Forms; how is anyone supposed to debug invisible code?
Re: cursor for loop returns all records [message #606297 is a reply to message #606296] Wed, 22 January 2014 02:13 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
This code won't do anything in Forms. You should post a query you used in Forms; how is anyone supposed to debug invisible code?

BEGIN
    FOR e_cursor  IN ( SELECT ename  FROM emp where deptno=10 ) LOOP
      dbms_output.put_line( e_cursor.ename );
    END LOOP;
    EXECUTE_QUERY;
END;


I have written the code in the find button.I am getting all the departments employee names, why it is not worked same cursor for loop ? Suggest me?

Thank You
Re: cursor for loop returns all records [message #606301 is a reply to message #606297] Wed, 22 January 2014 02:39 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
DBMS_OUTPUT.PUT_LINE does nothing in Forms.

EXECUTE_QUERY, unrestricted, fetches all records from the base table (i.e. all 14 employees).
Re: cursor for loop returns all records [message #606302 is a reply to message #606301] Wed, 22 January 2014 02:54 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot,

What code should i use in the FIND Button please?

Thank You
Re: cursor for loop returns all records [message #606303 is a reply to message #606302] Wed, 22 January 2014 02:56 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
@mist598 - you really really need to spend some time reading the form builder help topics on querying.
Read the topic on execute_query and all the related topics (there's links in that topic)
Read the topic on enter_query and query mode and pre-query.
Read the topics on onetime_where and default_where

You've been working with forms for at least a year, you really should know by now that that cursor loop you've written has zero effect on what execute_query does.

[Updated on: Wed, 22 January 2014 02:56]

Report message to a moderator

Re: cursor for loop returns all records [message #606304 is a reply to message #606303] Wed, 22 January 2014 02:59 Go to previous message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
@mist598 - you really really need to spend some time reading the form builder help topics on querying.


Yes, you are right cookiemonster.. Smile
Previous Topic: on-insert trigger
Next Topic: while inserting one record, other 5 records are also getting updated
Goto Forum:
  


Current Time: Thu Apr 18 11:07:47 CDT 2024