2014-07-01 81 views
0

我有以下可打印記錄參數的plsql腳本。 有沒有辦法打印只是通過country_record的所有列值。 我的意思是,我不想寫所有列名狀country_record.country_id僅通過PLSQL打印所有列值

DECLARE 
     country_record countries%ROWTYPE; 
     countryid  countries.country_id%TYPE; 
    BEGIN 
     countryid := &countryid; 

     SELECT * 
     INTO country_record 
     FROM countries 
     WHERE country_id = countryid; 

     DBMS_OUTPUT.put_line ('id: ' || country_record.country_id); 
    END; 
+1

你會發現你的答案在這裏:http://stackoverflow.com/questions/8717251/print-record-fields-in-pl-sql –

回答

1

如果打印這一切你想要的,你可以嘗試一下這個。使用SQL*Plus

VARIABLE MYCUR SYSREFCURSOR; 

DECLARE 
     country_record countries%ROWTYPE; 
     countryid  countries.country_id%TYPE; 
     plsql_cursor SYS_REFCURSOR; 
    BEGIN 
     countryid := &countryid; 

     OPEN :MYCUR for 
     SELECT * 
     FROM countries 
     WHERE country_id = countryid; 

    END; 
/

    print mycur; 
+0

我使用的蟾蜍,有沒有類似的解決方案它? –

+0

相同的概念,答案[這裏](http://stackoverflow.com/questions/12747823/how-to-display-a-sys-refcursor-data-in-toads-datagrid) –