execute_query between two text items [message #659200] |
Mon, 09 January 2017 07:18  |
 |
zaibi
Messages: 17 Registered: January 2017
|
Junior Member |
|
|
hi experts..
i need help regarding 6i and 11g forms
i need to execute_query between two given text items and also show 2nd block.
in this pic. i tried show all records between 6000 and 11000.but not executed
please experts do some help.

[mod-edit: imaged inserted into message body by bb]
-
Attachment: 6i.JPG
(Size: 86.09KB, Downloaded 3090 times)
[Updated on: Mon, 09 January 2017 23:09] by Moderator Report message to a moderator
|
|
|
Re: execute_query between two text items [message #659205 is a reply to message #659200] |
Mon, 09 January 2017 09:26   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
Many of us are prevented from viewing attachments. Please post it inline.
So, with that being said, I do not know what you want to do.
Do you want a user to input two different numbers and display all rows where a column value falls between those two numbers? If so, then use SET_BLOCK_PROPERTY with DEFAULT_WHERE.
|
|
|
|
|
|
Re: execute_query between two text items [message #659218 is a reply to message #659210] |
Mon, 09 January 2017 13:07   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
zaibi wrote on Mon, 09 January 2017 11:06:global.salary:=:salary1 between :salary2;
execute_query(no_validate);
between is no run i need code
Of course that won't work. It doesn't even make sense.
You have to build a where clause and use SET_BLOCK_PROPERTY as I have said. You can use Forms Help to see how to use SET_BLOCK_PROPERTY with either DEFAULT_WHERE or ONETIME_WHERE.
Sample where clause is:
'where some_column between '||:some_value||' and '||:some_other_value||'' .
[Updated on: Mon, 09 January 2017 13:08] Report message to a moderator
|
|
|
|
Re: execute_query between two text items [message #659220 is a reply to message #659219] |
Mon, 09 January 2017 16:37   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
Thanks Littlefoot. I sometimes forget when I have to "build" the statement and when I can just use it. I usually just do it one way, try running it, only to find out I did it the wrong way, and then fix it. I never learn from my mistakes.
I think a lot of times I am using many conditions, with conditional code to build parts of the where clause, and that's when I have to concatenate. Or not.
[Updated on: Mon, 09 January 2017 16:40] Report message to a moderator
|
|
|
|
|
|
|
|
Re: execute_query between two text items [message #659253 is a reply to message #659232] |
Tue, 10 January 2017 10:10   |
 |
zaibi
Messages: 17 Registered: January 2017
|
Junior Member |
|
|
DECLARE
c_where VARCHAR2(100);
Blk_Id BLOCK;
BEGIN
c_where := 'last_name like '''|| :your block.last_name_search||'%''';
Blk_Id := find_block('your block');
Set_block_Property (Blk_Id , default_where, c_where);
execute_query;
END;
this code not running.
i have F_name(text_item) and table name is employees so what changes will be done???
-
Attachment: ee.JPG
(Size: 70.50KB, Downloaded 1396 times)
[Updated on: Tue, 10 January 2017 10:12] Report message to a moderator
|
|
|
|
|
|
Re: execute_query between two text items [message #659261 is a reply to message #659253] |
Tue, 10 January 2017 12:41   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
zaibi wrote on Tue, 10 January 2017 11:10DECLARE
c_where VARCHAR2(100);
Blk_Id BLOCK;
BEGIN
c_where := 'last_name like '''|| :your block.last_name_search||'%''';
Blk_Id := find_block('your block');
Set_block_Property (Blk_Id , default_where, c_where);
execute_query;
END;
this code not running.
i have F_name(text_item) and table name is employees so what changes will be done???
Well, if you really have literal code that says Blk_Id := find_block('your block'); then it will not work.
I also told you that attached images are not helpful.
What is the use of Blk_Id. Why not just use the block name. I doubt it is an unknown.
|
|
|
Re: execute_query between two text items [message #659273 is a reply to message #659255] |
Wed, 11 January 2017 03:50   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
zaibi wrote on Tue, 10 January 2017 16:31in this code cant understand last_name and :your block.last_name__search.
So that's sample code you've copied from somewhere else?
last_name would be the name of a column in the table the block is based on.
:your block.last_name_search would be the name of an item in the datablock.
If you don't have columns/items/blocks with those names then you need to change the names to match columns/items/blocks you do have.
|
|
|
|