Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

2011-10-20% use of TYPE

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Http://www.itpub.net/thread-1499223-7-1.html

65th floor

I created these types and tables:

CREATE TYPE plch_food_t AS OBJECT (name VARCHAR2); / CREATE or replace TYPE plch_food_nt IS TABLE OF VARCHAR2 / CREATE TABLE plch_food (name VARCHAR2) / CREATE OR REPLACE PACKAGE plch_pkgIS TYPE food_rt IS RECORD (name VARCHAR2); END;/

Which of the following options will display "Brussels Sprouts" after execution?

(A)

DECLARE l_var plch_food.name%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END;/SQL > DECLARE 2 l_var plch_food.name%TYPE: =' Brussels Sprouts'; 3 BEGIN 4 DBMS_OUTPUT.put_line (l_var); 5 END; 6 / Brussels SproutsPL/SQL procedure successfully completedSQL >

(B)

DECLARE l_var plch_food_nt%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END;/SQL > DECLARE 2 l_var plch_food_nt%TYPE: =' Brussels Sprouts'; 3 BEGIN 4 DBMS_OUTPUT.put_line (l_var); 5 END; 6 / DECLARE l_var plch_food_nt%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END ORA-06550: line 2, column 12: PLS-00206:% TYPE must be used for variables, columns, fields or attributes, not 'PLCH_FOOD_NT'ORA-06550: line 2, column 12: PL/SQL: Item ignoredORA-06550: line 4, column 26: PLS-00320: the type declaration of this expression is incomplete or malformed ORA-06550: line 4, column 4: PL/SQL: Statement ignoredSQL >

(C)

DECLARE l_var plch_food_t.name%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END;/SQL > DECLARE 2 l_var plch_food_t.name%TYPE: =' Brussels Sprouts'; 3 BEGIN 4 DBMS_OUTPUT.put_line (l_var); 5 END; 6 / DECLARE l_var plch_food_t.name%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END ORA-06550: line 2, column 12: PLS-00206:% TYPE must be used for variables, columns, fields or attributes, not 'PLCH_FOOD_T.NAME'ORA-06550: line 2, column 12: PL/SQL: Item ignoredORA-06550: line 4, column 26: PLS-00320: the type declaration of this expression is incomplete or malformed ORA-06550: line 4, column 4: PL/SQL: Statement ignoredSQL >

(D)

DECLARE l_var plch_pkg.food_rt.name%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END;/SQL > DECLARE 2 l_var plch_pkg.food_rt.name%TYPE: =' Brussels Sprouts'; 3 BEGIN 4 DBMS_OUTPUT.put_line (l_var); 5 END; 6 / DECLARE l_var plch_pkg.food_rt.name%TYPE: = 'Brussels Sprouts' BEGIN DBMS_OUTPUT.put_line (l_var); END ORA-06550: line 2, column 12: PLS-00206:% TYPE must be used for variables, columns, fields or attributes, not 'PLCH_PKG.FOOD_RT.NAME'ORA-06550: line 2, column 12: PL/SQL: Item ignoredORA-06550: line 4, column 26: PLS-00320: the type declaration of this expression is incomplete or malformed ORA-06550: line 4, column 4: PL/SQL: Statement ignoredSQL >

Answer A

The answer shows that the 70th floor

2011-10-20 answer Why not AD? You cannot use% TYPE directly for a record type. You must first declare a variable based on that record type, and then use% TYPE:DECLARE l_food plch_pkg.food_rt; l_var l_food.name%TYPE: = 'Brussels Sprouts';BEGIN DBMS_OUTPUT.put_line (l_var); END;/SQL > DECLARE 2 l_food plch_pkg.food_rt for this variable 3 l_var l_food.name%TYPE: = 'Brussels Sprouts'; 4 BEGIN 5 DBMS_OUTPUT.put_line (l_var); 6 END; 7 / Brussels SproutsPL/SQL procedure successfully completedSQL >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report