Home » Developer & Programmer » Forms » NO DATA FOUND
NO DATA FOUND [message #165814] Sun, 02 April 2006 03:58 Go to next message
juicyapple
Messages: 92
Registered: October 2005
Member
I add a Post-Text-Item trigger on a item textfield, if user key in A item, it query stock table for value of ind, if ind = Y, it will set date textfield as required and enabled. When I run the form and query for data, it shows error

POST-TEXT-ITEM trigger raised unhandled exception ORA-01403
ORA-01403: no data found

the codes are as below,
DECLARE
  ind  stock._ind%TYPE;
BEGIN
  SELECT ind
  INTO   ind
  FROM   stock
  WHERE  item = :form1.item;
  
  IF ind = 'Y' THEN
    Set_item_property('stock.date',
                      required,
                      property_true);
    
    Set_item_property('stock.date',
                      enabled,
                      property_true);
  ELSE
    Set_item_property('stock.date',
                      required,
                      property_false);
    
    Set_item_property('stock.date',
                      enabled,
                      property_false);
  END IF;
END;

I am not sure is the problem because of the null value of ind in stock table. Please advise and give some guide on solving this.

Thanks.

Upd-mod: Please format your code and palce between 'code' tags.

[Updated on: Mon, 03 April 2006 02:36] by Moderator

Report message to a moderator

Re: NO DATA FOUND [message #165847 is a reply to message #165814] Mon, 03 April 2006 01:25 Go to previous messageGo to next message
pallavigs
Messages: 37
Registered: March 2006
Location: India
Member
Hi,

In a host language program, all records have been fetched. The return code from the fetch was +4, indicating that all records have been returned from the SQL query.

Try terminate processing for the SELECT statement.

May be this will be helpful.

Pal.
Re: NO DATA FOUND [message #165871 is a reply to message #165814] Mon, 03 April 2006 02:50 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay ... either search this forum for 'set_item_property' and then 'set_item_instance_property', or read th ereference manual on these two commands.

You must 'enable' a field before you can make it 'reguired', and you must also make the field 'updateable', and, maybe, 'navigable'.

I would also suggest doing this logic in the When-Validate-Item trigger of the item 'form1.item'.

I also suggest NOT naming your block 'FORM1'. It will become very confusing when you have many blocks and items and you are attacking your form through a flat editor or hex editor.

David
Re: NO DATA FOUND [message #165887 is a reply to message #165847] Mon, 03 April 2006 03:38 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
I have to query from stock table to get the value of ind and thus to determine item property in form1.

Is the problem because of null value return from the select statement? I know the problem is because of it but I don't know why...

Please advise.
Re: NO DATA FOUND [message #166020 is a reply to message #165887] Tue, 04 April 2006 01:55 Go to previous messageGo to next message
RAS_SANKAR
Messages: 42
Registered: March 2006
Location: India
Member
what do u want to do if ind value is null?
u can use
exception
when no_data_found then
.....
end;
Re: NO DATA FOUND [message #166168 is a reply to message #166020] Tue, 04 April 2006 23:34 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
On what table is the block 'Form1' based? If the block 'Form1' is based on the table 'stock' that you define the column 'ind' even though you don't display it, then put your logic into the Post-Query trigger and in the When-Validate-Item trigger.

David
Re: NO DATA FOUND [message #166360 is a reply to message #166020] Wed, 05 April 2006 21:52 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
yup, I have include

exception
when no_data_found then
return null;

but the problem still cannot be solved..
Re: NO DATA FOUND [message #166401 is a reply to message #166360] Thu, 06 April 2006 02:58 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
WHAT IS THE NAME OF YOUR FORM?
WHAT IS THE NAME OF YOUR BLOCK?

David
Re: NO DATA FOUND [message #166402 is a reply to message #165814] Thu, 06 April 2006 03:03 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
Form name is mtransac and block name is mtransac. Ind value is query from stock table.
Re: NO DATA FOUND [message #166405 is a reply to message #166402] Thu, 06 April 2006 03:10 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Then the code should be
  SELECT ind
  INTO   ind
  FROM   stock
  WHERE  item = :mtransac.item;

Have you signed on? Have you tested your code at the SQL*Plus prompt having signed on using the same userid?

David

[Updated on: Thu, 06 April 2006 03:12]

Report message to a moderator

Re: NO DATA FOUND [message #166409 is a reply to message #165814] Thu, 06 April 2006 03:40 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
yes, when I query from sqlplus,

SQL> select ind from stock
2 where item='1002825';

W
-

SQL>

But when I put the codes in Post-Text-Item trigger on a item textfield, I still get the error
POST-TEXT-ITEM trigger raised unhandled exception ORA-01403
ORA-01403: no data found

DECLARE
  ind  stock.ind%TYPE;
BEGIN
  SELECT ind
  INTO   ind
  FROM   stock
  WHERE  item = :mtransac.item;
  
  IF ind = 'Y' THEN
    Set_item_property('mtransac.date',
                      required,
                      property_true);
    
    Set_item_property('mtransac.date',
                      enabled,
                      property_true);
  ELSE
    Set_item_property('mtransac.date',
                      required,
                      property_false);
    
    Set_item_property('mtransac.date',
                      enabled,
                      property_false);
  END IF;
END;
Re: NO DATA FOUND [message #166498 is a reply to message #165814] Thu, 06 April 2006 12:02 Go to previous messageGo to next message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
DECLARE
  ind  stock.ind%TYPE;
BEGIN
  SELECT ind
  INTO   ind
  FROM   stock
  WHERE  item = :mtransac.item;
  
  IF ind = 'Y' THEN
    Set_item_property('mtransac.date',
                      required,
                      property_true);
    
    Set_item_property('mtransac.date',
                      enabled,
                      property_true);
  ELSE
    Set_item_property('mtransac.date',
                      required,
                      property_false);
    
    Set_item_property('mtransac.date',
                      enabled,
                      property_false);
  END IF;

EXCEPTION
WHEN NO_DATA_FOUND THEN
  Set_item_property('mtransac.date',
                    required,
                    property_false);

  Set_item_property('mtransac.date',
                    enabled,
                    property_false);

WHEN OTHERS THEN
  Set_item_property('mtransac.date',
                    required,
                    property_false);

  Set_item_property('mtransac.date',
                    enabled,
                    property_false);
END;
Re: NO DATA FOUND [message #166542 is a reply to message #166409] Thu, 06 April 2006 20:36 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What is this?
Quote:

SQL> select ind from stock
2 where item='1002825';

W
-

SQL>

If this was output from 'real' then the 'W' would be an 'I'.

Please try it again. How about using a few items, and show us both the 'item' and 'ind' columns.

David
Re: NO DATA FOUND [message #167067 is a reply to message #166498] Tue, 11 April 2006 03:22 Go to previous message
juicyapple
Messages: 92
Registered: October 2005
Member
Thanks all, it works now.
Previous Topic: java error when running Translate Utility
Next Topic: POPULATING DATA FOR 3 DATA BLOCKS
Goto Forum:
  


Current Time: Fri Sep 20 06:34:25 CDT 2024