Piecewise Insert into structured storage
I understand that XMLUPDATE can handle piecewise update, but what do I do for piecewise insert. I want to add a sub-tree (document fragment) conformant with the registered schema to the xml document, without re-writing the whole (possibly very, very large and growing) document, and retaining all the power and abstraction of structured storage.
It would be nice to get an XMLType via an XPath select, get the DOM object from the XMLTYpe, operate on the DOM, and see those changes reflected in the database. I can do all that, but the changes to the DOM seem to be in-memory only.
How do I add a sub-node to an existing structured document?
Thanks,
David
HI,
Oracle version is 11.1.0.7.0.
Metalink found three bugs related to the error ORA-00600: Interner Fehlercode, Argumente: [qmxConvUnkType], [], [], [], [],
The bugs are:
BUG 8644684 ORA-600 [QMXCONVUNKTYPE] DURING INSERT INTO SCHEMA-BASED TABLE
BUG 8671408 INSERT OF XML DOC INTO AN XML SCHEMA STORED AS BINARY XML FAILS WITH ORA-30937
BUG 8683472 SCHEMA EXECUTABLE RETURNS INCORRECT ERRORS DURING VALIDATION AGAINST XML SCHEMA
Well, I have to look round in XML DB Forum yet.
Similar Messages
-
Loading XML Document into Structured Storage
HI Everybody,
I am confronted with a BUG in Oracle which is being fixed but will last a long time. I have a relatively complex Schema with manifold includes, imports and inheritances which I can register successfully. The object-relational table is also generated. But loading the instance document with INSERT INTO... fails due to severe internal error. I have not yet tried SQL*Loader, however.
Please, does anyone know a safe alternative method to parse and load? Structured storage is mandatory because I need to retrieve individual elements and attributes. Instance documents are big, ca. 20 MB.
Thanks, regards
Miklos HERBOLYHI,
Oracle version is 11.1.0.7.0.
Metalink found three bugs related to the error ORA-00600: Interner Fehlercode, Argumente: [qmxConvUnkType], [], [], [], [],
The bugs are:
BUG 8644684 ORA-600 [QMXCONVUNKTYPE] DURING INSERT INTO SCHEMA-BASED TABLE
BUG 8671408 INSERT OF XML DOC INTO AN XML SCHEMA STORED AS BINARY XML FAILS WITH ORA-30937
BUG 8683472 SCHEMA EXECUTABLE RETURNS INCORRECT ERRORS DURING VALIDATION AGAINST XML SCHEMA
Well, I have to look round in XML DB Forum yet. -
How can I insert C structures that have character pointers into DBD file
Hello~
I am changing from a file system I made into DBD.
And I had no choice to convert structures that have character point members
to insert them into the DBD file
for examble,
If there is a structure as below
typedef struct
int IndexKey;
int groupID;
char* name;
char* pNum;
char* pAddr;
char* pMemo;
} TsomeRec;
I made a structure to convert as below
typedef struct
int IndexKey;
int groupID;
char name[MAX_NAME_LEN];
char pNum[MAX_NUM_LEN];
char pAddr[MAX_ADDR_LEN];
char pMemo[MAX_MEMO_LEN];
} TsomeRec2;
But, there are too many structures to convert.
So, I am seeking for the most efficient way to insert these structures into DBD files, considering Performance.
Frankly speaking, I'am not proficient.
please describe as specific as possible.
Thank you~Hi,
Review the documentation section title Using C Structures with DB, in particular the subsection called C Structures with Pointers. It will explain the way to store structures that have pointers.
Regards,
Andrei -
Importing native xml in to semi structured storage
hello,
how store the a bibliographic data in the native xml and import or export that data into to the semi structured storage. What are the ways we query the xml database.
Eagerly waiting for the reply
Cheers
Akhil
Thank you in advanceBased on a small extension demo-ed in : http://www.liberidu.com/blog/?p=1053 (demo script demo06.sql)
-- If you can select it you can insert it...
-- drop table OGH_xml_store purge;
create table OGH_xml_store of xmltype
xmltype store as binary xml
commit;
exec get_dir_list( 'G:\OGH\xmlstore' );
set time on timing on
insert into OGH_xml_store
select XMLTYPE(bfilename('OGH_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
from dir_list dl
where dl.filename like '%.xml';
set time off timing off
commit;
select count(*) from OGH_xml_store;
prompt pause
pause
clear screen
-- If you can select it you can create resources and files
set time on timing on
commit;
exec get_dir_list( 'G:\OGH\xmlstore' );
select count(*) from dir_list where filename like '%.xml';
set serveroutput on size 10000
DECLARE
XMLdoc XMLType;
res BOOLEAN;
v_foldername varchar2(4000) := '/public/OGH/';
cursor c1
is
select dl.filename FNAME
, XMLTYPE(bfilename('OGH_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
from dir_list dl
where dl.filename like '%.xml'
and rownum <= 100;
BEGIN
-- Create XDB repository Folder
if (dbms_xdb.existsResource(v_foldername))
then
dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
end if;
res:=DBMS_XDB.createFolder(v_foldername);
-- Create XML files in the XDB Repository
for r1 in c1
loop
if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
then
dbms_output.put_line(v_foldername||r1.fname);
null;
else
dbms_output.put_line('Loop Exception :'||sqlerrm);
end if;
end loop;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Others Exception: '||sqlerrm);
END;
set time off timing off
commit;
prompt pause
pause
clear screen
-- FTP and HTTP
clear screen
prompt
prompt *** FTP - Demo ***
prompt
prompt pause
pause
host ftp
-- open localhost 2100
-- user OGH OGH
-- cd public
-- cd OGH
-- ls
-- bye
clear screen
prompt
prompt *** Microsoft Internet Explorer - Demo ***
prompt
prompt pause
pause
host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OGH:OGH@localhost:8080/public/OGH/
prompt pause
pause
-- Accessing the XDB Repository content via Resource View
-- Selecting content from a resource via XBDUriType
clear screen
prompt set long 300
set long 300
prompt Relative Path - (path)
SELECT path(1) as filename
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OGH', 1) = 1
and rownum <= 10
prompt pause
pause
clear screen
prompt Absolute Path - (any_path)
select xdburitype(any_path).getClob() as xml
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OGH', 1) = 1
and rownum <= 1;
prompt pause
pause -
hi,guruvulu
this is the program...............to insert the data into sap r/3 table
but record is not inserting....any commit i have to write in my program?
Created on Feb 20, 2007
TODO To change the template for this generated file go to
Window - Preferences - Java - Code Style - Code Templates
package comm;
@author sapusr006
TODO To change the template for this generated type comment go to
Window - Preferences - Java - Code Style - Code Templates
Example2.java
Property of SAP AG, Walldorf
(c) Copyright SAP AG, Walldorf, 2000-2005.
All rights reserved.
//import java.sql.Connection;
//import java.sql.PreparedStatement;
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.IRepository;
import com.sap.mw.jco.JCO;
@version 1.0
@author SAP AG, Walldorf
public class Fm {
// The MySAP.com system we gonna be using
static final String SID = "R3";
// static String query="insert into BAPI_COMPANYCODE_GETLIST values(?,?)";
// The repository we will be using
IRepository repository;
//ESTABLISHING A CONNECTION TO SAP
public Fm()
try {
JCO.addClientPool( SID, // Alias for this pool
10, // Max. number of connections
"800", // SAP client
"RFCTEST", // userid
"welcome", // password
"EN", // language
"10.10.88.170", // host name
"01" );
// Create a new repository
// The repository caches the function and structure definitions
// to be used for all calls to the system SID. The creation of
// redundant instances cause performance and memory waste.
repository = JCO.createRepository("MYRepository", SID);
catch (JCO.Exception ex) {
System.out.println("Caught an exception: \n" + ex);
// RETRIEVES AND DISPLAY A ZHR INFOTYPE OPERATION
public void salesOrders()
JCO.Client client = null;
try {
// Get a function template from the repository
//System.out.println("goes to sales order");
IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");
System.out.println("hai");
if(ftemplate != null) {
// Create a function from the template
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList paralist=function.getImportParameterList();
paralist.setValue("0000000011","PERNR");
paralist.setValue("UPD","ACTIO");
paralist.setValue("A","TCLAS");
System.out.println("hello");
paralist.setValue("20061215","BEGDA");
System.out.println("hello");
paralist.setValue("20061215","ENDDA");
paralist.setValue("1","OBJPS");
paralist.setValue("LTA","SUBTY");
System.out.println("SETTING VALUES");
// Get a client from the pool
client = JCO.getClient(SID);
System.out.println("goes to sales order");
//function.getImportParameterList().setValue("QUERY_TABLE","ZHRJ2EETEST");
//EXECUTING THE FUNCTION
client.execute(function);
System.out.println("after exeucting the function");
// NO OF IMPORT PARAMS IT DISPLAY
//STRUCTURE
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
String structure=returnStructure.toString();
System.out.println(structure);
JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");
System.out.println("after function");
System.out.println("proposed111"+sales_orders.getNumRows());
sales_orders.firstRow();
sales_orders.appendRows(3);
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-AMTEX","FNAME");
sales_orders.setValue("200.00","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JBGDT","FNAME");
sales_orders.setValue("20061215","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JENDT","FNAME");
sales_orders.setValue("20061215","FVAL");
System.out.println("proposed222"+sales_orders.getNumRows());
/*for (int i = 0; i <sales_orders.getNumRows(); i++) {
sales_orders.setRow(i);
System.out.println(sales_orders.getString("INFTY"));
JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");
System.out.println("modified"+sales_orders1.getNumRows());
sales_orders1.setRow(1);
sales_orders1.appendRows(1);
sales_orders1.setValue("0000000011","PERNR");
sales_orders1.setValue("0582","INFTY");
sales_orders1.setValue("LTA","SUBTY");
sales_orders1.setValue("1","OBJPS");
sales_orders1.setValue("20061215","BEGDA");
sales_orders1.setValue("20061215","ENDDA");
System.out.println("modified222"+sales_orders1.getNumRows());
System.out.println("execute222"+sales_orders1.getNumRows());
for (int i = 0; i <sales_orders1.getNumRows(); i++) {
sales_orders.setRow(i);
System.out.println("hia"+sales_orders1.getString("SUBTY"));
System.out.println("NO OF ROWS ARE:---"+ sales_orders.getNumRows());
String fieldName[]=new String[sales_orders.getFieldCount()];
System.out.println("THE COLUMNS IN THE TABLE ARE:--"+sales_orders.getFieldCount());
// sales_orders.firstRow();
//COLUMNS NAMES
System.out.println(fieldName.length);
for (int iCtrst = 0;iCtrst < sales_orders1.getFieldCount();iCtrst++) {
fieldName[iCtrst] = sales_orders1.getName(iCtrst);
System.out.println(fieldName[iCtrst]);
if (sales_orders.getNumRows() > 0) {
// Loop over all rows
do {
System.out.println("----
//int r=1;
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements();)
JCO.Field field = e.nextField();
String compcode=field.getString();
//pst.setString(r,compcode);
System.out.println(field.getName() + ":\t" + field.getString());
// r++;
}//for
// i=pst.executeUpdate();
} while(sales_orders.nextRow());
else {
System.out.println("No results found");
if (sales_orders1.getNumRows() > 0) {
// Loop over all rows
do {
System.out.println("----
//int r=1;
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders1.fields(); e.hasMoreElements();)
JCO.Field field1 = e.nextField();
//String compcode=field1.getString();
//pst.setString(r,compcode);
System.out.println(field1.getName() + ":\t" + field1.getString());
// r++;
}//for
// i=pst.executeUpdate();
} while(sales_orders1.nextRow());
else {
System.out.println("No results found");
System.out.println("modified"+sales_orders1.getNumRows());
System.out.println("modified"+sales_orders.getNumRows());
//if
/* if(i>=1)
System.out.println("\t\t\tUpdated ORACLE successfully");
else {
System.out.println("FUNCTION MODULE not found in backend system.");
}//if
catch (JCO.AbapException ex) {
System.out.println("Caught an exception: \n" + ex);
}catch(Exception en){en.printStackTrace();}
finally {
JCO.releaseClient(client);
protected void cleanUp() {
JCO.removeClientPool(SID);
public static void main(String[] argv)
Fm e=new Fm();
// e.systemInfo();
e.salesOrders();
e.cleanUp();
output:
TABLE: MODIFIED_KEYS
TABLE: PROPOSED_VALUES
IMPORT ACTIO
IMPORT BEGDA
IMPORT DIALOG_MODE
IMPORT ENDDA
IMPORT LUW_MODE
IMPORT MASSN
IMPORT NO_ENQUEUE
IMPORT NO_EXISTENCE_CHECK
IMPORT OBJPS
IMPORT PERNR
IMPORT PERSG
IMPORT PERSK
IMPORT PLANS
IMPORT SEQNR
IMPORT SPRPS
IMPORT SUBTY
IMPORT TCLAS
IMPORT WERKS
EXPORT HR_RETURN
EXPORT RETURN
EXPORT RETURN1
appending
NO OF ROWS ARE:---3
THE COLUMNS IN THE TABLE ARE:--4
INFTY: 0582
FNAME: P0582-AMTEX
FVAL: 200.00
SEQNR: 00
INFTY: 0582
FNAME: P0582-JBGDT
FVAL: 20061215
SEQNR: 00
INFTY: 0582
FNAME: P0582-JENDT
FVAL: 20061215
SEQNR: 00
PERNR: 00000011
INFTY: 0582
SUBTY: LTA
OBJPS: 1
SPRPS:
ENDDA: 2006-12-15
BEGDA: 2006-12-15
SEQNR: 000hi jagadesh,
ur code is very length to see.
see the following code ,
JCO.Function objFunction =
this
.objIRepository
.getFunctionTemplate("BAPI_MATERIAL_AVAILABILITY")
.getFunction();
objFunction.getImportParameterList().setValue(strPlant, "PLANT");
objFunction.getImportParameterList().setValue(strMaterial, "MATERIAL");
objFunction.getImportParameterList().setValue(strQuantity, "UNIT");
this.objClient.execute(objFunction);
JCO.Structure ret =
objFunction.getExportParameterList().getStructure("RETURN");
String strRetMsg = ret.getString("MESSAGE");
System.out.println(strRetMsg); // it will tell whether record is inserted or not
/*JCO.Function objFunction1 =
this
.objIRepository
.getFunctionTemplate("BAPI_TRANSACTION_COMMIT")
.getFunction();
objFunction1.setValue("",WAIT);
objClient.execute(objFunction1);*/
CHECK THE RETURN MSG .IT WILL TELL THE PROBLEM
give me points if it is useful
regards
Guru
Message was edited by:
Guruvulu Bojja
Message was edited by:
Guruvulu Bojja
Message was edited by:
Guruvulu Bojja -
ORA-00604 error when trying to insert into a XMLTYPE stored as BINARY
Hi. Here's the scenario.
Here's my Oracle version:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
The database is encoded as AL32UTF8.
First I create the table...
create table binary_table (the_field XMLTYPE) XMLTYPE COLUMN the_field STORE AS BINARY XML;
Now I try and do an insert like this...
insert into binary_table values (xmltype('<?xml version="1.0" encoding="AL32UTF8"?>' || chr(10) || '<a>b</a>' || chr(10)));
and I get this error:
SQLState: 60000
ErrorCode: 604
Position: 122
Error: ORA-00604: error occurred at recursive SQL level 1
ORA-00942: table or view does not exist
If I create the table with a CLOB storage option for the XMLTYPE, the insert works fine. If I repeat these steps in another database instance, same Oracle version, that's encoded as WE8ISO8859P1, it also works fine. It behaves the same in several clients. I also tried it with several different values for NLS_LANG and that didn't help.
I do want to say that this database instance has just been set up especially for me so I can do some R&D on AL32UTF8 and XMLTYPE to see if it fits our needs. So it might be a problem with the database instance.
Thanks for taking a look at this.
Ralph
Edited by: stryder100 on Jul 24, 2009 12:11 PMHi,
Use this
Load data
append Into TABLE HS_HRMIG_EMP_PER_20MAR07 fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS.
Here optional enclosed by is for doubles quotes which should needs to place in single quotes.
like '"'.
try with this.
--Basava.S -
Looking data from more than one table and inserting into another.
Hello,
I am giving you the Table structures as per my requirement..
CREATE TABLE TEMP_A
(NAME VARCHAR2(100) primary key);
CREATE TABLE TEMP_B
(STRUCTURE VARCHAR2(10));
CREATE TABLE TEMP_C
( NAME VARCHAR2(100),
STRUCTURE VARCHAR2(10),
VALUE VARCHAR2(10));
Alter table TEMP_C
add constraint fk_name_tempc foreign key(name) references TEMP_A(name)
INSERT INTO TEMP_A VALUES('SMITH');
INSERT INTO TEMP_A VALUES('ALLEN');
INSERT INTO TEMP_A VALUES('WARD');
INSERT INTO TEMP_A VALUES('JONES');
COMMIT;
INSERT INTO TEMP_B VALUES('IN');
INSERT INTO TEMP_B VALUES('IN_MIN');
INSERT INTO TEMP_B VALUES('IN_TYP');
INSERT INTO TEMP_B VALUES('IN_MAX');
INSERT INTO TEMP_B VALUES('DIP');
INSERT INTO TEMP_B VALUES('TIM');
COMMIT;
INSERT INTO TEMP_c VALUES('SMITH','C1','');
INSERT INTO TEMP_c VALUES('SMITH','C2','');
INSERT INTO TEMP_c VALUES('SMITH','D1','');
INSERT INTO TEMP_c VALUES('ALLEN','D2','');
INSERT INTO TEMP_c VALUES('ALLEN','R1','');
INSERT INTO TEMP_c VALUES('WARD','R2','');
COMMIT;
i want to say is it should insert into table 'TEMP_C' values as :
For 'SMITH' there should be (6 * 3) = 18 records.
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C1')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C2')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'D1')
For 'ALLEN' there should be (6 * 2) = 12 records.
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'D2')
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'R1')
For 'WARD' there should be (6 * 1) = 6 records.
( 6 distinct values of TEMP_B for WARD to be inserted into TEMP_C against 'R2')
Like this if there are records for JONES also , it should also do the same way( Depending on the No. of records present
in the table 'TEMP_C' for 'JONES').
Thanks in advance,
AmkotzIs this what you are looking for?
SQL> insert into temp_c (name, structure, value)
2 select c.name, c.structure, b.structure
3 from temp_a a, temp_c c, temp_b b
4 where a.name = c.name
5 ;
36 rows created.
SQL> select * from temp_c;
NAME STRUCTURE VALUE
SMITH C1
SMITH C2
SMITH D1
ALLEN D2
ALLEN R1
WARD R2
SMITH C1 IN
SMITH C1 IN_MIN
SMITH C1 IN_TYP
SMITH C1 IN_MAX
SMITH C1 DIP
SMITH C1 TIM
SMITH C2 IN
SMITH C2 IN_MIN
SMITH C2 IN_TYP
SMITH C2 IN_MAX
SMITH C2 DIP
SMITH C2 TIM
SMITH D1 IN
SMITH D1 IN_MIN
SMITH D1 IN_TYP
SMITH D1 IN_MAX
SMITH D1 DIP
SMITH D1 TIM
ALLEN D2 IN
ALLEN D2 IN_MIN
ALLEN D2 IN_TYP
ALLEN D2 IN_MAX
ALLEN D2 DIP
ALLEN D2 TIM
ALLEN R1 IN
ALLEN R1 IN_MIN
ALLEN R1 IN_TYP
ALLEN R1 IN_MAX
ALLEN R1 DIP
ALLEN R1 TIM
WARD R2 IN
WARD R2 IN_MIN
WARD R2 IN_TYP
WARD R2 IN_MAX
WARD R2 DIP
WARD R2 TIM
42 rows selected.
SQL> -
Why doesn't this insert into XMLTYPE work?
Hi again. Hopefully I'll be answering questions soon, but meanwhile I've got another one.
I'm working in this environment...
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
The encoding for the database is WE8ISO8859P1.
in SQL Plus. I created a table with an XMLTYPE column stored as binary. Here's the desc...
PS: BWDSTG> desc bwddoc;
Name Null? Type
SUNAME VARCHAR2(100)
SOURCE_DOC_TEXT CLOB
DOC_TEXT SYS.XMLTYPE STORAGE BINARY
LAST_UPDATE_DATE DATE
PS: BWDSTG>
The following error also occurred when I created the same table with a storage type of CLOB for DOC_TEXT. Here's the error I can't figure out...
PS: BWDSTG> insert into bwddoc (doc_text) values ('<?xml version="1.0" encoding="UTF-8"?>
2 <a>–</a>
3 ');
insert into bwddoc (doc_text) values ('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00217: invalid character 8211 (U+2013)
Error at line 2
It accepts the command if I replace the – with plain text. Why does it care what the character entity reference is? It's changing the encoding pseudoattribute in the xml declaration to US-ASCII anyway, and this character entity should be perfectly acceptable. I'd appreciate it if anyone knows the reason for this (or what I'm not understanding, which as always is a distinct possibility).Sorry, let me try again. SQLPlus doesn't have a problem with the multiple lines, so I'm just trying to insert the XML.
PS: BWDSTG> insert into bwddoc (doc_text) values (xmltype('<?xml version="1.0" encoding="US-ASCII"?>
2 <a>—</a>
3 '));
insert into bwddoc (doc_text) values (xmltype('<?xml version="1.0" encoding="US-ASCII"?>
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00217: invalid character 8212 (U+2014)
Error at line 2
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at line 1
My problem is that...
<?xml version="1.0" encoding="US-ASCII"?>
<a>—</a>
should be perfectly good HTML. libxml2 and expat both have no problem parsing it. They just leave — (which is some kind of a dash) alone. But Oracle XMLType doesn't like it for some reason. I need to load a lot of data that has numeric character entities like this but I can't 'til I get this resolved. -
Hi,
I am using Access 2013 and I have the following VBA code,
strSQL = "INSERT INTO Master SELECT * from Master WHERE ID = 1"
DoCmd.RunSQL (strSQL)
when the SQL statement is run, I got this error.
SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field
Any suggestion on how to get around this?
Please advice and your help would be greatly appreciated!Rather than modelling the many-to-many relationship type by means of a multi-valued field, do so by the conventional means of modelling the relationship type by a table which resolves it into two one-to-many relationship types. You give no indication
of what is being modelled here, so let's assume a generic model where there is a many-to-many relationship type between Masters and Slaves, for which you'd have the following tables:
Masters
....MasterID (PK)
....Master
Slaves
....SlaveID (PK)
....Slave
and to model the relationship type:
SlaveMastership
....SlaveID (FK)
....MasterID (FK)
The primary key of the last is a composite one of the two foreign keys SlaveID and MasterID.
You appear to be trying to insert duplicates of a subset of rows from the same table. With the above structure, to do this you would firstly have to insert rows into the referenced table Masters for all columns bar the key, which, presuming this to be
an autonumber column, would be assigned new values automatically. To map these new rows to the same rows in Slaves as the original subset you would then need to insert rows into SlaveMastership with the same SlaveID values as those in Slaves referenced
by those rows in Slavemastership which referenced the keys of the original subset of rows from Masters, and the MasterID values of the rows inserted in the first insert operation. This would require joins to be made between the original and the new subsets
of rows in two instances of Masters on other columns which constitute a candidate key of Masters, so that the rows from SlaveMastership can be identified.
You'll find examples of these sort of insert operations in DecomposerDemo.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
In this little demo file non-normalized data from Excel is decomposed into a set of normalized tables. Unlike your situation this does not involve duplication of rows into the same table, but the methodology for the insertion of rows into a table which
models a many-to-many relationship type is broadly the same.
The fact that you have this requirement to duplicate a subset of rows into the same table, however, does make me wonder about the validity of the underlying logical model. I think it would help us if you could describe in detail just what in real world
terms is being modelled by this table, and the purpose of the insert operation which you are attempting.
Ken Sheridan, Stafford, England -
Pl/sql block with "insert into" and schema qualified table throws "error"
Simplified test case:
Oracle9i EE Release 9.2.0.3.0
Oracle JDeveloper 9.0.3.2 Build 1145
create user u1 identified by u1
default tablespace users
quota unlimited on users;
grant connect, resource to u1;
revoke unlimited tablespace from u1;
create user u2 identified by u2
default tablespace users
quota unlimited on users;
grant connect, resource to u2;
revoke unlimited tablespace from u2;
As user u2:
create table u2.t
c1 number
grant select, update, insert, delete on u2.t to u1;
As user u1:
create or replace package test_pkg as
procedure do_insert (p_in number);
end;
create or replace package body test_pkg as
procedure do_insert (p_in number) is
begin
insert into u2.t values (p_in);
commit;
end;
end;
All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
Thanks in advance for any suggestions, etc...Hi Bryan,
Thanks for following up on this. I will look for the bug fix to be published.
- Mark -
hi Friends ,i need a suggestion from you on how to
insert data to all tables on a Database "A " on Test server
Select data from all tables on a Database "A" on Production Server
where id=123
Database A is same with Structures on Test and Production also all Tables will have Id column in common.
The purpose of this insert is ,as we all know Production has the latest data and i need to push to test server on request for particular ID only ( may be weekly once or twice a week )
I have a linked server setup name "LINQ"
Example for one table is below , like wise i need a script which does for 154 tables.
Insert into ABC( id, name)---insert to test server
Select Id, name from LINQ.ProdSerevrname.databasename.ABC where id = 123
Please help me ..
ThanksWhy not use export import wizard for this if you've read access to production?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
When i do a piecewise insert operation, only data in the first piece was inserted into the column, There is no error occured. a OCI_SUCCESS returned when the last piece operation completed.
I am really puzzled now:(.
Who can get me out of this?
The data to be insert are stored in many structs:
typedef struct test_st{
char * buffer;
struct test_st * next;
} TEST_ST;
I use malloc(size) to allocate the buffer of each struct, and I use strcpy() to copy some strings to these buffers.
table mc_test is like this:
id number;
message varchar(64);
The full source_code goes there:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <oci.h>
static OCIEnv *p_env;
static OCIError *p_err;
static OCISvcCtx *p_svc;
static OCIStmt *p_sql;
static OCIDefine p_dfn = (OCIDefine ) 0;
static OCIBind p_bnd = (OCIBind ) 0;
const char * orausername="out_user";
const char * orapassword="user_out";
const char * oraserver="bigfish";
int oraOK=0;
int rc;
char errbuf[100];
int errcode;
int checkerr(OCIError *errhp, sword status);
int db_init(void);
int db_open(void);
int db_close(void);
typedef struct test_st{
char * buffer;
struct test_st * next;
} TEST_ST;
int db_save_to_test(){
char sql_str[512];
ub4 typep;
ub4 piec_status;
ub1 in_outp;
ub4 rownum;
ub4 arr;
sb2 indp;
ub2 r_code;
int t_buff_len;
int total_len=15;
int buffer_pos=0;
TEST_ST * content, * t;
content=(TEST_ST *) malloc(sizeof(TEST_ST));
content->buffer= (char *) malloc(5);
strcpy(content->buffer,"1234");
content->next=(TEST_ST *) malloc(sizeof(TEST_ST));
content->next->buffer= (char *) malloc(5);
strcpy(content->next->buffer,"5678");
content->next->next=(TEST_ST *) malloc(sizeof(TEST_ST));
content->next->next->buffer= (char *) malloc(5);
strcpy(content->next->next->buffer,"9012");
content->next->next->next=NULL;
if(!_ora_OK){
return 0;
printf("-------------------------\n");
printf("[db]save to mc_test..\n");
printf("total: %d bytes\n",total_len);
/* create sql */
sprintf(sql_str,"insert into mc_test(id,message)values(1,:x)");
//printf("%s\n",sql_str);
rc = OCIStmtPrepare(p_sql, p_err, sql_str,
(ub4) strlen(sql_str), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
checkerr(p_err,rc);
rc = OCIBindByPos(p_sql, &p_bnd, p_err, (ub4) 1,
(dvoid *) content->buffer, total_len, SQLT_CHR, (dvoid *) 0,
(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DATA_AT_EXEC);
checkerr(p_err,rc);
rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
checkerr(p_err,rc);
if(rc == OCI_NEED_DATA){
printf("[pw] start........\n");
// insert next pieces
t=content;
printf("%d bytes total.\n",total_len);
while(t!=NULL){
if(t==content){
piec_status=OCI_FIRST_PIECE;
t_buff_len=strlen(t->buffer);
buffer_pos=t_buff_len+1;
printf("ready for first piece: %d bytes\n",t_buff_len+1);
printf("__________________\n%s\n__________________\n",t->buffer);
}else if(t->next==NULL){
piec_status=OCI_LAST_PIECE;
t_buff_len=strlen(t->buffer);
buffer_pos+=t_buff_len+1;
printf("ready for last piece: %d bytes\n",t_buff_len+1);
printf("__________________\n%s\n__________________\n",t->buffer);
}else{
piec_status=OCI_NEXT_PIECE;
t_buff_len=strlen(t->buffer);
buffer_pos+=t_buff_len+1;
printf("ready for next piece: %d bytes\n",t_buff_len+1);
printf("__________________\n%s\n__________________\n",t->buffer);
t_buff_len++;
rc = OCIStmtSetPieceInfo((dvoid *)p_bnd,
(ub4)OCI_HTYPE_BIND, p_err, (dvoid *)t->buffer,
& t_buff_len, piec_status, (dvoid *) 0, &r_code);
checkerr(p_err,rc);
rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
checkerr(p_err,rc);
t=t->next;
if(rc==OCI_SUCCESS){
printf("All insert OK\n");
printf("-------------------------\n");
return 0;
}else if(rc==OCI_SUCCESS){
printf("Simple inserted.\n");
printf("-------------------------\n");
return 1;
}else{
checkerr(p_err,rc);
printf("-------------------------\n");
return 0;
int main(){
db_init();
db_open();
db_save_to_test();
db_close();
int db_close(){
rc = OCILogoff(p_svc, p_err); /* Disconnect */
rc = OCIHandleFree((dvoid *) p_sql, OCI_HTYPE_STMT); /* Free handles */
rc = OCIHandleFree((dvoid *) p_svc, OCI_HTYPE_SVCCTX);
rc = OCIHandleFree((dvoid *) p_err, OCI_HTYPE_ERROR);
oraOK=0;
return rc;
int db_open(){
/* Connect to database server */
rc = OCILogon(p_env, p_err, &p_svc, orausername, strlen(_ora_username), orapassword, strlen(_ora_password), oraserver, strlen(_ora_server));
if (rc != 0) {
OCIErrorGet((dvoid *)p_err, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Error - %.*s\n", 512, errbuf);
return(8);
/* Allocate SQL */
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_sql,
OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0);
checkerr(p_err,rc);
oraOK=1;
return rc;
int db_init(){
rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */
(dvoid * (*)(dvoid *, size_t)) 0,
(dvoid * (*)(dvoid *, dvoid *, size_t))0,
(void (*)(dvoid *, dvoid *)) 0 );
/* Initialize evironment */
rc = OCIEnvInit( (OCIEnv **) &p_env, OCI_DEFAULT, (size_t) 0, (dvoid **) 0 );
/* Initialize handles */
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0);
checkerr(p_err,rc);
return rc;
int checkerr(OCIError *errhp, sword status){
text errbuf[512];
sb4 errcode = 0;
switch(status){
case OCI_SUCCESS:
return 0; break;
case OCI_SUCCESS_WITH_INFO:
(void) printf("Error - OCI_SUCCESS_WITH_INFO\n");
break;
case OCI_NEED_DATA:
(void) printf("Error - OCI_NEED_DATA\n");
break;
case OCI_NO_DATA:
(void) printf("Error - OCI_NODATA\n");
break;
case OCI_ERROR:
(void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode,
errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
(void) printf("Error - %.*s\n", 512, errbuf);
break;
case OCI_INVALID_HANDLE:
(void) printf("Error - OCI_INVALID_HANDLE\n");
break;
case OCI_STILL_EXECUTING:
(void) printf("Error - OCI_STILL_EXECUTE\n");
break;
case OCI_CONTINUE:
(void) printf("Error - OCI_CONTINUE\n");
break;
default:
break;
return 1;
ref: http://www.oracle.com.cn/onlinedoc/appdev.920/a96584/oci05bnd.htm#427755On Windows, the Flash player plugin DLL is under C:\Windows. When everything is working correctly, Firefox finds the Flash player by checking entries under a registry key. I don't know whether this check takes place every time Firefox restarts, or at other intervals.
Other plugins may install differently, e.g., copying a DLL into a folder under c:\Program Files (x86). It's rare for a plugin to be profile-specific.
If your plugin list is not updating, the pluginreg.dat file that stores plugin information might be corrupted. This article has a section on how to delete that file so Firefox will regenerate it: [https://support.mozilla.org/en-US/kb/troubleshoot-issues-with-plugins-fix-problems#w_re-initializing-the-plugins-database]. Does that help? -
Need to insert into NVARCHAR2 column in a database table
I need to insert into a table with column type NVARCHAR2(2000) in java.
Cant use normal setString on that column. How can I do this using PreparedStatement in Java?The scenario is:
I have to read a CSV file which contains a column in Urdu language, and show it on the JTable first.
Then I have to import the JTable contents into a database table.
Database Table structure is:
CREATE TABLE IMPORT_TMP (
ctype VARCHAR2(3),
urdu_name NVARCHAR2(2000)
);My java code which inserts into the database table is:
Vector dataVector = tableModel.getDataVector();
rowVector = (Vector) dataVector.get(row);
cType = "";
if (rowVector.get(INDEX_BANK) != null) {
cType = rowVector.get(INDEX_CTYPE).toString();
urduName = "";
if (rowVector.get(INDEX_URDU_NAME) != null) {
urduName = rowVector.get(INDEX_URDU_NAME).toString();
statementInsert.setString(1, cType);
statementInsert.setString(2, urduName);I also applied Renderer on the table column, my renderer class is:
public class LangFontRenderer extends JLabel implements TableCellRenderer {
private Font customFont;
public LangFontRenderer(Font font) {
super();
customFont = font;
System.out.println("font = " + font.getFontName());
this.setFont(font);
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value != null) {
if (value instanceof String) {
setText((String) value);
return this;
return this;
@Override
public Font getFont() {
return customFont;
// overriding other methods for performance reasons only
@Override
public void invalidate() {
@Override
public boolean isOpaque() {
return true;
@Override
public void repaint() {
@Override
public void revalidate() {
@Override
public void validate() {
}I applied the renderer on the column as:
TableColumn col = IATable.getColumnModel().getColumn(INDEX_URDU_NAME);
LangFontRenderer langRenderer = new LangFontRenderer(new java.awt.Font("Urdu Naskh Asiatype", 0, 11));
col.setCellRenderer(langRenderer);It does not give any error but when i query on the database table it does not show the column data in Urdu language.
Also it does not show the correct value on JTable column, some un-identified symbols.
Furthermore when I open the CSV file in notepad, it shows the correct language in that column, as I have installed the Urdu language and font on my system. -
Insert into table error - ora-01722 invalid number
Need some assistance with inserting data into a table. The date column keeps on failing to insert.
here is my insert statement
insert into tab_mod_history (TABLE_OWNER, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, INSERTS, UPDATES, DELETES, TIMESTAMP, TRUNCATED)
values ('$i_owner','$i_table','$i_part_name','$i_subpart_name','$i_ins','$i_upd','$i_del','$time','$trunc');Script loads data for partition tables, but not normal tables with the timestamp column
I select the data using this select statement:
select table_owner, table_name, partition_name, subpartition_name, inserts, updates, deletes, timestamp, truncated
from dba_tab_modifications
where table_owner in ('scott','MAC')
order by table_name;ok here are the errors:
values ('MAC','WC_MST','11','1','1','12/04/2011','NO','','')
ERROR at line 2:
ORA-01722: invalid number
Session altered.
values ('MAC','WF_05A','208','128','208','18/02/2011','NO','','')
ERROR at line 2:
ORA-01722: invalid numberHere is the table structure
SQL> desc tab_mod_history
Name Null? Type
TABLE_OWNER VARCHAR2(30)
TABLE_NAME VARCHAR2(30)
PARTITION_NAME VARCHAR2(30)
SUBPARTITION_NAME VARCHAR2(30)
INSERTS NUMBER
UPDATES NUMBER
DELETES NUMBER
TIMESTAMP DATE
TRUNCATED VARCHAR2(3)
DROP_SEGMENTS NUMBERI used the column names to create the variables..that is why $time was used.
How else could I have done it????
thought this was easy..but to my dismay... -
Trigger on Insert into a custom table from external application
This is the problem I am facing.
External Application using a different schema lets say extdb on a different server. This writes into a table in a schema called appscustom schema. Appscustom schema is under Oracle Apps.
A trigger in Oracle Apps to be executed on insert into the appscustom schema table.
This trigger inturn will run a concurrent job to create the invoice and gl interface tables.
THe problem I am facing is, The trigger get executed but the concurrent job does not get triggered/run.
Here is the trigger. Let me know, what might be wrong.
THe values for vRESP_APPL_Id,vRESP_ID, vUSER_ID becomes null in the test_pims table.
Whereas when I manually insert from backend into appscustom schema table the concurrent job gets submitted.
~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Start of DDL Script for Trigger APPS.RWJF_PIMS_ORACLE_INT
-- Generated 5/25/2005 22:10:52 from APPS@HENRY_DEVL
CREATE OR REPLACE TRIGGER rwjf_pims_oracle_int
AFTER
INSERT
ON rwjf_pimstxnbatch
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (new.status = 'U' )
Declare
ReturnCode BOOLEAN;
ConcReqID NUMBER := 0;
vRESP_APPL_ID NUMBER;
vRESP_ID NUMBER;
vUSER_ID NUMBER;
LoadToAp NUMBER :=0;
LoadToGl NUMBER :=0;
Begin
-- vRESP_APPL_ID := apps.fnd_profile.value(200); -- AP --('RESP_APPL_ID');
-- vRESP_ID := apps.fnd_profile.value(20639); -- 20639 for payables mgr. for rwjf_payables Mgr (50001); --('RESP_ID');
-- vUSER_ID := apps.fnd_profile.value(1247); -- 1247 for sury 1065 for interface -- ('USER_ID');
LoadToAp := 0;
SELECT COUNT(*)
INTO LoadToAp
FROM rwjf.RWJF_PimsTxnBatchDtl
WHERE GL_OR_AP = 'A'
AND pims_txn_batch_id = :NEW.Pims_Txn_Batch_id;
LoadToGl := 0;
SELECT COUNT(*)
INTO LoadToGl
FROM rwjf.RWJF_PimsTxnBatchDtl
WHERE GL_OR_AP = 'G'
AND pims_txn_batch_id = :NEW.Pims_Txn_Batch_id;
IF LoadToAp > 0 THEN
vRESP_APPL_ID := 200; -- Application Id 200 Account payables
vRESP_ID := 50001; -- RWJF_Payables Mgr for user interface
vUSER_ID := 1065; -- user id for user name interface
apps.fnd_global.apps_initialize(vUSER_ID,vRESP_ID,vRESP_APPL_ID);
ConcReqID := 0;
ReturnCode := FND_REQUEST.SET_MODE(TRUE);
ConcReqID := FND_REQUEST.SUBMIT_REQUEST('RWJF',
'RWJF_PIMS_INT',
'', '', FALSE,
:NEW.Pims_Txn_Batch_id,'AP', chr(0),
END IF;
IF LoadToGl > 0 THEN
vRESP_APPL_ID := 20003;
vRESP_ID := 50003;
vUSER_ID := 1065;
apps.fnd_global.apps_initialize(vUSER_ID,vRESP_ID,vRESP_APPL_ID);
ConcReqID := 0;
ReturnCode := FND_REQUEST.SET_MODE(TRUE);
ConcReqID := FND_REQUEST.SUBMIT_REQUEST('RWJF',
'RWJF_PIMS_INT',
'', '', FALSE,
:NEW.Pims_Txn_Batch_id,'GL',chr(0),
END IF;
insert into test_pims
values
('Test3',:New.Pims_Txn_Batch_id,vUSER_ID,vRESP_ID,vRESP_APPL_ID);
insert into test_pims
values
('Test3',ConcReqID,vUSER_ID,vRESP_ID,vRESP_APPL_ID);
IF ConcReqID = 0 THEN
DBMS_OUTPUT.PUT_LINE('Problem Submitting Program to get pims txn batch'); /* Handle Error */
END IF;
End;
-- End of DDL Script for Trigger APPS.RWJF_PIMS_ORACLE_INTdon't quite understand the structure of your tables but it sounds similiar to a merge statement.
(contiditonally insert, update records depending on whether or not corresponding records exist)
create table custom_table
(cust_no number,
line_no number,
party_id number
create table hz_parties
as (
select 1 party_id, 'A' bill_to_location, 10 cust_no, 100 line_no from dual union
select 2, 'B', 20, 200 from dual union
select 3, 'C', 30, 300 from dual union
select 4, 'D', 40, 400 from dual
merge into custom_table t1
using (select * from hz_parties) t2
on (t1.party_id = t2.party_id)
when not matched then insert (t1.cust_no, t1.line_no, t1.party_id)
values (t2.cust_no, t2.line_no, t2.party_id);
Edited by: pollywog on Mar 5, 2010 6:52 AM
Maybe you are looking for
-
Simple Drop Down Menu buttons not working
I'm having a bit of trouble getting a button in a hoover over drop down menu to link to another scene in the .swf movie. I just doing a basic drop down menu (example here: http://www.flashkit.com/tutorials/Interactivity/Navigation/Drop_dow-Phlook-951
-
No choice to esit sequence in audition
On CS 5.5 when I right click my audio files why am I not getting a choice to either edit the clip or sequence in audition - the only option is clip?
-
Revoke access to Business Areas while loading data
Hi, What is the best practive to restrict access to business areas (or entire EUL) while data is being loaded? Currently users could use Discoverer to query the tables being loaded. What would be an efficient way to make sure they are not able to que
-
METHOD4의 INTERNAL/EXTERNAL DATATYPE & COERCING DATATYPE(SQLPRC)
제품 : PRECOMPILERS 작성날짜 : 1998-05-14 METHOD4에서는 DATA TYPE을 변경해주어야 하는 경우가 있으므로 INTERNAL DATATYPE과 EXTERNAL DATATYPE이 어떻게 다르고 이것이 어떻게 이용되는지 알아야 한다. 그리고 특해 SQLDA->T의 값이 각 TYPE의 숫자로 들어가므로 아래의 내용을 참조하여 DATA TYPE을 유추해야한다. << Internal Datatype >> VARCHAR2
-
Sorting query based on connect level
Hi. I have a query like this: SELECT DISTINCT LOAD_PROF2, V_TIME, SUBSTATION_CODE, CIRCUIT_CODE, PROFILE_DAY, DECODE (UPPER (PROFILE_DAY),