0

I have following plsql script that prints record parameters. Is there a way to print all column values just passing country_record. I mean I do not want to write all column name like country_record.country_id

 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;
Ahmet Karakaya
  • 9,899
  • 23
  • 86
  • 141
  • 1
    You will find your answer here: http://stackoverflow.com/questions/8717251/print-record-fields-in-pl-sql – rtbf Jul 01 '14 at 06:55

1 Answers1

1

If printing it all you wanted, you can try out this. Using 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;
Maheswaran Ravisankar
  • 17,652
  • 6
  • 47
  • 69