Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Form 4.5 and cursor
You have to use the Oracle DBMS_SQL dynamic SQL package if you want to query a table and get data values back from it, but you don't know the exact table and columns at design time.
The Forms_DDL command won't work. It is a one-way street -- you can't get values back from it. Unfortunately, DBMS_SQL is not as easy to use as Forms_DDL.
The QA dynamic utility form uses the DBMS_SQL package to give access to any table.
HTH,
Steve Cosner
In article <3498337E.2DE9045_at_quebim.com>,
Lando <MarkL_at_quebim.com> wrote:
>
> What you are doing will not work. To do something like this you need
> to use dynamic sql. Check out package forms_ddl. Even then you may
> have problems since you will be trying to do dynamic sql in an
> explicit cursor declaration. You may find is easier to use an
> implicit cursor, that is, just do the select (using forms_ddl)
> without declaring a cursor. You will also encounter problems when
> you try to do the select...into using forms_ddl. Basically, no value
> is ends up being stored in the variable being selected into even
> though the statement will execute successfully. I have not worked
> this part out yet, so let me know if you come up with a solution.
In article <677tdg$71t_at_argentina.earthlink.net>,
khw_at_earthlink.net wrote:
>
> Hi everyone
>
> I am trying to pass the parameters to the Oracle form for the cursor
> variable, but I have not been able to so
>
> For example, for simplicity
>
> A table, table_1 with 3 fields (field1,field2, field3).
>
> In PL/SQL,
>
> It will be "select field1 from table_1 where field_2 = 'abc'"
>
> However if I have a procedure, test
>
> procedure test(table_name char, f_1 char,f_2) is
> CURSOR DATA_CURSOR(table_name char,f_l char, f_2 char) IS
> SELECT DISTINCT f_1
> FROM table_name
> where f_2 = 'abc';
> begin
> open data_cursor(table_1,f_1,f_2);
> ....
> end;
>
> --call test
>
> test('table_1','field_1','field_2');
>
> I know test does not work because I can not get the result what I
> want, but what do I have to do to modify test procedure so I will be
> able to pass the parameters into the cursor
>
> Thank you
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Wed Dec 17 1997 - 00:00:00 CST