casting with NVARCHAR2 table collection
Hello worldI have defined some SQL types at the schema level and use them in the stored procedure, in particular, I need to some casting of this type to the table collection.
However, it seems to be a problem if the SQL type contains fields of type NVARCHAR2. Example is quite simple:
Select min (INNER_CODE) in the TABLE test_quality (CAST (highest_quality_table AS highest_quality_table_type));
In the case of the concerned type (highest_quality_table_type) contains NVARCHAR2, I get ORA-12714 (invalid national character the specified value).
However, if the type does not NVARCHAR2 (for example numbers only) - contain it compiles successfully.
Any advice would be appreciated.
You might knock Bug 6029647 ORA-12714 access to typed function TABLE() column:
This problem is fixed in:
Patch 7 10.2.0.3 on Windows platforms
10.2.0.4 (Server Patch Set)
11.1.0.7 (Server Patch Set)
11.2 (next version)
Tags: Database
Similar Questions
-
Use with need to collect in bulk to insert records from multiple tables
Hello
I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.
Please give me suggestions.
ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.
Example 1 (dynamic SQL):
begin
...
forall i in vRecList.First..vRecList.Last
execute immediate '
begin
insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
end;Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions. In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.
Example 2 (insert all):
begin
...
forall i in vRecList.First..vRecList.Last
insert all
into Table1 values vRecList(i)
into Table2 values vRecList(i)
select 1 from dual;
end; -
Table Collection cast to object
In my application I push data in a table collection. When I debug or trace the AC I get [object Object]. I'm doing something wrong?
public var newsDB:ArrayCollection = new ArrayCollection;
then I add to it here.
if(archive.selected == true){ newsDB.addItem( { title: titleText.label, clickURL: clickURL.text, info: itemInfo.text, abstract: abstract.text, category: category.selectedLabel, rateItem: rateItem.selectedItem }); trace(newsDB); }
When I debug, I can see that the items are in HQ, but as generic objects. Thoughts?
How you draw the objects in the table? If you want to see special properties, you must specify the... trace (newsDB [i] .title);
-
How to call the nested in the SQL table collection
Please see the example below, how to attach the collection vmi_emp with history_emp table
CREATE or REPLACE type vmi_emp as an object
(empno varchar2 (500),)
Ename varchar2 (500),
HireDate date,
SAL number (20));
CREATE or REPLACE type nested_emp is table of the vmi_emp;
declare
v_type nested_emp;
Start
Select vmi_emp (empno, ename, hiredate, sal)
bulk collect into v_type from emp;
???????????????? Select * from history_emp a, b vmi_emp where a.empno = b.empno
end loop;
end;
Select * from history_emp has, b table (v_type) where a.empno = b.empno
-
Question of nested initialization Tables collection
When I'm this operation with Index by table it works howerver not able to perform even with the Tables IMBRIQUEES
DECLARE
TYPE column_record IS TABLE OF employees % rowtype
INDEX BY PLS_INTEGER;
EmpData column_record;
I PLS_INTEGER: = 100;
BEGIN
WHILE I < = 200 LOOP
SELECT * INTO empdata (i)
EMPLOYEES
WHERE employee_id = i;
i: = i + 10;
END LOOP;
I: = 100;
WHILE I < = 200 LOOP
DBMS_OUTPUT. Put_line (EmpData (i). FIRST_NAME. "Work on the profile ' | EmpData (i). Job_id |' a salary '. EmpData (i). SALARY);
i: = i + 10;
END LOOP;
END;
/
Steven is working on a salary 24000 AD_PRES profile
John works on a salary 8200 FI_ACCOUNT profile
Matthew is working on a salary 8000 ST_MAN profile
Mozhe working on profile ST_CLERK has salary 2800
Joshua working on profile ST_CLERK has salary 2500
Peter is working on a salary 10000 SA_REP profile
Louise is working on a salary 7500 SA_REP profile
Tayler is working on a salary 9600 SA_REP profile
Winston works on the SH_CLERK a salary 3200 profile
Timothy working on SH_CLERK a salary 2900 profile
Jennifer works on the AD_ASST a salary 4400 profile
PL/SQL procedure successfully completed.
Now when it is run with the IMBRIQUEE TABLE:
SQL > DECLARE
2 TYPE column_record IS TABLE OF employees % rowtype;
3 empdata column_record;
4 I PLS_INTEGER: = 100;
5 BEGIN
6 WHILE I < = 200 LOOP
7 if he would CHOOSE * IN empdata (i)
8 EMPLOYEES
9. WHERE employee_id = i;
10 i: = i + 10;
11 END OF LOOP;
12 I: = 100;
13 then I < = 200 LOOP
14 DBMS_OUTPUT. Put_line (EmpData (i). FIRST_NAME. "Work on the profile ' | EmpData (i). Job_id |' a salary '. EmpData (i). SALARY);
15 i: = i + 10;
16 END LOOP;
END 17;
18.
DECLARE
*
ERROR on line 1:
ORA-06531: Reference to an uninitialized collection
ORA-06512: at line 7
Too much remedy that I have included the following line:
And then I'm stuck with another error.
SQL > DECLARE
2 TYPE column_record IS TABLE OF employees % rowtype;
3 empdata column_record;
4 empdata: = column_record();
5 I PLS_INTEGER: = 100;
6 BEGIN
7 then I < = 200 LOOP
8. SELECT * IN empdata (i)
9 EMPLOYEES
10. WHERE employee_id = i;
11 i: = i + 10;
12 END LOOP;
13 I: = 100;
14 then I < = 200 LOOP
15 DBMS_OUTPUT. Put_line (EmpData (i). FIRST_NAME. "Work on the profile ' | EmpData (i). Job_id |' a salary '. EmpData (i). SALARY);
16 I: = i + 10;
17 END OF LOOP;
18 END;
19.
EmpData: = column_record();
*
ERROR on line 4:
ORA-06550: line 4, column 9:
PLS-00103: encountered the symbol "=" when expecting one of the following conditions:
constant exception < an ID >
< a between double quote delimited identifiers > double long Ref table
char time timestamp interval date binary character national nchar
The symbol '< identifier >' has been substituted for "=" continue.
Guide gently on the correct way to do it.
Do you miss extend
DECLARE TYPE column_record IS TABLE OF employees%ROWTYPE; empdata column_record; i PLS_INTEGER := 100; BEGIN empdata := column_record (); empdata.extend(200); WHILE i DECLARE TYPE column_record IS TABLE OF employees%ROWTYPE; empdata column_record; i PLS_INTEGER := 100; BEGIN empdata := column_record (); empdata.extend(200); WHILE i
Steven Working on Profile AD_PRES has salary 24000 John Working on Profile FI_ACCOUNT has salary 8200 Matthew Working on Profile ST_MAN has salary 8000 Mozhe Working on Profile ST_CLERK has salary 2800 Joshua Working on Profile ST_CLERK has salary 2500 Peter Working on Profile SA_REP has salary 10000 Louise Working on Profile SA_REP has salary 7500 Tayler Working on Profile SA_REP has salary 9600 Winston Working on Profile SH_CLERK has salary 3200 Timothy Working on Profile SH_CLERK has salary 2900 Jennifer Working on Profile AD_ASST has salary 4400
-
run immediately with bind sql collection
Hi, I'm working on an implementation immediate execution where to use a binding that is to an SQL array type. The type of table is produced by be transmitted from an array of Java.
So it looks like:
execute immediate mystatement using myarray;
"mystatement" contains a forall command. I thought that it wouldn't work, because of limitations in the use of tables to link with dynamic sql, but it does. Also, I see in the Oracle documentation that allows dynamic sql to binds to SQL collection types. Am I so I read the documentation correctly, please, that this is a correct use of the immediate execution with a SQL collection?
I tested on 10.2 and 11 g
Thank you
David979394 wrote:
Hi, I'm working on an implementation immediate execution where to use a binding that is to an SQL array type. The type of table is produced by be transmitted from an array of Java.So it looks like:
execute immediate mystatement using myarray;
"mystatement" contains a forall command. I thought that it wouldn't work, because of limitations in the use of tables to link with dynamic sql, but it does. Also, I see in the Oracle documentation that allows dynamic sql to binds to SQL collection types. Am I so I read the documentation correctly, please, that this is a correct use of the immediate execution with a SQL collection?
I tested on 10.2 and 11 g
Thank you
David
Welcome to the Forum!
Here is a small demonstration to what Solomon said: (not the best of examples I would say, but should provide an indication)drop table depts; drop table emps; drop type type_depts; create table depts (dept_no number, dept_name varchar2(25), loc varchar2(10)); create table emps (empno number, name varchar2(25), dept_no number, salary number); create or replace type type_depts is table of number; insert into depts values (10, 'ABC', '111'); insert into depts values (20, 'ABC1', '111'); insert into depts values (30, 'ABC2', '111'); insert into depts values (40, 'ABC3', '111'); insert into depts values (50, 'ABC4', '111'); insert into emps values (1, 'PQR', 10, 100); insert into emps values (2, 'PQR1', 20, 100); insert into emps values (3, 'PQR2', 30, 100); insert into emps values (4, 'PQR3', 10, 100); insert into emps values (5, 'PQR4', 30, 100); insert into emps values (6, 'PQR5', 10, 100); insert into emps values (7, 'PQR6', 40, 100); insert into emps values (8, 'PQR7', 80, 100); commit; /* Block to find a DEPT_NO in EMP that does not exist in DEPT table */ set serveroutput on; declare dept type_depts; type type_emp is table of pls_integer index by pls_integer; emp type_emp; idx pls_integer; begin select dept_no bulk collect into dept from depts; execute immediate 'select empno from emps where dept_no not in (select column_value from table(:1))' bulk collect into emp using dept; for i in emp.first..emp.last loop dbms_output.put_line('Emp No:- ' || emp(i)); end loop; end; anonymous block completed Emp No:- 8
As you say, the 'mystatement"contains the FORALL statement; Is the name of the Table known at runtime, or it is passed as an additional parameter? If the Table name is known, then, IMO, there is no any dynamic SQL. A FORALL statement should be enough.
Please provide details. In addition, please read {message identifier: = 9360002}.
-
a function that returns the type with a table joint!
Good day to all,
I have a function that returns a type.
so I select it as:
Select * from table (function (param1, param2))
now I want to combine this with a table so that the settings for the service we get from the join table. Is this possible? And how?
I tried different options without success.
something like:
Select *.
table table (function (b.column1, b.columnb) x), tablea b
where x.a = b.col
Is this possible?
Thanks in advance?user564819 wrote:
something like:
Select *.
table table (function (b.column1, b.columnb) x), tablea b
where x.a = b.colIs this possible?
Somehow...
SQL> create or replace type TIntegers is table of integer; 2 / Type created. SQL> SQL> --// our sample pipeline simply spews 2 numbers for eevry number input - simple SQL> --// to use for the testcase below SQL> create or replace function FooPipe( n number ) return TIntegers pipelined is 2 begin 3 pipe row( trunc(n) ); 4 pipe row( trunc(n)*-1 ); 5 return; 6 end; 7 / Function created. SQL> SQL> with dataset( n ) as( 2 --// ignore this part as it only builts a base table 3 --// for us to use to select values for input to 4 --// to the pipeline - in "real world" use this table 5 --// will already exist 6 select 7 level 8 from dual 9 connect by level <= 10 10 ), 11 pipe_line( n, array ) as( 12 --// we run the pipeline as a nested table column 13 --// in the SQL projection - the CAST is important 14 --// in order to establish the nested table type 15 select 16 d.n, 17 cast( 18 FooPipe(d.n) as TIntegers 19 ) 20 from dataset d 21 ) 22 --// we now use a standard query to unnest the nested table column 23 select 24 p.n, 25 pipe_val.* 26 from pipe_line p, TABLE(p.array) pipe_val 27 / N COLUMN_VALUE ---------- ------------ 1 1 1 -1 2 2 2 -2 3 3 3 -3 4 4 4 -4 5 5 5 -5 6 6 6 -6 7 7 7 -7 8 8 8 -8 9 9 9 -9 10 10 10 -10 20 rows selected. SQL>
Not sure I like it. What is the real problem that this method (driving a pipeline with input of a base table rows) is supposed to address? There may be a simpler and more elegant approach...
-
help join you a table nested with ordinary table
IM creating a nested table object prtcnpt_info codelist. In a block anonymous im saying t_code as type nested table codelist.
Now when I try to join the table nested to ordinary table oracle DB and I get the error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
Please help me on this and provide link tutorial about this concepts... Here is the code I wrote
-Start code.
create or replace type prtcnpt_info as an object (identification number
, name varchar2 (200)
(, code varchar2 (30));
create type codelist is the prtcnpt_info table;
declare
t_code codelist.
Start
Select prtcnpt_info (b.pid, b.name, pt.code) in bulk collect into t_code
party pt
mc_code b
where pt.cd in ("AAA", "BBB")
and pt.ptype_id = b.pt_type_id;
INSERT INTO table (ID
RUN_ID
DATA
P_ID
)
SELECT id
run_id
data
prtct.id-> 1
IN table_2 t2
, (by selecting column_value in table (t_code)) prtct
WHERE prtct.id = t2. P_ID; -> 2
end;
-End code;
also of the anonymous block
1 = > is this right until you get the id value (b.pid) of the tablet_code nested as prtct alias?
2 = > is this right until you reach the nested with ordinary table table? I want to join the id column in the tables.
Published by: 914912 on April 30, 2012 02:11Write the insert like this and try
insert into table ( id , run_id , data , p_id ) select id, run_id, data, prtct.id from table_2 t2 table(t_code) prtct where prtct.id = t2.p_id;
-
Replacement of the vectors with the best collection
Hello
My Netbeans IDE gives me a hint that the vectors (which I use to build custom table of AbstractTableModel models) are outdated.
What should I replace vectors with, or which collection should I use to build custom table models, any example will be appreciated.
Thank youjverd wrote:
Use ArrayList instead of vector.However, interaction with the legacy GUI APIs is a common place where you have to use Vector. I don't know if AbstractTableModel falls into this category, but you can easily find enough.
Unlike DefaultTableModel, AbstractTableModel made no assumptions on how the data should be stored. That is why it is useful. It can be used to adapt the other data structures to TableModel without needing to copy data.
-
Need help writing an update / insert with linked tables
I am new to ColdFusion. I am learning to write querys and creates a small application to collect information from visitors to my web site. (It's also a good way for me to learn this language) I'm having a problem and it is not only the way to use an update / insert with related tables. I don't know if I'm still gather the appropriate variables to compare them to existing DB records until his execution is the update or insert some querys. Can someone help me, show me how can I update / insert related tables and maybe tell me if I create the varibales good to the compairison? This is my code, I commented out.
<! - creating a variable to compare with the db table - >
< cfset userIP = ('#CGI.) REMOTE_ADDR #') ><! - run the query and compare the cfset cell remote_addr - >
< name cfquery = 'userTracking' datasource = "" #APPLICATION.dataSource # "dbtype ="ODBC">"
SELECT REMOTE_ADDR
Of user_track
WHERE REMOTE_ADDR = #userIP #.
< / cfquery ><!-if the record exists, then run this update-->
< cfif userTracking EQ userIP >
< cfquery datasource = "#APPLICATION.dataSource #" >
UPDATED user_track, trackDetail
SET user_track. REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
user_track. Browser = < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
user_track.visits = visits + 1,
trackDetail.date = < cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
trackDetail.path = < cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
WHERE REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">
< / cfquery >
< cfelse ><! - if it isn't, then insert a new record-->
< datasource = "" #APPLICATION.dataSource # cfquery "dbtype ="ODBC">"
INSERT INTO user_track, trackDetail
(user_track. REMOTE_ADDR, user_track.browser, user_track.visits, trackDetail.userID, trackDetail.date, trackDetail.path)
VALUES)
< cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
< Len (Trim (HTTP_USER_AGENT)) GT 1 cfif >
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< / cfif >
visits + 1,
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< cfqueryparam value = "" #user_track.userID # "cfsqltype ="CF_SQL_VARCHAR">,"
< cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
< cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
)
< / cfquery >
< / cfif >
I'm close on this? This throws any errors, but it is not no longer works. It is so obviously wrong. I get a cfdump the end of my query of compairison, but once it hits the stated case, it is lost.
Thanks for your time no matter who.Newbie
You must define the variable before you can use it. You try to use it on line 1 of your model.
-
Problem with adf tables dynamyc region
Hello.
I have a problem when use ADF tables in dynamic regions. Happens if the table is inside the first task flow that is loaded (by default) in the dynamic region, recovers the data perfectly, but if the table is in a second, third and so on. flow, the task does not retrieve the data. This only happens with adf tables and graphs, if I use a form of component, for example, there is no problem.
Any idea which can happen?
I use Jdveloper 11.1.1.1.0
Appreciate any ideas or help with this problem
In iexplorer 8 gives the following error:
Band details of page errors
User agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Date: Wednesday, December 2, 2009 16:17:48 UTC
Message: 'null' is null or not an object
Line: 1105
Character: 2
Code: 0
URI::7001/SGLadf-ViewController-context-root/afr/partition/ie/default/opt/collection-11-r1.js http://seisbd101.dgac.clHello
Define the scope of the bean managed for the bean that switches between the regions to more far-reaching than demand: for example, set it to viewScope or pageFlowScope. This fixes the problem
Frank
-
can I combine my Apple Tv bought movies with my private collection
Can I combine my Apple TV bought movies, with my private collection? If so, how can I go about it. Thank you
Ted
No you can't combine movies Apple purchased with your "private collection" if they were movies home DVD "tears" or bought from another supplier (for example, Microsoft, Disney, VUDU, etc..)
-
Im having problems shaped a text box so that my table does not print right on top of it. I want it inside of my table (it's 'tems and conditions' budget)
Any advice would be great.
I face the same problem as well. Would like to know if there is a better way to get the text box to move with the table instead of the effect that overlap. Have to manually adjust the layout, whenever I want to get a reasonable print of a document (or export it to PDF) seems counterintuitive, especially when it causes the document seem ill-disposed on screen.
I am running version 3.6.2 of the numbers in the case where that matters.
-
How do VI with timestamp table entry
I'm doing a sub - VI for a program and I need to have a double array, boolean and an array of time as an entry stamp. I can't find a way to mark the entrance with a table timestamp however indicator. My only choice seems to be double and Sub. Is it possible that I can do this?
You have a block of empty array on your front panel and then move there a timestamp control.
-
Time dilation of a curve with interpolation table 1 d?
Greetings,
I'm trying to run a time dilation of a curve I used to work with the table 1 d of function interpolate VI. Basically, I have to perform the expansion on each segment, that is why each segment contains 100 points, where there are currently 60.
I am currently working with two files (the two are broken) to compare because I'm not sure how to use the table 1 d interpolating VI, and what I have to enter for the fractional index. I know that the output of the table in the first for loop should go in the 1 d array interpolated somehow.
I'm stuck!
Thank you!
TheLT
I'm good I thought it
Here's how to do it for later use.
Code attached.
TheLT
Maybe you are looking for
-
Satellite L450-136 - how to enable the taskbar preview using Win 7
Sorry about this question, but it drives me crazy:When I select anything on the task bar, I get only 4 colors, instead of a view of the page.Cannot for the life of remember me how to change.
-
My printer is stuck on copy. What should I do about it?
Hello My printer is approximately 12 years and in the end he was slain on copy. This is an inkjet printer that can scan, copy, and print. In the past, I have had no problem with this printer. Recently however, I've been copying a lot of things. I tri
-
WINDOWS DOES NOT START DELL STUDIO 1555
MY DELL STUDIO 1555 UNBOOTABLE - PERIOD. WHERE CAN I GET A DELL RESOURCE CD BACKUP GAME, OR A COPY OF WINDOWS XP GETTING STARTED DISC? Help! WINDOWS VISTA HOME PREMIUM EDITION IS THE ORIGINAL ON THIS LAPTOP, BUT I WANT TO SWITCH/DOWNLOAD/INSTALL WIND
-
Connect to the domain caching / how to enable account lockout
We have portable computers that normally connects to the AD domain, but must also be able to allow users to log on to the computer when the domain is unavailable for authentication. My question is, I want to harden the laptops against the brute force
-
Remove 'available room' all-day SX20
It is possible remove the message 'Available room' all day in the SX20 screen? Thank you