Change Query Data Source Name block dynamically using From clause query


Usually, we have build a block in Oracle Form Builder using these properties as a default, for example,

Database Data Block = YES
Query Allowed = YES
Query Data Source Type = Table
Query Data Source Name = EMP

But for some cases we want that block change its Query Data Source Name to something else, dynamically.

So to support this, we have to change some properties

Database Data Block = YES
Query Allowed = YES
Query Data Source Type = FROM clause query
Query Data Source Name =SELECT EMPNO, TO_CHAR(NAME) NAME FROM EMP

And then the block has a pre-query like this,

declare
sql_string varchar2(2000);
begin
message(‘before start’);
pause;
sql_string:= ‘(select empno, to_char(name) name from emp)’;
set_block_property(‘blockname’,QUERY_DATA_SOURCE_NAME,sql_string);

go_block(‘blockname’);
clear_block;
execute_query;
pause;
end;

Hope this usefull. ^_^

3 Responses

  1. undeniably…..

  2. من فضلك سيدي
    أنا أريد القيام بتخزين البيانات الموجودة في الحقول بعد الاستعلام بهذه الطريقة
    على قاعدة البيانات
    كيف يمكنني القيام بذلك
    ولك جزيل الشكر

  3. Please Sir
    I want to store the data in the fields after the query this way
    On the database
    How do I do this
    Thank you very much

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: