Home > database >  Return value is a multi-line select into, to save and display must use cursor
Return value is a multi-line select into, to save and display must use cursor

Time:09-19

I started learning in recent days, with the select into statement, wants to query to the value of the stock in a VARCHAR2, and DBMS_OUPUT. PUT_LINE displayed, but an error return value is a multiple lines, on the Internet can only return the value of a line, so want to return multiple rows and display can only use the cursor?

CodePudding user response:

Yes, into only one record

CodePudding user response:

It depends, how do you want to show, that is to say, you want to do what kind of operation of the data,

CodePudding user response:

reference 1st floor sxq129601 response:
yes, into only one record

That is to use a cursor? Read from the cursor in the record and display?

CodePudding user response:

refer to the second floor wmxcn2000 response:
, it depends on how you want to show, that is to say, you want to do what kind of operation of the data,

Is what I want to eligible records are displayed, but select into can only return a record but there may be 2 or more,

CodePudding user response:

Then use the cursor;

CodePudding user response:

reference 5 floor wmxcn2000 reply:
then use cursor;

Excuse me. Is there a 2 if eligible records, but I want to have both at the same time display in a DBMS_OUTPUT. PUT_LINE statement should do,
I use a LOOP is shows the two statements,
Such as a personal work had done 2 a and b, I want to show that he did a and b both work, but he had a job with the LOOP show that he had b work, into two sentences

CodePudding user response:

The building Lord research a listagg the function, can merge your data;

CodePudding user response:

The
reference 7 floor wmxcn2000 response:
a study listagg this function, the building Lord can merge your data;

Good thank you

CodePudding user response:

Cursor is the most convenient and intuitive,

CodePudding user response:

The cursor is and how to deal with the query results,

CodePudding user response:

Listagg is a function of oracle 12 c

CodePudding user response:

If you want to display, can only use a cursor,

CodePudding user response:

Char strname [20] [20].
SELECT the name into: strname FROM class A
WHERE A.a ge=18;
  • Related