Trying to insert CLOB data into Remote Table..
Hi everyone,
I think this question had already posted.But i am not able to figure out this problem..
what i am trying to do is
I have a table in the remote database with a CLOB column like this
REMOTE_TABLE
============
REMOTE_TABLE_ID (Populated with sequence)
REMOTE_CLOB CLOB
In my Local database i have to write a Procedure to gather some information on a particular record (My Requirement) and save that CLOB in the REMOTE_TABLE.
I built that procedure like this
Declare
var_clob CLOB; /* I need to processs several records and keep all data in a clob
begin
/***** Processed several records in a local database and stored in the variable var_clob which i need to insert into remote database ****/
Insert into remote_table@remote values (remote_table_seq.nextval,var_clob);
/*** when i try to execute the above command i am getting the following error
ORA-06550: line 6, column 105:
PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables
ORA-06550: line 6, column 1:
PL/SQL: SQL Statement ignored *****/
/***For a test i created the same table in local db****/
Insert into local_table values (local_table_seq.nextval,var_clob);
It is working fine and i am able to see the entire CLOB what i want.
surprisingly if i pass some value instead of a varibale to the remote table like the following..
Insert into remote_table@remote values (remote_table_seq.nextval,'Hiiiiiiiii');
It is working fine...
I tried the following too..
decalre
var_clob clob;
begin
var_clob := 'Hiiiiiiiiiiiiiii';
Insert into remote_table@remote (remote_table_id) values (1);
commit;
update remote_table@remote set remote_clob = var_clob where remote_table_id = 1;
commit;
end
I am getting the following error..
ORA-22922: nonexistent LOB value
ORA-02063: preceding line from CARDIO
ORA-06512: at line 6
Could someone please help me in fixing this issue..I need to process all the data to a variable like var_clob and insert that clob into remote table..
Thanks in advance..
phani
Go to http://asktom.oracle.com and search for clob remote table
also docs contain quite lot of info:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_working.htm#sthref97
Gints Plivna
http://www.gplivna.eu
Similar Messages
-
Hi all,
I have a table t of type xmltype.
I have a function getData which parses an XML file and returns the CLOB data.
I have a statement as
"insert into t values(xmltype(getData('abc.xml')));"
I get the following error
ERROR at line 1:
ORA-00600: internal error code, arguments: [17177], [0x0], [], [], [], [], [],
ORA-31011: XML parsing failed
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1
ORA-06512: at "ADAPT.AP_CREATE_INSP_LOAD", line 57
ORA-06512: at line 1
At line 57 I have the above mentioned "insert into..." statement.
Can anybody tell me what can be the problem.
Interestingly enough, the same things work on same Oracle version on Windows 2k, Windows 2k3, another Solaris 8 machine.
Please help asap as I am in fire fighting mode.
Thanks & Regards,
Aniruddha DeshpandeHi Aniruddha
I think you need to post to a db forum rather than XMLP.
Tim -
Insert the data into two tables at a time.
Hi ,
i have these two tables
create table [dbo].[test1](
[test1_id] [int] identity(1,1) primary key,
[test2_id] [int] not null
create table [dbo].[test2](
[test2_id] [int] identity(1,1) primary key,
[test1_id] [int] not null
alter table [dbo].[test1]
add constraint [fk_test1_test2_id] foreign key([test2_id])
references [dbo].[test2] ([test2_id])
alter table [dbo].[test2] add constraint [fk_test2_test2_id] foreign key([test1_id])
references [dbo].[test1] ([test1_id])
I want to insert the data into two tables in one insert statement. How can i do this using T-SQL ?
Thanks in advance.You can INSERT into both tables within one Transaction but not in one statement. By the way, you would need to alter your dbo.Test1 table to allow null for first INSERT test2_id column
See sample code below:
CREATE TABLE #test1(test1_ID INT IDENTITY(1,1),test2_id INT NULL)
CREATE TABLE #test2(test2_ID INT IDENTITY(1,1),test1_ID INT)
DECLARE @Test1dentity INT
DECLARE @Test2dentity INT
BEGIN TRAN
-- Insert NULL as test2_ID value is unknown
INSERT INTO #test1(test2_ID)
SELECT NULL;
-- get inserted identity value
SET @Test1dentity = SCOPE_IDENTITY();
INSERT INTO #test2(test1_ID)
SELECT @Test1dentity;
-- get inserted identity value
SET @Test2dentity = SCOPE_IDENTITY();
-- Update test1 table
UPDATE #test1
SET test2_ID = @Test2dentity
WHERE test1_ID = @Test1dentity;
COMMIT
SELECT * FROM #test1;
SELECT * FROM #test2;
-- Drop temp tables
IF OBJECT_ID('tempdb..#test1') IS NOT NULL
BEGIN
DROP TABLE #test1
END
IF OBJECT_ID('tempdb..#test2') IS NOT NULL
BEGIN
DROP TABLE #test2
END
web: www.ronnierahman.com -
How to insert/Update date into Dictionary Table?
Dear Experts,
I have created a Dictionary Project and Deployed.I think the table had created in portal database.
now i want to insert some data into that table?
Can you plz tell me how to access the table using Abstract Portal Component using DynPage.
Waiting for ur replies...
Thanks and Regards,
Visweswar.Hi
Can u share the Logic??? -
How to insert Legacy data into QP_RLTD_MODIFIERS table?
How to insert Legacy data into QP_RLTD_MODIFIERS table in R12 instance.
I would use the API QP_Modifiers_PUB.Process_Modifiers for pushing legacy pricing data into R12. QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environnment, only promos have data in this table).
-
How to insert text data into temp tables....
Dear All,
I have one notepad with three columns, first column is segment1, second column is segment2 & third column is price list....
and there is no delimiter and exact spaces..(i.e, zizak fomat)
Ex:-
xx yy 00009999
kk mmmm 00009333
Data is available like above example...So, I need to insert this data into one table.(2LAKSHS OF RECORDS AVAILABLE IN THAT NOTEPAD)
So, Any can one help me, how to insert this kind of text data into temparory table...
Regards
Krishna
Edited by: user12070109 on May 29, 2010 9:48 PM
Edited by: user12070109 on May 29, 2010 9:49 PMHello,
What manu suggested this can be done through oracle forms.
If as i read your last post you are using that in database it will not work in db. Try to use the same process in oracle forms will work by making some changes.
And if you don't want to use forms then there is one way using SQL LOADER. It required control file to execute for uploading data.
See the below link.
http://www.orafaq.com/wiki/SQL*Loader_FAQ
In this example its showing filename.csv you can use your file name like yourfilename.txt.
So your control file will look like this...
load data
infile 'file_path\file_name.txt'
into table table_name -- use actual table name where you want to upload data
fields terminated by " " -- Here using spaces as you mentioned
(column1, column2, column3) -- Here use the three column names of tableAnd after creating control file with the above code. You can call it in command prompt like this
sqlldr username/password control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
or
sqlldr username/password@dbconnection control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
Before doing this practice make sure SQLLDR.exe availabe in the machine where you have to execute. Otherwise you will have to install db client for using sqlldr.exe
-Ammad -
How to read clob data into a table
Hi we have application which take oracle reports(10G) xml file as input and runs the report and save the output(csv,pdf) in a table.
so i need some idea to impliment the follwoin task .
I need to read the content of the out file whcih in table stored in CLOB(I have not checked yet) column and store the data into another table .
FYI: The out put of the report will have 10+ different column.
could Some please point me to the right direction to acomplis h the task .
Thnaks In Advance.Edited by: 852112 on Apr 13, 2011 10:47 AMWelcome to the forum.
See:
http://www.oracle-base.com/articles/8i/ImportClob.php
http://www.oracle-base.com/articles/8i/ImportBlob.php -
Hi All,
i am facing impact of trigger in MYSQL, scenario is this:
I am Having one table with duplicate records that is consist of (eid,tin,status and some other columns are also there but i need only these three). there is another table which is having same these three columns (eid, tin, status).
eid and tin will be same for given combination only status will be different i.e.
1245 23 0
1245 23 1
1245 23 5
1233 33 3
1211 24 2
1211 24 5
so as per above example i have to feed data into other table as
1245 23 0
1233 33 3
1211 24 5
priority of status is like 0 will be inserted if that is present in record otherwise it will be decrease from 5 to 1.
so i have designed trigger for this which will insert data after reading each row, but it is taking around 6.5 minutes for inserting 300000 records. so is there any other way to improve performance for this mysql program.
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
TRIGGER `kyr_log`.`upd_status` AFTER INSERT
ON `kyr_log`.`kyrlog_bup`
FOR EACH ROW
BEGIN
DECLARE v_eid VARCHAR(28);
DECLARE v_status INT(11);
SELECT kyrl_eid,kyrl_status INTO v_eid,v_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
IF v_eid NOT IN (SELECT kyrl_eid FROM update_status.new_status) THEN
INSERT INTO update_status.new_status(kyrl_eid,kyrl_tin,kyrl_status)
SELECT kyrl_eid,kyrl_tin,kyrl_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
ELSE IF v_status=2 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=3 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=4 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=5 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=0 THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
END IF;
END IF;
END IF;
END IF;
END IF;
END;
$$
DELIMITER ;
please suggest me if there is possibility of any other solution.
thanksactually you didn't have seen discussion on this link , there are many discussion related to MYSQL . and mysql is owned by oracle. so i post it here.
thanks for suggestion -
Need help in stroring CLOB data into a table
Hi All,
I have a CLOB data. Which contains delimited data.
Example:
"111#|#ABC#|#asfsdffgh $|$222#|#XYZ#|#jdsfgdskdsf $|$"
#|# - is column delimiter.
$|$ - is row delimiter
I want to extract and store the above data into a table which has 3 columns. Need help.
I have Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
Thanks in advance,
Girish GHi Girish,
Please go through the below url's...It will give you fair idea and solution. HOpe you know the sql *loader utility. or external table.
http://www.oracle-base.com/articles/10g/LoadLobDataUsingSqlLoader.php
http://www.oracle-base.com/articles/10g/ExternalTablesContainingLobData.php
KPR. -
I can't insert my data into the table - help please
Hello everyone,
I have a trouble about JSP. I'm using Java2 SDK,JSP 1.2,Mysql and TOMCAT.
I want to do this. A user has to enter the nicno,into the html form(EnterNicInter.jsp),to verify if it is already exist or not. If it is exist in the db, an error msg(Record already exist) must be displayed. If not, then the page "InterviewForm.jsp" displayed. This part is working.
But, I can't save these details into the db by clicking submit button int the InterviewForm.jsp.
I wrote a javaBean for this task. Here is it.
CandidateMgr.java
package hrm;
import java.io.*;
import java.sql.*;
public class CandidateMgr
private String nicno;
private String title;
private String firstName;
private String civilStatus;
private String tele;
private String eduQua;
// Constructor
public CandidateMgr()
this.nicno = nicno;
this.title = title;
this.firstName = firstName;
this.civilStatus= civilStatus;
this.tele = tele;
this.eduQua = eduQua;
//getters & setters.
// Initializes the connection and statements
public void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
//Verify nicno
sql="SELECT * FROM Candidate where nicNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql ="INSERT INTO Candidate
VALUES(?,?,?,?,?,?)";
pstmt2 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
public boolean verifyNicNo(){
boolean nic_no_select_ok = false;
String nic="xxxx";
initConnection();
try {
pstmt1.setString(1, nicno);
ResultSet rs1 = pstmt1.executeQuery();
if(rs1.next()){
nic=rs1.getString("nicNo");
if(nic=="xxxx")
nic_no_select_ok = true;
} else{
nic_no_select_ok = false;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return nic_no_select_ok;
public boolean addInter(){
boolean add_inter_ok = false;
try{
//assign values for the object
pstmt2.setString(1, nicno); // ERROR(java:652)
pstmt2.setString(2, title);
pstmt2.setString(3, firstName);
pstmt2.setString(4, civilStatus);
pstmt2.setString(5, tele);
pstmt2.setString(6, eduQua);
if(pstmt2.executeUpdate()==1) add_inter_ok=true;
pstmt2.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return add_inter_ok;
IntreviewForm.jsp (used to submit data into the db)
<form method="POST" action="InterviewCtrl.jsp">
//codes
<input type="text" name="nicno" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="title" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="firstName" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="civilStatus" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="tele" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="eduQua" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
</form>.......................................................................
Here is the "InterviewCtrl.jsp"
<%@ page language="java" import="java.util.*"%>
<%@ page import="hrm.CandidateMgr" %>
<%@ page session="false" %>
<jsp:useBean id="candidate" class="hrm.CandidateMgr" scope="request"/>
<jsp:setProperty name="candidate" property="*"/>
<%-- Execute the addInter() method on the bean and check if it is true or false.-- %>
<%-- if it's true then display a confirmation message "InterConfirm.html" --%>
<%-- else display InterError.html --%>
<%
String nextPage ="MainForm.jsp";
if(candidate.addInter()){
nextPage="InterConfirm.html";
}else{
nextPage="InterError.html";
%>
<jsp:forward page="<%=nextPage%>"/>.......................................................................
Here is the error:(I mark it in my bean also)
root cause
java.lang.NullPointerException
at hrm.CandidateMgr.addInter(CandidateMgr.java:652)
at org.apache.jsp.InterviewCtrl_jsp._jspService(InterviewCtrl_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
I use JSP 1.2 , mySQL with TOMCAT. My table name is Candidate.It's fields are as follows:
Candidate(nicNo,title,fName,civilStatus,tele,eduQua)
Can anybody tell me whats going on, help me to solve this please.
Thanks.you should try something different, since you are mixing up a lot of code.
1) create a separate method just to connect and disconnect from a database;
2) use the value entered and see if you can find a record in the table. If the record is there, then you should re-direct your jsp to a jspError, else goes to another form.
the code below give you some idea
if( sAction.equals("Add1") ) {
sITEM = request.getParameter("parameter1");
try {
itemmaster.connect();
itemmaster.viewitemmaster( sITEM );
rs = itemmaster.getRs();
if( rs.next() ) {
sURL = "additemmaster1.jsp";
else {
request.setAttribute( "asITEM", sITEM );
sURL = "additemmaster2.jsp";
finally {
rs.close();
itemmaster.disconnect();
} -
Insert XML data into oracle table
I want to insert xml data returned by the VB code into oracle table.
As a prequisite I have installed the XDK capabilities for Oracle by installing JServer & running
SQL scripts catxsu.sql,xmlparserv2.jar,load.sql to load the XMLSQL Utility (DBMS_XMLQuery) into the database.
I have also granted following privileges to the user.
Grant users access to XMLParser and XMLDom packages:
grant execute on xmldom to public;
grant execute on xmlparser to public;
create public synonym xmldom for sys.xmldom;
create public synonym xmlparser for sys.xmlparser;
But still i am not able to create procedure which will accept input parameter as an XML document coming from front end which in turn will insert that record into simple oracle table . I am using Oracle 8.1.7
Thanks in advanceWould you specify the database version?
Since DBMS_XMLSave requires DOM, you normally need to divide the huge XML before insertion. -
How to insert static data into ADF Table
Hi
I have a requirement , As a part of development of my prototype. I have to populate some static data into table.How to achieve this without using any java is there any way to simply hard code the values into adf table rows.?
Thanks in advancehttp://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/devguide/table.html
http://otndnld.oracle.co.jp/document/products/as10g/101300/B25221_03/web.1013/b25386/web_MasterDetail006.htm
http://andrejusb.blogspot.com/2006/12/displaying-all-columns-in-adf-table.html -
How do I insert input data into anoracle table using C#
Hi guys,
I am new in the .NET arena and I am using Visual Studio 2005 Pro edition.. For instance I have 2 forms one being the main form which calls another to to insert captured text onto a form with the idea of passing it into the oracle database. I am failing to do that using C#. Where am I going wrong? Part of the code when I use actual values, data is written but when I want to write from input text from the form I get an Oracle message ORA-00936. A global connection is established in the first form.
Here is the successful code:
Try
MyCmd.CommandText="insert into station (stn_abb,stn_no,stn_name)"+
"values('MUT','0480','MUTARE')";
Int rowsUpdated = MyCmd.ExecuteNonQuery();
If (rowsUpdated == 0)
MessageBox.Show("RECORD NOT WRITTEN");
Else
MessageBox.Show("RECORD WRITTEN TO TABLE");
Txn.Commit();
Here is the UNSUCCESSFUL code:
Try
MyCmd.CommandText = "insert into station (stn_abb,stn_no,stn_name)" +
"values(@txtStnAbb.Text,@txtStnNo.Text,@txtName.Text)";
Int rowsUpdated = MyCmd.ExecuteNonQuery();
If (rowsUpdated == 0)
MessageBox.Show("RECORD NOT WRITTEN");
Else
MessageBox.Show("RECORD WRITTEN TO TABLE");
Txn.Commit();
Regards,
Ray.Hi,
I assume that in the second example your intent is to use bind variables, but I dont see where you're actually binding any variables. Also, "@" is sqlserver syntax, Oracle's syntax is ":".
Here's a complete example, hope it helps.
Cheers
Greg
create table smallcol(col1 varchar2(5));
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public class odpparams
public static void Main()
OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
con.Open();
OracleCommand cmd = new OracleCommand("insert into testtab values(:1)",con);
cmd.Parameters.Add(new OracleParameter("1",OracleDbType.Varchar2,4,"fred",ParameterDirection.Input));
cmd.ExecuteNonQuery();
Console.WriteLine("done, no errors");
con.Dispose();
} -
Insert CSV data into a table from URL
Hi,
How can I insert the CSV data directly into a database table (the csv format is known, the database table is created accordingly)?
Thanks
Devang.Devang,
There is a limit on the amount of text (32767) you can paste and upload.
I created a process that allows the user to upload a .csv file and it is then written (UTL_FILE) to a known file on the db server. I have an external table definition mapped to that file so I don't have to do any parsing or anyting.
This should work for your situation since you already know the format of the file and the table is already created.
Hope this helps.
chet -
CMP to insert CLOB Data in Oracle
I have a CMP which tries to insert CLOB data into Oracle Database using XMLType column. We have tried multiple options
1. Inserting String data into XMLType column - if the value is more than 4000 chars, it gives an error
2. Inserting CLOB Data into XMLType column - Using the OracleCLob option in the deployment descriptor results in a SQLExcepotion Inconsistent datatype expected number found CLOB.
Can anybody provide a solution to this problem?I have a CMP which tries to insert CLOB data into Oracle Database using XMLType column. We have tried multiple options
1. Inserting String data into XMLType column - if the value is more than 4000 chars, it gives an error
2. Inserting CLOB Data into XMLType column - Using the OracleCLob option in the deployment descriptor results in a SQLExcepotion Inconsistent datatype expected number found CLOB.
Can anybody provide a solution to this problem?
Maybe you are looking for
-
Unable to upload files to server via Transmit (ftp client)
Hi For some reason I am no longer able to upload files via Transmit to my website server. I have built several sites hosted on different servers and I cant access any of them, so it is obviously a problem at my end. The Message I get when I try to co
-
Kernel Upgrade : Few Doubts
during kernel upgrade. I renamed original kernel exe to exe.old > mv exe exe.XX downloaded two SAR & uncarded files to a directory and renamed it to exe. > mv exe.YY exe after found there were multiple files were missing in new kernel. is that some t
-
Lumia 800 Keyboard Problem - Is this Normal?
When using some apps (Facebook, for example) the virtual keyboard becomes partially unresponsive - pressing any key in the bottom two rows is almost impossible. Also, in the messaging app, the 'send' button is inactive when the keyboard is visible. I
-
Bonjour and Apple Mobile Device won't install meaning iTunes won't install
HELP! I've spent the best part of a weekend trying to uninstall and reinstall iTunes after it wouldn't update automatically and then wouldn't recognise my ipod or iphone. I followed the instructions as to the order to remove the different iTunes comp
-
Can i use my iPhone 5s as a remote controller to my MacBook pro?
Can i use my iPhone 5s as a remote controller to my MacBook pro with retina display such as keynote presentations etc.?