Mungkin bisa menggunakan package EXEC_SQL di Form.
Contoh sbg berikut saya copy-kan dari help-nya OraDev.
Semoga bermanfaat,
~holly~
=====================================================
PROCEDURE esdesccol(tablename VARCHAR2) IS
connection_id EXEC_SQL.CONNTYPE;
cursor_number EXEC_SQL.CURSTYPE;
sql_str VARCHAR2(256);
nIgnore PLS_INTEGER;
nColumns PLS_INTEGER := 0; --count of number of columns returned
colName VARCHAR2(30);
colLen PLS_INTEGER;
colType PLS_INTEGER;
BEGIN
connection_id := EXEC_SQL.OPEN_CONNECTION('connection_string');
--
-- when you do a "select *..." from a table which is known only at
runtime,
-- you cannot know what the columns are a priori.
EXEC_SQL.Describe_Column becomes
-- very usefule then
--
sql_str := 'select * from ' || tablename;
cursor_number := EXEC_SQL.OPEN_CURSOR(connection_id);
EXEC_SQL.PARSE(connection_id, cursor_number, sql_str, exec_sql.V7);
nIgnore := EXEC_SQL.EXECUTE(connection_id, cursor_number);
LOOP
nColumns := nColumns + 1; --used as column index into result set
--
-- describe_column is in general used within a PL/SQL block with an
exception
-- block included to catch the EXEC_SQL.invalid_column_number
exception.
-- when no more columns are found, we can store the returned column
names
-- and column lengths in a PL/SQL table of records and do further
queries
-- to obtain rows from the table. In this example, colName, colLen
and colType
-- are used to store the returned column characteristics.
--
BEGIN
EXEC_SQL.DESCRIBE_COLUMN(connection_id, cursor_number,
nColumns, colName, colLen, colType);
TEXT_IO.PUT_LINE(' col= ' || nColumns || ' name ' || colName
||
' len= ' || colLen || ' type ' || colType );
EXCEPTION
WHEN EXEC_SQL.INVALID_COLUMN_NUMBER THEN
EXIT;
END;
END LOOP;
nColumns := nColumns - 1;
IF (nColumns <= 0) THEN
TEXT_IO.PUT_LINE('No columns returned in query');
END IF;
EXEC_SQL.CLOSE_CURSOR(connection_id, cursor_number);
EXEC_SQL.CLOSE_CONNECTION(connection_id);
END;
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Yulius Wibowo
> Sent: Friday, February 24, 2006 11:41 AM
> To: [email protected]
> Subject: [indo-oracle] Re: Cursor Secara Fleksibel Pada Oracle Dev 6.0
>
> Setahu saya di FORM kita tidak bisa menggunakan dynamic cursor.
>
> Note:
> Berikut ini contoh DYNAMIC CURSOR program PL/SQL di
> server-side (database server)
> SQL> SET SERVEROUTPUT ON
>
> SQL> DECLARE
> TYPE cur_typ IS REF CURSOR;
> c_cursor cur_typ;
> v_query VARCHAR2(1000);
> v_nama_table VARCHAR2(30) := 'DEPT';
> v_hasil DEPT%ROWTYPE;
> BEGIN
> v_query := 'SELECT * FROM ' || v_nama_table;
> OPEN c_cursor FOR v_query;
> LOOP
> FETCH c_cursor INTO v_hasil;
> DBMS_OUTPUT.PUT_LINE(v_hasil.deptno ||' - ' || v_hasil.dname);
> EXIT WHEN c_cursor%NOTFOUND;
> END LOOP;
> CLOSE c_cursor;
> END;
> /
>
> 10 - ACCOUNTING
> 20 - RESEARCH
> 30 - SALES
> 40 - OPERATIONS
> 40 - OPERATIONS
>
> Bowo
>
>
>
>
> --- In [email protected], agus sulaiman <[EMAIL PROTECTED]>
> wrote:
> >
> > Kepada Teman-teman semuanya,
> > Terima kasih atas masukkanya. Saya sudah cek dengan form_dll
> memang bisa.
> > Tapi kalo untuk dicursor bagaimana caranya , apa bisa fungsi
> form_dll kita buat dicursor ?
> > sepertinya tidak bisa ya.
> > sebagai contoh:
> > Declare
> > forms_dll ('cursor c_test is select * from '||vtable);
> >
> > Begin
> >
> > For x in c_test loop
> > Null;
> >
> > End loop;
> > End;
> > Error: Encountered the symbol (.
> >
> > Thanks,
> > Agus Sulaiman.
--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.lizt.org (NEW)
-----------------------------------------------
Bergabung dengan Indonesia Thin Client User Groups,
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.vze.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indo-oracle/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/