网球

plsql索引表 批量绑定问题

2019-09-13 20:41:15来源:励志吧0次阅读

plsql索引表 批量绑定问题

SQL code

DECLARE

TYPE STUDENT_INDEX_TABLE_TYPE IS TABLE OF STUDENT%ROWTYPE INDEX BY BINARY_INTEGER;

student_index_table STUDENT_INDEX_TABLE_TYPE;

BEGIN

SELECT * BULK COLLECT INTO student_index_table FROM STUDENT;

dbms_output.put_line(student_index_table(1).sname);

END;CREATE TABLE STUDENT

(

SID VARCHAR(10) PRIMARY KEY,

SNAME VARCHAR(10),

SCORE INT

)INSERT INTO STUDENT VALUES("1","AA",88);

INSERT INTO STUDENT VALUES("2","PP",66);

INSERT INTO STUDENT VALUES("3","OO",55);

SQL code16:01:20 tina@PRACTICE> select * from student;

SID SNAME SCORE

---------- ---------- ----------

1 AA 88

2 PP 66

3 OO 55

已用时间: 00: 00: 00.01

16:01:29 tina@PRACTICE> DECLARE

16:01:43 2 TYPE STUDENT_INDEX_TABLE_TYPE IS TABLE OF STUDENT%ROWTYPE INDEX BY BINARY_INTEGER;

16:01:43 3 student_index_table STUDENT_INDEX_TABLE_TYPE;

16:01:43 4 BEGIN

16:01:43 5 SELECT * BULK COLLECT INTO student_index_table FROM STUDENT;

16:01:43 6 dbms_output.put_line(student_index_table(1).sname);

16:01:43 7 END;

16:01:44 8 /

AA

PL/SQL 过程已成功完成。

已用时间: 00: 00: 00.00

剖宫产术后轻微便秘
婴儿发烧怎么办退烧快
宝宝发烧反复怎么办
血栓吃什么
分享到: