Execute query with where clause in Forms [message #77827] |
Wed, 28 November 2001 16:02 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Imran
Messages: 56 Registered: November 2001
|
Member |
|
|
i designed a form and can easily execute query with respect to one text item value.
My problem is that first i make a block based on table
and then i make a text item and a push button on the same canvas both these two items are non database.
and i Enter a Date value in this text item and Press the Button and code which i write on when button press trigger is :
declare
n number;
m number;
begin
go_block('BANK_TRANS_BLOCK2');
SET_BLOCK_PROPERTY('BANK_TRANS_BLOCK2',DEFAULT_WHERE,
'BANK_TRANS.DATE_OF_ENTRY =' ||
to_date(:BANK_TRANS_BLOCK2.DATE_OF_ENTRE,'DD-MON-YY'));
CLEAR_RECORD;
EXECUTE_QUERY;
DISPLAY_ERROR;
IF GET_BLOCK_PROPERTY('BANK_TRANS_BLOCK2',QUERY_HITS) = 0 THEN
n := SHOW_ALERT('DATE_NOTFOUND_ALERT');
CLEAR_RECORD;
END IF;
END;
it is unable for me to execute query with respect to any Date or Varchar2 value but this code fullfill the requirements for a Number value.
Means i can apply this type of code on Numbers and find out good result but when i applied it on Date or Varchar2 values i found errors.
Please help me for solve this problem.
for More informations please e-mail me without any hesitation.
i shall be thankful to you.
Imran.
----------------------------------------------------------------------
|
|
|
Re: Execute query with where clause in Forms [message #77834 is a reply to message #77827] |
Thu, 29 November 2001 10:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Shilpa
Messages: 59 Registered: November 2001
|
Member |
|
|
You have to concatenate a single quote before the value for Varchar2 and Date fields.
For example:
go_block('emp');
set_block_property('emp',default_where,'where ename = '||''''||:emp.tempname||'''');
execute_query;
set_block_property('emp',default_where,'');
----------------------------------------------------------------------
|
|
|