| |

VerySource

 Forgot password?
 Register
Search
View: 1182|Reply: 9

How to achieve this?

[Copy link]

2

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-3-19 14:00:01
| Show all posts |Read mode
DECLARE
  A NUMBER (16,2);
  B NUMBER (16,2);
BEGIN
  SELECT FIELD1 INTO A, FIELD2 INTO B FROM TABLE;
END;

I find that ORACLE can only be received with one parameter. Is there a similar function?
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-6-23 23:45:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;

- A record type can be used
Reply

Use magic Report

2

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

 Author| Post time: 2020-6-24 14:30:01
| Show all posts
I haven’t used it.
Ha ha. Do you want to define a structure yourself?
Then receive again?
Reply

Use magic Report

0

Threads

71

Posts

50.00

Credits

Newbie

Rank: 1

Credits
50.00

 China

Post time: 2020-7-2 15:45:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;
This is to put all the fields of the table as a table structure into A
Reply

Use magic Report

2

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

 Author| Post time: 2020-7-8 22:00:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;
Report an error.
% This is wrong...
I tried a downstream standard. Can be achieved.
One more question. How to get the COUNT of the number of cursor records?
Reply

Use magic Report

2

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

 Author| Post time: 2020-7-22 22:15:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;

Suppose there is an error when the number of records is greater than 1.
Reply

Use magic Report

2

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

 Author| Post time: 2020-7-23 06:00:02
| Show all posts
Suppose I write it like this and it is wrong.
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT FIELDA,FIELDB INTO A FROM TABLE ...;
END;
It should be related to the definition part,
A TABLE%ROWTYPE... is this TABLE related?
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-7-25 13:15:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;
Report an error.
%This is wrong...
I tried a downstream bid. It can be achieved.

Ask another question. How to get the COUNT of the number of cursor records?
Define a variable a
open cursor
Loop to get cursor variable
a:=cursor%rowcount;
--cursor%rowcount determines the number of rows of records fetched from the cursor, only the records of the cursor have been obtained, in order to get the number of records of the cursor
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-7-25 13:45:01
| Show all posts
DECLARE
  A TABLE%rowtype;
BEGIN
  SELECT * INTO A FROM TABLE ...;
END;

Suppose there is an error when the number of records is greater than 1.
-
Greater than 1, you can use a cursor
Reply

Use magic Report

0

Threads

13

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-7-27 12:00:02
| Show all posts
Many people don't read books or search, and they just ask simple questions. It is recommended that beginners lay a good foundation, read more books, and check more information.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list