Home » Developer & Programmer » Forms » redirect the cursor to forms
redirect the cursor to forms [message #111027] Sat, 12 March 2005 05:16 Go to next message
khabbab
Messages: 10
Registered: March 2005
Location: france
Junior Member
I want to find some informations by utiling Cursor and the clause LIKE %:name_of-filed%
the problem that i cant reditect the result of the cursor (fetch into name of my var in the forms)i find only one result how to obtain multiligne result.
also i try to make solution with Master details but the recherch in made in only one table how to make the Join??
thanks for help. Cool
  • Attachment: SOURCE.txt
    (Size: 0.50KB, Downloaded 1556 times)
Re: redirect the cursor to forms [message #111028 is a reply to message #111027] Sat, 12 March 2005 05:26 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Next time, please post your problem-code instead of attaching a file (if your code is too large to post, change it into a representable sample-code)

You'd want something like this:
declare
  cursor c1
  ( b_text in varchar2
  ) is
    select utilisateur
    ,      userpass
    from   connexion  cnx
    where  cnx.utilisateur like '%'||b_text||'%'
  ;
begin
  open c1 (:bloc3.element_texte4);
  fetch c1 
  into :bloc3.xnom1
  ,    :bloc3.xpass_1;
  close c1;
end;

Note that you can't use this in a library; you have to use the built-ins copy and name_in then.

hth
i need help [message #111029 is a reply to message #111027] Sat, 12 March 2005 06:04 Go to previous messageGo to next message
khabbab
Messages: 10
Registered: March 2005
Location: france
Junior Member
the result of execution of this script give us more than one row
in my forms application i obtain only one.


declare
cursor c1
( b_text in varchar2
) is
select utilisateur
, userpass
from connexion cnx
where cnx.utilisateur like '%'||b_text||'%'
;
begin
open c1 (:bloc3.element_texte4);
fetch c1
into :bloc3.xnom1
, :bloc3.xpass_1;
close c1;
end;

i have :bloc3.xnom1 and :bloc3.xpass_1 an multilign element text



Re: i need help [message #111030 is a reply to message #111029] Sat, 12 March 2005 06:15 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Where do you execute this code? Each call results in ONE record only (one fetch).

MHE
Re: i need help [message #111031 is a reply to message #111030] Sat, 12 March 2005 06:21 Go to previous messageGo to next message
khabbab
Messages: 10
Registered: March 2005
Location: france
Junior Member
how i can fetch all recordes of the cursor when i execute the selection whith like i obtain 4 rows.
Re: i need help [message #111033 is a reply to message #111029] Sat, 12 March 2005 06:33 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Please stop creating new threads when it is all about the same problem...

Your requirements don't make sense.
You want to fill 1 field (:bloc3.xpass_1) with multiple values, namely the multiple rows from the cursor.

Maybe it would make some more sense if you described your block and stated what the multiple rows in the form should look like.

hth
Re: redirect the cursor to forms [message #111097 is a reply to message #111027] Sun, 13 March 2005 18:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Perhaps khabbab needs to use a CREATE_RECORD in their loop(?) to force a 'new line'.

David
Re: redirect the cursor to forms [message #111207 is a reply to message #111027] Mon, 14 March 2005 13:11 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
That would not make sense, since the source-field (:bloc3.element4) is in the same block as the target fields, meaning they will be in the same row!

hth
Re: redirect the cursor to forms [message #111232 is a reply to message #111027] Mon, 14 March 2005 18:54 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Maybe 'element_texte4' should not be in 'bloc3'? In what trigger is this being done? Should this cursor be in a database package and the block be based on that package? Should this be a Master-Detail relationship?

"khabbab" can you give us a few more details about the overall objective of your form?
Re: redirect the cursor to forms [message #111302 is a reply to message #111232] Tue, 15 March 2005 08:40 Go to previous message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

Hello guys....
He wanted this type of solution which I have already provided him. I'm writing here the solution also for other persons.
I'm giving here the solution step by step.

schema used : scott/tiger
Create a new Form.
Create a new Data Block named CONTROL.(Not a database block)
CONTROL is a Multi Record Block showing 10 records.
Create a New Canvas.
Show scrollbar on that Canvas.
Create a text item v_text Recors displayed = 1
Create item empno Records displayed = 10
Create item ename Records displayed = 10
Create button 1 Records displayed = 1 Label Populate
Create button 2 Records displayed = 1 Label Clear

Place the items properly on the Canvas.

When-Button-Pressed Trigger for Button1:
:GLOBAL.g_text := '%'||:control.v_text||'%';
DECLARE
 cursor c1 IS
 SELECT empno, ename
 FROM emp e
 WHERE e.ename LIKE :GLOBAL.g_text;
BEGIN
 OPEN c1;
 FIRST_RECORD;
 LOOP
    FETCH c1 INTO :CONTROL.empno, :CONTROL.ename;
  EXIT WHEN c1%NOTFOUND;
  NEXT_RECORD;
 END LOOP;
 CLOSE c1;
END;
FIRST_RECORD;
Erase('GLOBAL.g_text'); 

When-Button-Pressed Trigger for Button2:
GO_BLOCK('CONTROL');
CLEAR_BLOCK;

Run the Form and you can query the data from emp table giving a condition in the v_text Field.
Cheers!

[Updated on: Fri, 22 September 2006 01:19] by Moderator

Report message to a moderator

Previous Topic: FRM-30041:position of item places it off of canvas
Next Topic: LOV on forms module
Goto Forum:
  


Current Time: Thu Sep 19 14:59:52 CDT 2024