hitTest for clips nested table
Working on this on and outside all day and am having no luck.On the stage are 3 instances of a Target MovieClip. In a script, an empty MovieClip is created. Then, MCs (Pentagon, square and Triangle) are added to the library in the empty MC. At that time, made a table listing the names of occurrence of these MCs.
I would use this table (aInstanceNamesInMCContainer) to carry out a hit against the MCs of the target test, but I'm getting hung up on the syntax. The problem is that I am not correctly nested MC, but I was unable to find the solution.
Any help is appreciated.
Following code tested with your .fla:
Tags: Adobe Animate
Similar Questions
-
ORA-21700: object does not exist or is marked for deletion - nested table
Hi, please see my procedure. It comes to delete records in a table whose primary keys will be given in comma separated format.
but he triggers the following error
ORA-21700: object does not exist or is marked for deletion
ORA-06512: at the 'scott '. PKG_COUNTRY', line 4598
ORA-06512: at line 10
Pr_Del_Regional_DtlORA-21700: object does not exist or is marked for deletion
Process is complete.
Disconnection from the database tfo_user-watson.
/ * In format on 12/05/2011 14:47 (trainer more v4.8.7) * /.
Varchar_table. ARRAY TYPE IS VARCHAR2 (5); -in the scope of package
PROCEDURE Pr_Del_Regional_Dtl)
pi_v_country_id IN VARCHAR2, seperateed comma for deletion
po_results ON sys_refcursor
)
IS
l_varchar_table varchar_table: = varchar_table ();
BEGIN
pr_split_varchar_values (pi_v_country_id, l_varchar_table); -divides: separation by a comma to the nested table.
DELETE FROM regional_setup
WHERE country_id IN (SELECT *)
TABLE (l_varchar_table)); -removed
EXCEPTION
WHILE OTHERS
THEN
DBMS_OUTPUT. Put_line ("Pr_Del_Regional_Dtl" |) SQLERRM);
LIFT;
END Pr_Del_Regional_Dtl;
split-
PROCEDURE pr_split_varchar_values)
pi_v_values IN VARCHAR2,
op_varchar_table ON varchar_table
)
IS
l_v_value VARCHAR2 (3000);
l_value VARCHAR2 (10);
I PLS_INTEGER: = 0;
BEGIN
op_varchar_table: = varchar_table ();
l_v_value: = pi_v_values;
IN all, LENGTH (l_v_value) > 0
LOOP
i: = i + 1;
IF INSTR (l_v_value, ",") > 0
THEN
op_varchar_table. EXTEND;
op_varchar_table (i): =.
LTRIM (RTRIM (SUBSTR (l_v_value, 0, INSTR (l_v_value, ",") - 1)));
ON THE OTHER
op_varchar_table. EXTEND;
op_varchar_table (i): = LTRIM (RTRIM (l_v_value));
l_v_value: = ";
END IF;
l_v_value: =.
SUBSTR (l_v_value, INSTR (l_v_value, ",") + 1,
LENGTH (l_v_value));
END LOOP;
END pr_split_varchar_values;
Thanks in advanceTYPE varchar_table IS TABLE OF VARCHAR2(5); -- in package scope
Have you declared in package or database? Remember, local collection cannot be used in the SQL statement.
-
When you create a table nested within a table, can I please have a description of what the STORE AS medium of instruction?
Here is an example:
NESTED TABLE, STORE LineItemList_ntab AS PoLine_ntab
I have had a look in the documentation, but cannot find the answer to this question.
Published by: 996403 on May 7, 2013 22:50Sound the segment of nested table name, 11 g, you can also have SECUREFICHIERS as for example you can thus encrypt, oracle doc said The Oracle database server stores data for the nested table offline from the lines of the parent table, using a table of store that is associated with the nested table column. The parent row contains a value to set unique identifier associated with a nested table instance. See http://docs.oracle.com/cd/B28359_01/server.111/b28318/schema.htm#CHDFDBGH
Published by: Karan on May 8, 2013 11:38
-
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
Hello
I tried to create a function that might return the type that is created on the outside.
So I wrote script below. until the function created it compiled successfully, but after that, when the data querying, we encountered error,
"ORA-22907: invalid CAST to a type that is not a nested table or VARRAY.
SQL> create table emp 2 ( 3 ename varchar2(200 byte), 4 mgr number, 5 employee_id number 6 ); Table created. SQL> insert into emp (ename, mgr, employee_id) 2 values ('king', 12, 1); 1 row created. SQL> insert into emp (ename, mgr, employee_id) 2 values ('clark', 12, 2); 1 row created. SQL> commit; Commit complete. SQL> create or replace type t_emp as object (ename varchar2 (200), mgr number, employee_id number); 2 / Type created. SQL> create or replace function f_emp return t_emp 2 is 3 type rc_emp is ref cursor; 4 r_emp rc_emp; 5 v_emp t_emp; 6 begin 7 open r_emp for select * from emp where rownum=1; 8 fetch r_emp into v_emp; 9 close r_emp; 10 return v_emp; 11 exception 12 when others then 13 dbms_output.put_line(dbms_utility.format_error_stack); 14 dbms_output.put_line(dbms_utility.format_call_stack); 15 dbms_output.put_line(dbms_utility.format_error_backtrace); 16 raise_application_error(-20001,sqlerrm); 17 end; 18 / Function created. SQL> show errors; No errors. SQL> select * from f_emp; select * from f_emp * ERROR at line 1: ORA-04044: procedure, function, package, or type is not allowed here SQL> select * from table(cast (f_emp as t_emp)); select * from table(cast (f_emp as t_emp)) * ERROR at line 1: ORA-22907: invalid CAST to a type that is not a nested table or VARRAY SQL>
Like this:
...
CREATE or REPLACE TYPE t_emp_array IS TABLE OF THE t_emp;
/
FUNCTION to CREATE or REPLACE f_emp RETURN t_emp_array
is
type rc_emp is ref cursor;
r_emp rc_emp;
v_emp_array t_emp_array: = t_emp_array();
BEGIN
R_emp OPEN for SELECT t_emp(ename,mgr,employee_id) FROM emp WHERE ROWNUM = 1;
collect the fetch r_emp in bulk in v_emp_array;
CLOSE R_emp;
Return v_emp_array;
exception
while others then
dbms_output.put_line (dbms_utility.format_error_stack);
dbms_output.put_line (dbms_utility.format_call_stack);
dbms_output.put_line (dbms_utility.format_error_backtrace);
raise_application_error (-20001, SQLERRM);
end;
/
SELECT *.
table (f_emp ());
a table function works with a table (nested table or varray)
HTH
-
Error in initialization of multilevel nested table type
Hello
Database version: Oracle 11 g R2
I am creating a complex process I need to create complex nested table types and use them in code.
{code}
CREATE or REPLACE TYPE ws_data_compare_rt
AS AN OBJECT
(
external_web_service_id NUMBER (10),
service_code VARCHAR2 (30),
ws_bridging_id NUMBER (10),
ws_attribute_name VARCHAR2 (64).
ws_attribute_value VARCHAR2 (32767).
in_source_attribute VARCHAR2 (30),
in_source_value VARCHAR2 (32767).
comparison_rule VARCHAR2 (100)
);
CREATE or REPLACE TYPE ws_data_compare_tt IS TABLE OF THE ws_data_compare_rt;
CREATE or REPLACE TYPE ws_data_compare_master_rt
AS AN OBJECT
(
key_attribute_1 VARCHAR2 (30),
NUMBER of key_attribute1_value
key_attribute_2 VARCHAR2 (30),
NUMBER of key_attribute2_value
m_ws_data_compare_tt ws_data_compare_tt
);
/
CREATE or REPLACE TYPE ws_data_compare_master_tt IS TABLE OF THE ws_data_compare_master_rt;
{code}
The objects have been created successfully. However when I use it in my code, I need to initialize them, but I get an error for the variable of ws_data_compare_master_tt type initialization.
{code}
...
g_ws_data_compare_rt ws_data_compare_rt: = ws_data_compare_rt (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
g_ws_data_compare_tt ws_data_compare_tt: = ws_data_compare_tt();
g_ws_data_compare_master_rt ws_data_compare_master_rt: = ws_data_compare_master_rt (NULL, NULL, NULL, NULL, g_ws_data_compare_tt);
g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();
...
{code}
I'm unable to initialize the variable g_ws_data_compare_master_tt of type ws_data_compare_master_tt that I get the below error.
For PACKAGE BODY UTL compile errors. PKG_WS_UTIL
Error: PLS-00222: no function with name 'WS_DATA_COMPARE_MASTER_TT' does exist in this scope
Line: 28
Text: g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();
Error: PL/SQL: ignored element
Line: 28
Text: g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();
Can someone help me to find out what is the problem?
Thanks in advance.
Kind regards
Natarajan
Ah, I found the problem on my own. It was because of a bad statement similarly variable g_ws_data_compare_master_tt in a table in the specification of the package that was trouble. However I wonder the error returned Oracle was not fully exposed.
Kind regards
Natarajan
-
Compare the content of two equal nested tables
I'm working on a black box test where I compare the contents of two structurally equal tables before and after executing a script of some. My two tables, MDQ_OLD and MDQ_NEW, are filled with the data in two separate operations.
The two tables, I'll compare are nested, as you can see in the CREATE TABLE scripts below.
I tried to use the less-operator sign, but without success.
I also tried to select data in a type that is % ROWTYPE to my nested tables, but it does not work as well (see the below script in this post).
Can you please help me on this problem on how to compare the content of two nested tables?
Run the scripts below to reproduce the problem and be sure to update this post if more information is required.
-The scripts below-
Select * from version of v$.
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE Production 11.2.0.4.0
AMT for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
-First of all, I create my types
CREATE OR REPLACE TYPE FORCE AS OBJECT MDQ_DETAIL (NUMBER OF MDQ_DETAIL_ID, MDQ_DETAIL_DESC VARCHAR2 (100));
CREATE OR REPLACE TYPE T_MDQ_DETAIL AS TABLE MDQ_DETAIL;
-Note that this type contains the table T_MDQ_DETAIL type:
CREATE OR REPLACE TYPE MDQ_PARENT FORCE AS OBJECT (NUMBER MDQ_ID, MDQ_DETAILS T_MDQ_DETAIL);
- Then I create two equal nested tables
CREATE THE NESTED TABLE AS MDQ_PR_OLD STORE MDQ_DETAILS MDQ_PARENT MDQ_OLD TABLE.
CREATE THE NESTED TABLE AS MDQ_PR_NEW STORE MDQ_DETAILS MDQ_PARENT MDQ_NEW TABLE.
-Insert test data in the nested tables
Insert into MDQ_OLD (MDQ_ID, MDQ_DETAILS) Values (1, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));
Insert into MDQ_NEW (MDQ_ID, MDQ_DETAILS) Values (2, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));
-Try to use the negative operator to compare the contents of the trailer of the nested tables, but it gives this error:
-ORA-00932: inconsistent data types: expected - got DISPATCH. T_MDQ_DETAIL
Select * from MDQ_NEW
less
Select * from MDQ_OLD;
-Try to select in a ROWTYPE, but it fails
declare
myTypeOld MDQ_OLD % ROWTYPE;
myTypeNew MDQ_New % ROWTYPE;
myTypeDiff MDQ_New % ROWTYPE;
Start
-Select gives: PLS-00497: do not mix between row and several rows (in BULK) list
Select * bulk collect into mdq_old myTypeOld;
Select * bulk collect into mdq_new myTypeNew;
-Need a 'compare the function of membership card' on the types of multiset except to work, but as far as I
-I'm not able to bulk collect into myTypeOld or myTypeNew, this won't help out me.
myTypeDiff: = multiset myTypeOld except myTypeNew.
end;
-Cleaning:
drop table MDQ_OLD;
drop table MDQ_NEW;
type of projection MDQ_PARENT;
type of projection T_MDQ_DETAIL;
type of projection MDQ_DETAIL;
> queries you provided intercepts not who.
You asked how to compare the content of nested tables.
I knew that you didn't ask for what you actually want, that's why I asked you to specify the comparison more in detail.
> Do you have a query that grabs this difference as well?
SELECT o.mdq_id, od.*
OF mdq_old o, TABLE (o.mdq_details) od
LESS
SELECT n.mdq_id, nd.*
OF mdq_new n, TABLE (n.mdq_details) nd;> Also, if possible, do you have a sample of a statement to COLLECT LOOSE, please?
Actually, you raise an interesting point on using % ROWTYPE, in my view, that should be. This make...
DECLARE
TYPE rt_mdq_new () IS RENDERING
mdq_id NUMBER,
mdq_details t_mdq_detail);
TYPE tt_mdq_new IS TABLE OF THE rt_mdq_new;
t_mdq_new tt_mdq_new;
BEGIN
SELECT mdq_id, mdq_details
LOOSE COLLECTION t_mdq_new
OF mdq_new min.;
END;
/DECLARE
CURSOR c_mdq_new
IS
SELECT mn.*
OF mdq_new min.;
TYPE tt_mdq_new IS TABLE OF c_mdq_new % ROWTYPE;
t_mdq_new tt_mdq_new;
BEGIN
OPEN c_mdq_new.
Get the c_mdq_new COLLECT in BULK IN t_mdq_new;
CLOSE C_mdq_new;
END;
/ -
Nested table frees the file after validation?
Hello world
My version of DB is
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production."
AMT for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
I have a question about the nested table. I am writing a code to change the data type for a column varchar2 to date without deleting the data.
So I thought instead of creating the table or the TWG, I will fill these data in the collection and updating of this column as null. So I'll change the data type for this column and the data that is loaded inside the collection, I'll shoot back as it is.
The collection is formed, the data are updated with the null value and data type of the column is updated as well. But when I'm trying to load the data in collection, it seems to be empty. Why is happening. ? Nested table depends on the statement commit?
Please take a look at the code and suggest me something here.
DECLARE
TYPE ARRAY_REC_TYPE IS RECORD (SPECTRA_MRN CROWN_WEB_PATIENT_LIST. TYPE % SPECTRA_MRN
CALENDAR_MONTH_END_DATE CROWN_WEB_PATIENT_LIST. TYPE % CALENDAR_MONTH_END_DATE
INFLUENZAWHENGIVEN CROWN_WEB_PATIENT_LIST. INFLUENZAWHENGIVEN % TYPE);
TYPE ARRAY_TAB_TYPE IS TABLE OF THE ARRAY_REC_TYPE;
VC_ARRAY_TAB_TYPE ARRAY_TAB_TYPE: = ARRAY_TAB_TYPE();
BEGIN
SELECT SPECTRA_MRN,
CALENDAR_MONTH_END_DATE,
INFLUENZAWHENGIVEN
BULK COLLECT INTO VC_ARRAY_TAB_TYPE
OF CROWN_WEB_PATIENT_LIST
WHERE INFLUENZAWHENGIVEN IS NOT NULL;
FOR I IN VC_ARRAY_TAB_TYPE.first... VC_ARRAY_TAB_TYPE. Last LOOP
UPDATE CROWN_WEB_PATIENT_LIST
SET INFLUENZAWHENGIVEN = NOTHING
WHERE SPECTRA_MRN = VC_ARRAY_TAB_TYPE (I). SPECTRA_MRN
AND TRUNC (CALENDAR_MONTH_END_DATE) = TRUNC (VC_ARRAY_TAB_TYPE (I). CALENDAR_MONTH_END_DATE);
END LOOP;
RUN IMMEDIATELY 'ALTER TABLE CROWN_WEB_PATIENT_LIST CHANGE INFLUENZAWHENGIVEN DATE ";
FOR K IN VC_ARRAY_TAB_TYPE.first... VC_ARRAY_TAB_TYPE. Last LOOP
UPDATE CROWN_WEB_PATIENT_LIST
SET INFLUENZAWHENGIVEN = TO_DATE (to_char (VC_ARRAY_TAB_TYPE (K). INFLUENZAWHENGIVEN, 'YYYY-MM-DD'))
WHERE SPECTRA_MRN = VC_ARRAY_TAB_TYPE (K). SPECTRA_MRN
AND TRUNC (CALENDAR_MONTH_END_DATE) = TRUNC (VC_ARRAY_TAB_TYPE (K). CALENDAR_MONTH_END_DATE);
END LOOP;
EXCEPTION
WHILE OTHERS THEN
ROLLBACK;
END;
/
Kind regards
BS2012.
Your EXCEPTION WHILE others removes any possible EXCEPTOIN that is raised. You need to get rid of him. Or at least use RAISES at the end. And if you decide to use the collection then get the best out of him using treatment in BULK. Here is an example FORALL.
SQL> desc t Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER DT VARCHAR2(10) SQL> select * from t; ID DT ---------- ---------- 1 05-08-2014 2 06-08-2014 3 07-08-2014 4 08-08-2014 5 09-08-2014 6 10-08-2014 7 11-08-2014 8 12-08-2014 9 13-08-2014 10 14-08-2014 10 rows selected. SQL> declare 2 type id_tbl is table of t.id%type; 3 type dt_tbl is table of t.dt%type; 4 l_id id_tbl; 5 l_dt dt_tbl; 6 begin 7 select id, dt bulk collect into l_id, l_dt 8 from t; 9 10 update t 11 set dt = null; 12 13 execute immediate 'alter table t modify dt date'; 14 15 forall i in 1..l_id.count 16 update t 17 set dt = to_date(l_dt(i), 'dd-mm-yyyy') 18 where id = l_id(i); 19 end; 20 / PL/SQL procedure successfully completed. SQL> desc t Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER DT DATE SQL> select * from t; ID DT ---------- --------- 1 05-AUG-14 2 06-AUG-14 3 07-AUG-14 4 08-AUG-14 5 09-AUG-14 6 10-AUG-14 7 11-AUG-14 8 12-AUG-14 9 13-AUG-14 10 14-AUG-14 10 rows selected. SQL>
-
What is the preferred means of data transmission in the associative array of the nested table record vs
Choose between Nested Tables and associative arrays
The two nested tables and associative arrays (formerly index - by tables) use similar index notation, but they have different characteristics when it comes to persistence and ease of passing parameters.
Nested tables can be stored in a column of data, but can of associative arrays. Nested tables can simplify the SQL operations where you would normally join a single-column table with a larger table.
Associative arrays are appropriate for relatively small lookup tables where the collection can be constructed in memory whenever a procedure is called or a package is initialized. They are good for the collection of the information volume is unknown beforehand, because there is no fixed limit on their size. Their index values are more flexible, as associative array indices can be negative, can be no sequential and can use values of string instead of numbers.
PL/SQL automatically converts between the bays of the host and the associative arrays that use values of digital keys. The most effective way to move the collections to and from the database server is to implement data values in associative arrays, and then use these associative arrays with erections in bulk (the
FORALL
statement orBULK
COLLECT
clause).With the help of documents and Collections of PL/SQL
Read this:
-
How to get Nested table function
Hi friends,
In a package, I created a nested table type name Varchar2 EmployeeCodeList.
Then, I created a function whose return type is EmployeeCodeList. But I don't get how to get the values of this function?
TYPE EmployeeCodeList IS TABLE OF THE VARCHAR2 (30);
FUNCTION GenerateRandomEcF (Ec_length NUMBER, NumberOfEmp NUMBER)
< < the function code > >
RETURN v_RandomEmpCodes; END GenerateRandomEcF;
PROCEDURE GenerateEmpFile (NumberOfEmp NUMBER, Start_SN NUMBER, EmpValue NUMBER, VARCHAR2, VARCHAR2, Ec_length NUMBER EmpGroup HireDate) IS
v_Filename VARCHAR2 (40);
v_EmployeeCodes EmployeeCodeList;
v_EmpBatchF UTL_FILE. TYPE_DE_FICHIER;
BEGIN
v_Filename: = 'EMPLOYEE_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';
v_EmployeeCodes: = EmployeeCodeList (NumberOfEmp);
v_EmployeeCodes: = SELECT * FROM TABLE (GenerateRandomAcF (Ac_length, NumberOfVoucher));
v_EmpBatchF: = UTL_FILE. FOPEN ('EXT_VOUCHER_DIR', v_Filename, 'W');
IF UTL_FILE.IS_OPEN (v_EmpBatchF) THEN
FOR i IN 1.NumberOfVoucher LOOP
UTL_FILE. Put_line (v_EmpBatchF, v_EmployeeCodes (i) |) ',' || Start_SN + (i-1). «, » || EmpValue | «, » || HireDate. «, » || EmpGroup);
END LOOP;
END IF;
END GenerateEmpFile;
How the line highlighted code above must be written so that I can get value of function in a variable of the same type of nested table.
If you use the second approach, I mean
56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);
then the collection must be initialized using the constructor method. Change line 33.48 as number below
33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList();
48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList();
This is because when you use BULK COLLECT, Oracle automatically populates the collection without initialization. But if you do not COLLECT in BULK, then the collection must be initialized before filling / extending. Otherwise, you will get error of REFERENCE to the COLLECTION that is not INITIALIZED. So this should be the code, you should use. When you do not select... INTO, you might well declare the function is private and it is not necessary to declare in the package specification.
SQL > CREATE OR REPLACE PACKAGE BODY GenerateEmployeePackage AS
2 PROCEDURE Get_AC_Range (Ac_length NUMBER, Range_Start SERIES, certain Range_End NUMBER)
3 EAST
4 BEGIN
5 If Ac_length = 8 THEN
6 Range_Start: = 10000000;
7 Range_End: = 99999999;
8 Ac_length ELSIF = 9 THEN
9 Range_Start: = 100000000;
10 Range_End: = 999999999;
11 Ac_length ELSIF = 10 THEN
12 Range_Start: = 1000000000;
13 Range_End: = 9999999999;
14 Ac_length ELSIF = 11 THEN
15 Range_Start: = 10000000000;
16 Range_End: = 99999999999;
17 ELSIF Ac_length = 12 THEN
18 Range_Start: = 100000000000;
19 Range_End: = 999999999999;
20 Ac_length ELSIF = 13 THEN
21 Range_Start: = 1000000000000;
22 Range_End: = 9999999999999;
23 Ac_length ELSIF = 14 THEN
24 Range_Start: = 10000000000000;
25 Range_End: = 99999999999999;
26 END IF;
27 END Get_AC_Range;
28
GenerateRandomAcF FUNCTION 29 (Ac_length NUMBER, NumberOfEmployee NUMBER)
30 BACK IS EmployeeCodeList
31 NUMBER Range_Start;
32 Range_End NUMBER;
33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList ();
BEGIN 34
35 Get_AC_Range (Ac_length, Range_Start, Range_End);
36 v_RandomEmployeeCodes.extend (NumberOfEmployee);
37
38 FOR I IN 1.NumberOfEmployee LOOP
39 v_RandomEmployeeCodes (i): = TRUNC (DBMS_RANDOM.value (down-online Range_Start, high-online Range_End));
40 END LOOP;
41
42 v_RandomEmployeeCodes RETURN;
43
END 44 GenerateRandomAcF;
45
GenerateEmployeeFile PROCEDURE 46 (NumberOfEmployee NUMBER of Start_SN NUMBER, EmployeeValue NUMBER, displayed EmployeeGroup VARCHAR2, VARCHAR2, Ac_length NUMBER) IS
47 v_Filename VARCHAR2 (40);
48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList ();
49 v_EmployeeBatchF UTL_FILE. TYPE_DE_FICHIER;
BEGIN 50
51 v_Filename: = 'Employee_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';
52 v_EmployeeCodes: = EmployeeCodeList();
53
54 get nested table function
55 - SELECT * COLLECT in BULK IN TABLE v_EmployeeCodes (GenerateRandomAcF (Ac_length, NumberOfEmployee));
56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);
57 v_EmployeeBatchF: = UTL_FILE. FOPEN ('EXT_Employee_DIR', v_Filename, 'W');
58
59 if UTL_FILE.IS_OPEN (v_EmployeeBatchF) THEN
60. FOR i IN v_EmployeeCodes.FIRST... v_EmployeeCodes.Last LOOP
UTL_FILE 61. Put_line (v_EmployeeBatchF, v_EmployeeCodes (i) |) ',' || (Start_SN + (i-1)). «, » || EmployeeValue | «, » || Posted | «, » || EmployeeGroup);
LOOP END 62;
63 END IF;
64
END 65 GenerateEmployeeFile;
66
END 67 GenerateEmployeePackage;
68.
-
How to add new features to the line in the nested table advace?
Hello
I want to create a new line in the nested table advance.
Help, please.
Thank you
Hello
Use the code below to add a line in the nested Table.
If (PageContext.GetParameter ("addRows")! = null) {}
OAAdvancedTableBean sectionsTable = (OAAdvancedTableBean) webBean.findChildRecursive ("AdvTblRN");
OAInnerDataObjectEnumerator sectionsEnum = new OAInnerDataObjectEnumerator (pageContext, sectionsTable);
{while (sectionsEnum.hasMoreElements ())}
Set of rows sectionsRowSet = sectionsEnum.nextElement () (set of lines);
for (int i = 0; i)< 1;="">
NewRow = sectionsRowSet.createRow ((OARow)) OARow;
sectionsRowSet.insertRowAtRangeIndex (sectionsRowSet.getRowCount (), newRow);
}
}
Thank you
Dilip
-
Inserting data in the nested table
I explore the differences between the OBJECT and RECORD.
As I'm still learning, I found that both are structures which essentially brings together different elements of types of different data or columns of data types, one is used in SQL and other is used in PL/SQL, please correct me if I'm wrong in my understanding.
Below, I am trying to insert data into an array of type object, but I can't can you please help.
CREATE OR REPLACE type sam as OBJECT ( v1 NUMBER, v2 VARCHAR2(20 CHAR) ); ---Nested Table--- create or replace type t_sam as table of sam; --Inserting data---- insert into table(t_sam) values(sam(10,'Dsouza'));
Error message:
Error starting at line 22 in command: insert into table(t_sam) values(sam(10,'Dsouza')) Error at Command Line:22 Column:13 Error report: SQL Error: ORA-00903: invalid table name 00903. 00000 - "invalid table name" *Cause: *Action:
Ariean wrote:
So the only purpose of the equivalent concept of SQL types of nested tables is to use one of the data types when you define an actual table?
So-you can certainly use more that a simple "set an actual table. (I'm fairly certain that you can pass a table nested within a procedure, for example - try it, though - I'm not 100% sure on that - it just 'logic'.) If you can define a type, you can use it, pass it around, whatever.).
Ariean wrote:
And this nested table could be a record in SQL or object in PLSQL or simple data type (varchar number, etc.)?
Nested tables are just like any other type of custom data. You can create a nested table of other types of data. You can create a custom of nested tables data type.
Stupidly, he could become... uh, stupid O_0
CREATE TYPE o_myobj1 AS object ( id1 number, cdate1 date ); CREATE TYPE t_mytype1 AS table of o_myobj1; CREATE TYPE o_myobj2 AS object ( id2 number, dumb t_mytype1 ); CREATE TYPE t_dumber AS table of o_myobj2;
O_0
OK, my brain is starting to hurt - I hope you get the idea
Ariean wrote:
Second is my understanding correct any OBJECT & RECORD?
I see no benefit to describe another way.
-
Pre-defined types of Oracle nested table
Hello
I am in the Internet search and could not find one of the pre-defined types of nested table in Oracle. For example: a type that can contain strings. Can anyone put here a few names of this type?create table mytable (id integer, theList sys.odcivarchar2list); insert into mytable (id, thelist) values ( 1, sys.odcivarchar2list('a','b','c'));
-
Hi all
Can I combine the records in the nested table
I have a table with 2 colum: col_1 and col_2
col_1: corresponds to the id (varchar2)
col_2: is a column nested with the type of table (sub_col_1 (number), sub_col_2 (number))
for example: I have 2 accounts table ('a', (1,2)) and ('b', (3,4)))
what I want is merged into this table with values ('a', '4.5')) + ('c', (6,7)) IN a single statement
What I should have after this operation ('a', (1,2,4,5)) + ('b', (3,4)) + ('c', (6,7)).
Can I do this?
Oracle version: 11.2.0.3CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT(SUB_COL_1 NUMBER, SUB_COL_2 NUMBER) ; CREATE OR REPLACE TYPE TEST_TYPE_TABLE IS TABLE OF TEST_TYPE; CREATE TABLE TEST_MERGE_NESTED_TABLE (COL_1 VARCHAR2(1 CHAR), COL_2 TEST_TYPE_TABLE) NESTED TABLE COL_2 STORE AS COL_2_NESTED; INSERT INTO TEST_MERGE_NESTED_TABLE VALUES('a',TEST_TYPE_TABLE(TEST_TYPE(1,2) )); INSERT INTO TEST_MERGE_NESTED_TABLE VALUES('b',TEST_TYPE_TABLE(TEST_TYPE(3,4) ));
Thank you all.
Published by: 966205 on 20:18 21/02/2013
Published by: 966205 on 20:42 21/02/2013966205 wrote:
That means he does the same thing as what I want (adding? do not recreate this column in the physical layer).Actually, no.
All content of the nested table is first removed (for the given FK), then the result of the MULTISET UNION is reinserted.The evidence on:
SQL> alter session set events '10046 trace name context forever, level 12'; Session altered. SQL> merge into test_merge_nested_table t 2 using ( 3 select 'a' col_1, TEST_TYPE_TABLE(TEST_TYPE(4,5)) col_2 from dual union all 4 select 'c' , TEST_TYPE_TABLE(TEST_TYPE(6,7)) from dual 5 ) v 6 on ( t.col_1 = v.col_1 ) 7 when matched then update 8 set t.col_2 = t.col_2 multiset union v.col_2 9 when not matched then insert (col_1, col_2) 10 values (v.col_1, v.col_2) ; 2 rows merged. SQL> alter session set events '10046 trace name context off'; Session altered. SQL> select * from test_merge_nested_table; C COL_2(SUB_COL_1, SUB_COL_2) - -------------------------------------------------------------------------------- c TEST_TYPE_TABLE(TEST_TYPE(6, 7)) a TEST_TYPE_TABLE(TEST_TYPE(1, 2), TEST_TYPE(4, 5)) b TEST_TYPE_TABLE(TEST_TYPE(3, 4))
TKPROF output:
DELETE, the nested table statement objectives associated with 'a' and deletes the line after line that it contains (1,2).
The later INSERTION is performed twice (run count = 2) and target the two nested table 'a' by inserting 2 ranks: former one (1,2) + the new one (4.5) and the nested table 'c' by inserting 1 row (6,7).SQL ID: 6bjc2z2t53csn Plan Hash: 132214516 DELETE /*+ REF_CASCADE_CURSOR */ FROM "DEV"."COL_2_NESTED" WHERE "NESTED_TABLE_ID" = :1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.00 0.00 0 1 3 1 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 2 0.00 0.00 0 1 3 1 Misses in library cache during parse: 0 Optimizer mode: CHOOSE Parsing user id: SYS (recursive depth: 1) Number of plan statistics captured: 1 Rows (1st) Rows (avg) Rows (max) Row Source Operation ---------- ---------- ---------- --------------------------------------------------- 0 0 0 DELETE COL_2_NESTED (cr=1 pr=0 pw=0 time=44 us) 1 1 1 INDEX RANGE SCAN SYS_FK0000023444N00002$ (cr=1 pr=0 pw=0 time=10 us)(object id 23446) ********************************************************************************
******************************************************************************** SQL ID: 0fzd5yk23jyas Plan Hash: 0 INSERT /*+ NO_PARTIAL_COMMIT REF_CASCADE_CURSOR */ INTO "DEV"."COL_2_NESTED" ("NESTED_TABLE_ID","SYS_NC_ROWINFO$") VALUES (:1, :2) call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 2 0.00 0.00 0 0 0 0 Execute 2 0.00 0.00 0 2 10 3 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 4 0.00 0.00 0 2 10 3 Misses in library cache during parse: 0 Optimizer mode: ALL_ROWS Parsing user id: 50 (recursive depth: 1) Number of plan statistics captured: 1 Rows (1st) Rows (avg) Rows (max) Row Source Operation ---------- ---------- ---------- --------------------------------------------------- 0 0 0 LOAD TABLE CONVENTIONAL (cr=1 pr=0 pw=0 time=113 us) ******************************************************************************** -
Why the hell use nested tables?
Hello
I'm boning up on top of the PL/SQL (again) waiting to get a new job.
I have several years of experience in various roles related to the data, including many used Oracle.
On the issue of collections, I ask myself, in light of my experience, to find and not for the first time, why the hell would anyone want to do this:
I really, really, can't think why we want to store data like that. It seems unnecessarily complex, hiding a one-to-many relationship inside TEST_TABLE, which should rather be modeled and implemented as a separate table.create or replace type TEST_TT as table of varchar2(10); / create table TEST_TABLE ( X number ,Y test_tt) nested table Y store as Y_TABLE;
In addition, there are a lot of tutorials on the collections that tell us how to do the above (in fact I read Feuerstein right now), but nobody seems to tell us WHY we should do it.
Can someone help me out here?
Thank you.
JasonI can't imagine wanting to create a table like this one either (or, if this can help, can Tom Kyte).
The collections are terribly useful in PL/SQL, when they help you avoid one treatment per line. I can't imagine wanting to integrate into my data model. Frankly, it's much the same with the types of objects - they are quite useful in PL/SQL, but I would never want to create a table in my data model that contained an object.
Justin
Maybe you are looking for
-
My pictures are not appearing in my iMovie
I went to change an old imovie project I did last year. When I open all the images are missing from the video. they appear in the timeline panel, but they play back in black. When I click the photo button to import photos, nothing appears as if it
-
Update iOS 9.3 does climb up to now my phone
Since updating to ios 9.3 and my phone has a mind of its own now I can't send pictures to some people via text and my music library I got all messed up-someone ' else? All the patches? I've restarted my phone at least 5 times since.
-
Satego X 200-not of its DTS using a HDMI cable
I use my Satego X 200 as a Mediacenter and send audio DTS on the HDMI output for the audio/video receiver but no sound.Dolby Digital is ok. What is the problem?
-
None of my restore points will not work. He directed the restoration of the system and that it recharges, but says system has not been restored.
-
Sansa E250 v2 database question
I have a problem with my E250. When I turn it on, it says: Not enough space for music DB. Please free 90 MB. This happened after I tried to use a 16 GB sdhc card to load more music on my player. Now I can't update or enter the settings to delete all