Help: Problem Inserting CLOB-data with ODBC
Hello,
I have searched this forum for my problem and found only one similar message, unfortunately without reply. I hope there are some wizards present here today who can help me.
I use Perl and the ODBC driver for 8i (v8.1.5., WinNT) to insert and query data from a tabel with a CLOB. Queries go fine (although you have to increase the buffer size within Perl, but I have a problem to insert values into CLOBS.
I get the message ORA-1704 shown below. Oracle/ODBC seems to think that i want to insert into a VARCHAR2(4000) instead of
a CLOB.
I have included my Perl test-script as well.
Any suggestions are very welcome,
Bart
Error-message:
ORA-01704 string literal too long
Cause: The string literal is longer than 4000 characters.
Action: Use a string literal of at most 4000 characters. Longer values
may only be entered using bind variables.
PERL test-script:
#!perl
# USAGE
# perl clobtest size [bufsize]
# Creates a string of approximately size*1000 bytes, consisting of a line with 'A',
# followed by lines of at most 100 'o's, followed by a line with 'Z'.
# bufsize is optional, if given, specifies the size of the ODBC buffer.
# Default value is 10240
# The string is loaded into a table field, then read from that field, and saved in
# a file. The entire table is deleted on beforehand! so that there is only one
# record in that table. If there are errors, error number and text are displayed on
# the console.
# See the globals below for username, password, host, table end column.
use strict;
use FileHandle;
use Win32::ODBC;
# GLOBALS
# DATABASE
my $ADMIN ='xpa';
my $PWD ='manager';
my $DBMC ='PO8i';
my $table = 'TEST';
my $column = 'OMSCHRIJVING';
my $amount = $ARGV[0];
my $newbufsize = $ARGV[1];
my $bulk;
sub connect_db {
if (!$newbufsize) {
$newbufsize = 10240;
print "Connecting as... $ADMIN to $DBMC\n";
my $dbh = new Win32::ODBC("dsn=$DBMC;UID=$ADMIN;PWD=$PWD");
if (!$dbh) {
print "Hm\n";
die qq(Cannot open ODBC\n);
$dbh->SetMaxBufSize($newbufsize);
my $bufsize = $dbh->GetMaxBufSize();
print "Bufsize = $bufsize\n";
return $dbh;
sub createbulk {
$bulk = "A";
my $bytes = 1000 * $amount;
my $i;
for ($i=0; $i<$bytes-4; $i++) {
if ($i % 100 == 0) {
$bulk .= "\n";
else {
$bulk .= "o";
$bulk .= "\nZ\n";
my $dbh = connect_db();
createbulk();
print "Deleting $table\n";
$dbh->Sql("delete from $table");
print "Inserting into $table -> $column\n";
my $fail = $dbh->Sql("insert into $table ($column) VALUES (\'$bulk\')");
if ($fail) {
print "$dbh->{ErrNum}: $dbh->{ErrText}\n";
exit;
print "Querying from $table -> $column\n";
$fail = $dbh->Sql("select OMSCHRIJVING from TEST");
if ($fail) {
print "$dbh->{ErrNum}: $dbh->{ErrText}\n";
exit;
my @result = ();
while (defined $dbh->FetchRow()) {
my $result = $dbh->Data();
push @result, $result;
print "Writing query result to file \"cltst$amount\"\n";
open TST, ">cltst$amount";
for my $line (@result) {
print TST $line;
close TST;
Hi,
We can't directly insert into a column
which is a clob datatype.To insert data into
the CLOB datatype column we have to write
some PL/SQL progam using the package DBMS_LOB
in oracle.
Read Oracle documentation for more information on DBMS_LOB package.
Hope this will help u.
NEDU.
null
Similar Messages
-
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? -
Inserting Current Date with time stamp in oracle database
Hi Experts,
I want to insert the current Date and time stamp in a field in the Oracle Database Table.
I am able to insert date but i am not able to insert the date with time stamp. Any Suggestions??
Thanks
NaveenNaveen,
Do you want to get current date (from sysdate) with a specific format or transform a value containing a date/time value to insert it in ORACLE ?
Usually, you insert current datetimestamp in a date field using this :
TO_DATE(sysdate,'dd/mm/yyyy hh:mi:ss')
you may have to tweak the format pattern ('dd/mm....') according to your needs
if you want to transform a date, use something like this:
TO_DATE(your_date,your_format)
but make sure your format is compliant with your date, ie
TO_DATE('31/12/2008','MM/DD/YYYY') could raise error (litteral does not match) cuz ORACLE can't recognize 31 as a month pattern
Chris -
Problem while uploading data with GUI UPLOAD Function
Hi,
I am facing problem while uploading data with FM GUI UPLOAD in out text file there are 7 row but after the FM GUI UPLOAD there are 14 entries are coming in Internal table and each alternate row is coming as blank with 0000 in some column in internal table first row is proper and second line is blank so on.
what can be the problem .
The program in which we are using this we are using it from last 2 year but we are facing problem today only.
regards,
zafarHi,
The file formate is same as it is from last two years it is automatically generated by one another bar code server and there is no change in the file formate.
So waht can be the problem to check any inconsistancy in system i have develop a samll program fro uploading a text file with same function module , but it is working fine.
regards,
zafar -
Sql sript for Insert of data with repeating values
It has been a long long time since I had to do write and use any SQL scripts, please forgive the question. I used to use a script to insert values into a table as part of my job. I have forgotten what the script I used was and since lost all my Oracle note books and other DBA material.
I did a search and went through 30 pages of results, I didn't see what I'm looking for.
The data is from one large file that is appended at the end and sometimes updated somewhere in the middle of the set which is considered new data. I am not concern with getting the data out of the file, I got that handled but the insert into the table - transactions - is where I'm lost.
I used to use a script to load the data, about 6 years ago, and it would load the file, exclude the data that was already in the table and insert the new data and the data with the changes.
The data columns are date, time, reference, transaction code, location, debit amount, fee amount, balance.
The date repeats but the time and reference values are unique.
Any help with this script is appreciated.Hi,
welcome to the forum..!
You can use Oracle's merge statement to (update + insert) data into a table ... if the data exists update it with the new values and if it does not, then insert it.
Here's a link to get you started...
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm
Since, the data is from a file, you could create an external table on the file and directly do a select from the file.
MERGE INTO bonuses D
USING (SELECT employee_id, salary, department_id FROM employees
WHERE department_id = 80) S
ON (D.employee_id = S.employee_id)
WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
DELETE WHERE (S.salary > 8000)
WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
VALUES (S.employee_id, S.salary*0.1)
WHERE (S.salary <= 8000);in the above example, the
SELECT employee_id, salary, department_id FROM employeesis the source data. instead of loading the file into a temporary table and then merge into the target table , you could read from <<<external_table_on_your_file>> and then do a merge into the target table.
http://www.oracle.com/technology/products/oracle9i/daily/sept19.html
If you encounter any problems, please post the full description of your error.
Thanks,
Rajesh.
Please mark this/any other answer as helpful or answered if it is so. If not, provide additional details/feedback.
Always try to provide create table and insert statements to help the forum members help you better. -
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 -
Please Help, problem in Excel Date.
Hi,
Currently, I am having a JBDC-ODBC connecting to an Excel file, it will read a number of data from the file and one of them is the date (formatted to month/day/year using format cell in Excel). As I need to compared the date entered in Excel with the current date, I had tried (rs.getString("Date").equalsIgnoreCase(date)) ,and converting the current date to String or Integer before comparing with the Excel data but to no avail. Hence, greatly appreciate that someone can provide me with some pointers in comparing the Excel data with the current date (using getTime()).
In addition, why can't I insert data into another sheet using the following (there is no problem in inserting into the same sheet I am reading data from):
a) stmt.executeUpdate("INSERT INTO [sheet1$] (Data1) VALUES ('data1')");
OR
b) uprs.moveToInsertRow();
uprs.updateString("Data1",data1);
uprs.insertRow();
All suggestions and advises are greatly appreciate and welcomed. ThksI would create a Calendar object from the string you read from the Excel file. do this by creating string tokens from the result of rs.getString("Date") to represent your month day year. Then create another calendar object from your date object (or convert it or whatever) and then compare those two. Heres my code:
Calendar deliveryDate = Calendar.getInstance();
StringTokenizer tokens;
int day, month, year;
tokens = new StringTokenizer(excelDateString, "/", false);
month = new Integer(tokens.nextToken()).intValue();
day = new Integer(tokens.nextToken()).intValue();
year = new Integer(tokens.nextToken()).intValue();
deliveryDate.set(year, month, day);Re the second question, no idea sorry.
-tobes -
In condition records section Search help problem at one data type
hi there,
we are upgrading 4.6c version to ecc 6.0 past january. but in
vk11/vk12/vk13 condition master records sections, we have a problem for
one data type search help. when we want to join sales deal code to sales
detarmination condition, at one tables rows type price list (data type =
pltyp_d) does not allow f4 (search help).
thanks your interesting.
Sinan Altıner
Betek Boya ve Kimya Sanayi A.Ş.
SAP CONSULTANT / ABAP DeveloperHi surya,
I per your suggestion i did like this ,
data : date1 like sy-datum.
types : w_date1 type sy-datum.
date1 = w_date1(ztable-date1). "ztable-date1 - is screen field.
but it is giving error "The field "W_DATE1" is unknown, but there is a field with the similar name "DATE1" . . . ."
actually that value is coming after triggering PBO event but i want that value in at time of calling F4 help at that screen filed
suppose on screen the fields like
date : 30.08.2008.
matnr : ( .............F4 ) '".....on this field when i m pressing F4 that time only that above date materials should come as per my first query see my first thread.
thanks,
Sanket. -
Insert same data with next holiday date
Hi All,
I have write a pl block where in i need to copy the existing records from the
table A to table A itself with date+1.
Say for eg. there is a situation were daily one record is inserted into table A
and there is a data column init but NO records for sat,sunday and holidays
I need to write a block to insert records for sat,sun and holiday in the table A
which rec? if rec is missing for say for eg date 04/May/2007 then I need to take
records from 03/May/2007 and insert a new records by copying all the rec from previous date with data column in A as 04/May/2007.
like wise there are lac of rec in table A and thousands of missing rec for sat,sun & holiday.
I am trying to do this by taking cursor and finding out the missing rec and insert it.
i have just started can any one of you help in this. by posting the best logic for this
Thanks,
AAK.Hi1
pls try this --
SQL>
SQL> set serveroutput on
SQL>
SQL>
SQL> set lin 1000
SQL>
SQL> select * from emp_q;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
7777 Avik CLERK 7839 02-MAR-07 3456 263 30 M 12547896
6666 prithwi CLERK 7839 22-JUL-06 1234 248 30 M 14782563
7639 Roni CLERK 3434 17-DEC-80 12121 50 F
7499 ALLEN SALESMAN 7469 20-FEB-81 1234 300 30 M
7521 WARD SALESMAN 7698 14-FEB-07 1234 500 10 F
7566 JONES MANAGER 7469 02-APR-81 1000 10 F
7654 MARTIN SALESMAN 7698 28-SEP-81 1234 1400 53 F
7698 BLAKE MANAGER 7839 01-MAY-81 1234 40 M
7782 CLARK MANAGER 7839 09-JUN-81 1234 20
6194 Verona CLERK 7839 30-APR-07 2365 125 30 F 12543698
6698 Fereda CLERK 7839 30-APR-07 2365 125 30 M 12543698
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
6903 Aliva CLERK 7839 30-APR-07 2365 125 30 F 12543698
7411 Naba CLERK 7839 27-APR-07 1450 452 30 29631478
7529 Indra SALESMAN 7839 27-APR-07 5025 250 30 M 28963147
7698 BLAKE MANAGER 7839 01-MAY-81 1234 40 M 23515485
7782 CLARK MANAGER 7839 09-JUN-81 1234 20 23651489
7788 SCOTT ANALYST 7566 19-APR-87 1234 40 F 25483698
7839 KING PRESIDENT 7839 17-NOV-81 1234 40 F 23691436
7844 TURNER SALESMAN 7698 08-SEP-81 1234 0 30 F 23459687
7876 ADAMS CLERK 7788 23-MAY-87 1234 10 M 23984297
7900 BARRY CLERK 7698 03-DEC-81 1234 500 10 F 25983147
7902 FORD ANALYST 7566 03-DEC-81 1234 40 F 29541236
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
7934 MILLER CLERK 7458 23-JAN-82 1234 10 F 24893175
23 rows selected.
SQL>
SQL>
SQL> insert into emp_q
2 select empno,ename,job,mgr,sysdate+1,sal,comm,deptno,code,phone
3 from emp_q
4 where empno = 7777;
1 row created.
SQL>
SQL>
SQL> commit;
Commit complete.
SQL>
SQL> select * from emp_q;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
7777 Avik CLERK 7839 02-MAR-07 3456 263 30 M 12547896
6666 prithwi CLERK 7839 22-JUL-06 1234 248 30 M 14782563
7639 Roni CLERK 3434 17-DEC-80 12121 50 F
7499 ALLEN SALESMAN 7469 20-FEB-81 1234 300 30 M
7521 WARD SALESMAN 7698 14-FEB-07 1234 500 10 F
7566 JONES MANAGER 7469 02-APR-81 1000 10 F
7654 MARTIN SALESMAN 7698 28-SEP-81 1234 1400 53 F
7698 BLAKE MANAGER 7839 01-MAY-81 1234 40 M
7782 CLARK MANAGER 7839 09-JUN-81 1234 20
6194 Verona CLERK 7839 30-APR-07 2365 125 30 F 12543698
6698 Fereda CLERK 7839 30-APR-07 2365 125 30 M 12543698
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
6903 Aliva CLERK 7839 30-APR-07 2365 125 30 F 12543698
7411 Naba CLERK 7839 27-APR-07 1450 452 30 29631478
7529 Indra SALESMAN 7839 27-APR-07 5025 250 30 M 28963147
7698 BLAKE MANAGER 7839 01-MAY-81 1234 40 M 23515485
7782 CLARK MANAGER 7839 09-JUN-81 1234 20 23651489
7788 SCOTT ANALYST 7566 19-APR-87 1234 40 F 25483698
7839 KING PRESIDENT 7839 17-NOV-81 1234 40 F 23691436
7844 TURNER SALESMAN 7698 08-SEP-81 1234 0 30 F 23459687
7876 ADAMS CLERK 7788 23-MAY-87 1234 10 M 23984297
7900 BARRY CLERK 7698 03-DEC-81 1234 500 10 F 25983147
7902 FORD ANALYST 7566 03-DEC-81 1234 40 F 29541236
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO C PHONE
7934 MILLER CLERK 7458 23-JAN-82 1234 10 F 24893175
7777 Avik CLERK 7839 04-MAY-07 3456 263 30 M 12547896
24 rows selected.
SQL> Regards.
Satyaki De. -
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. -
Need Help to Transfer Specific Data with dml_condition
i have two databases on two different server with name db1 and db2. i want to transfer specific data with dml condition. bellow is my code
for Server have db1.
--------------Sys----------------------
create user strmadmin identified by strmadmin;
grant connect, resource, dba to strmadmin;
begin dbms_streams_auth.grant_admin_privilege
(grantee => 'strmadmin',
grant_privileges => true);
end;
grant select_catalog_role, select any dictionary to strmadmin;
alter system set global_names=true;
alter system set streams_pool_size = 100 m;
----------------------end--------------------
-----------------------StrmAdmin--------------------------
create database link db2
connect to strmadmin
identified by strmadmin
using 'DB2';
EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
EXEC DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION(table_name => scott.emp');
-- Configure capture process at the source database
begin dbms_streams_adm.add_table_rules
( table_name => 'scott.emp',
streams_type => 'capture',
streams_name => 'capture_stream',
queue_name=> 'strmadmin.streams_queue',
include_dml => true,
include_ddl => true,
inclusion_rule => true);
end;
-- -- Configure Sub Set Rules capture process at the source database
begin dbms_streams_adm.add_subset_rules
( table_name => 'scott.emp',
dml_condition=>'deptno=50',
streams_type => 'capture',
streams_name => 'capture_stream',
queue_name=> 'strmadmin.streams_queue',
include_tagged_lcr => true);
end;
-- Configure the propagation process at Sources Database
begin dbms_streams_adm.add_table_propagation_rules
( table_name => 'scott.emp',
streams_name => 'DB1_TO_DB2',
source_queue_name => 'strmadmin.streams_queue',
destination_queue_name => 'strmadmin.streams_queue@DB2',
include_dml => true,
include_ddl => true,
source_database => 'DB1',
inclusion_rule => true);
end;
-- Configure the Subset propagation Rule process at Sources Database
begin SYS.dbms_streams_adm.add_subset_propagation_rules
( table_name => 'scott.emp',
dml_condition=>'deptno=50',
streams_name => 'DB1_TO_DB2',
source_queue_name => 'strmadmin.streams_queue',
destination_queue_name => 'strmadmin.streams_queue@DB2',
include_tagged_lcr => true);
end;
-- Set the instantiation system change number (SCN)
declare
source_scn number;
begin
source_scn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_table_instantiation_scn@DB2
( source_object_name => 'scott.emp',
source_database_name => 'DB1',
instantiation_scn => source_scn);
end;
-- Start the capture processes
begin dbms_capture_adm.start_capture
( capture_name => 'capture_stream');
end;
---------------------------End----------------------------------------------------------
for server 2 have db2.
--------------------------Sys---------------------------------------------------------------
CREATE USER strmadmin IDENTIFIED BY strmadmin;
GRANT CONNECT, RESOURCE, DBA TO strmadmin;
BEGIN
DBMS_STREAMS_AUTH.grant_admin_privilege (grantee => 'strmadmin',
grant_privileges => TRUE);
END;
GRANT SELECT_CATALOG_ROLE, SELECT ANY DICTIONARY TO strmadmin;
ALTER SYSTEM SET global_names=TRUE;
ALTER SYSTEM SET streams_pool_size = 100 M;
-----------------------------------------------------------End-----------------------------
---------------------------------Stream user--------------------------------------------------------------
CREATE DATABASE LINK db1
CONNECT TO strmadmin
IDENTIFIED BY strmadmin
USING 'DB1';
EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
EXEC DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION(table_name => scott.emp');
-- add table Level rule on target Database.
BEGIN
DBMS_STREAMS_ADM.add_table_rules (
table_name => 'scott.emp',
streams_type => 'apply',
streams_name => 'apply_stream',
queue_name => 'strmadmin.streams_queue',
include_dml => TRUE,
include_ddl => TRUE,
source_database => 'DB1',
inclusion_rule => TRUE);
END;
-- add table Level Sub Set rule on target Database.
BEGIN
DBMS_STREAMS_ADM.add_subset_rules (
table_name => 'scott.emp',
dml_condition => 'deptno=50',
streams_type => 'apply',
streams_name => 'apply_stream',
queue_name => 'strmadmin.streams_queue',
include_tagged_lcr => TRUE);
END;
-- Start the apply processes
BEGIN
DBMS_APPLY_ADM.set_parameter (apply_name => 'apply_stream',
parameter => 'disable_on_error',
VALUE => 'n');
END;
BEGIN
DBMS_APPLY_ADM.start_apply (apply_name => 'apply_stream');
END;
---------------------------------End---------------------------------------------------------------------------------
plz help me.below is the Result.
RULE_NAME RULE_TYPE RULE_SET_TYPE RULE_SET_NAME STREAMS_TYPE STREAMS_NAME
RULE$_7 POSITIVE RULESET$_8 DEQUEUE SCHEDULER_PICKUP
RULE$_11 POSITIVE RULESET$_8 DEQUEUE SCHEDULER_PICKUP
RULE$_3 POSITIVE RULESET$_4 DEQUEUE SCHEDULER_COORDINATOR
EMP122 DDL POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP121 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP124 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP125 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP126 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP115 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP116 DDL POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP118 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP119 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP120 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
Edited by: Naeem Ullah Khattak on Apr 19, 2013 2:57 AM -
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..
phaniGo 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 -
Problem inserting clob value into xmltype column
Hi all,
I have created a table in XML DB using as:
CREATE TABLE TransDetailstblCLOB ( id number, data_xml XMLType) XmlType data_xml STORE AS CLOB;
I am trying to insert large xml data into the data_xml column which is of type XMLTYPE.
I followed this link (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html) to create a clob object and insert into xml.
I am getting the following error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
ORA-06512: at "SYS.XMLTYPE", line 254
ORA-06512: at line 1
My code snippet:
private static CLOB getCLOB(String xmlData, Connection conn) throws SQLException{
CLOB tempClob = null;
if(conn==null){
log.debug("Connection object is null");
throw new SQLException("Connection object is null");
try{
// If the temporary CLOB has not yet been created, create new
tempClob = CLOB.createTemporary(conn, true, CLOB.MODE_READWRITE);
// Open the temporary CLOB in readwrite mode to enable writing
tempClob.open(CLOB.MODE_READWRITE);
// Get the output stream to write
writer = tempClob.getCharacterOutputStream();
writer.write(xmlData);
} catch(SQLException sqlexp){
tempClob.freeTemporary();
sqlexp.printStackTrace();
} catch(Exception exp){
tempClob.freeTemporary();
exp.printStackTrace();
return tempClob;
public static void insertXML(String xmlData, Connection conn){
CLOB clob = null;
String query;
log.debug("Inside insertXML" +xmlData);
try{
query = "INSERT INTO TransDetailstbl1(data) VALUES (XMLType(?)) ";// Changed prev TransDetailstbl
// Get the statement Object
pstmt = conn.prepareStatement(query);
// xmlData is the string that contains the XML Data.
// Get the CLOB object using the getCLOB method.
clob = getCLOB(xmlData, conn);
// Bind this CLOB with the prepared Statement
pstmt.setObject(1, clob);
int i =pstmt.executeUpdate();
log.debug("pstmt.executeUpdate () status ::: "+i);
// Execute the Prepared Statement
if (i == 1) {
log.debug("Record Successfully inserted!");
} catch(SQLException sqlexp){
sqlexp.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
finally{
try{
pstmt.close();
// Flush and close the stream
writer.flush();
writer.close();
// Close the temporary CLOB
tempClob.close();
catch(Exception e)
log.debug("Cant close prepared statement.");
e.printStackTrace();
Can anyone help me out?
Please let me know if any other info is required.
Regards,
RobinaHi all,
I now modified the code to write the data using Stream.
I am getting this error message: SQLException while updateORA-24813: cannot send or receive an unsupported LOB
On googling it seems the its usually caused when I am using the different versions of oracle on
server and client.
My oracle details:
Database product version : Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
JDBC driver name : Oracle JDBC driver
JDBC driver version : 9.2.0.1.0
DataStoreHelper name is: com.ibm.websphere.rsadapter.OracleDataStoreHelper@22542254.
JDBC driver type : thin
Can anyone tell me how to proceed?
Thanks -
SQL Loader Oracle 10g problem in upload date with time data -- Very urgent.
Hi
I am trying to upload data using SQL loader. There are three columns in the table
defined as DATE. When I tried upload a data like this '2007-02-15 15:10:20', it is not loading time part. The date stored as 02/15/2008' only. There is not time on that. I tried with many different format nothing work. Can please help me ?
I have also tried with to_date --> to_timestamp it did not work.
The application is going to be in production, I cannot change DATE to TIME STAMP. This is very urgent.
LASTWRITTEN "decode(:LASTWRITTEN,'null',Null, to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:Mi:SS'))",
CREATEDON "decode(:CREATEDON,'null',Null, to_date(:CREATEDON,'YYYY-MM-DD HH24:Mi:SS'))",
LASTUPDATEDON(21) "decode(:LASTUPDATEDON,'null',Null, to_date(:LASTUPDATEDON(21),'DD/MM/YYYY HH24:MI:SS'))"Your problem is most likely in decode - the return type in your expression will be character based on first search value ('null'), so it will be implicitly converted to character and then again implicitly converted to date by loading into date column. At some of this conversions you probably are loosing your time part. You can try instead use cast:
SQL> desc t
Name Null? Type
LASTWRITTEN DATE
CREATEDON DATE
LASTUPDATEDON DATE
SQL> select * from t;
no rows selected
SQL> !cat t.ctl
LOAD DATA
INFILE *
INTO TABLE T
TRUNCATE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
LASTWRITTEN
"decode(:LASTWRITTEN,'null',cast(Null as date),
to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:MI:SS'))",
CREATEDON
"decode(:CREATEDON,'null',cast(Null as date),
to_date(:CREATEDON,'YYYY-MM-DD HH24:MI:SS'))",
LASTUPDATEDON
"decode(:LASTUPDATEDON,'null',cast(Null as date),
to_date(:LASTUPDATEDON,'DD/MM/YYYY HH24:MI:SS'))"
BEGINDATA
2007-02-15 15:10:20,null,null
null,2007-02-15 15:10:20,null
null,null,15/02/2007 15:10:20
SQL> !sqlldr userid=scott/tiger control=t.ctl log=t.log
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Feb 29 00:20:07 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 3
SQL> select * from t;
LASTWRITTEN CREATEDON LASTUPDATEDON
15.02.2007 15:10:20
15.02.2007 15:10:20
15.02.2007 15:10:20Best regards
Maxim -
Problem loading Image data with French accent in file name
We have a very complex commercial application that has been working perfectly in English for over a year. We have now localized it to French and Spanish, and discovered a serious show-stopping problem. We need help fast, with the scheduled release being less than 2 weeks away...!
We iterate over a folder to find all the images in it, then display those in a user window. The code for loading the images is:
for each (var name:String in filenames){
var image:SmoothImageTransformable = new SmoothImageTransformable();
var imagePath:String = dir + "/" + name;
image.source = imagePath;
trace("Adding Item to picture carousel with url " + image.source);
image.data = {directory:dir, filename:name};
image.isDragEnabled = true;
image.setStyle("horizontalCenter", 0);
image.setStyle("verticalCenter", 0);
_images.push(image);
Our SmoothImageTransformable class is an internal class that inherits from Image. This all works fine for image names like 'myFavoritePhoto', 'test', 'photo346', etc. However, it fails to load the data if the file name is something like 'caméra' Any name with a UTF-8 character causes the data load to fail.
To be sure we weren't doing a load somewhere else in the code that I had overlooked, I added a "image.autoLoad = false' line in there. That did exactly as expected -- all image squares then show a grey blank, with no image shown. Removing that line (reverting to the original code, as shown above) causes all the images to work perfectly, except for those with French accent characters like the é.
HELP! Is this a known bug? Is there some additional setting I need to make it understand the extended character set? I can't find any mention about this at all in the documentation.@markerline:
We have a fix! Almost... I don't understand one aspect of what I am seeing though.
We have one test file named "camèra.jpg" that is an example of what I am unable to load into an Image. I decided to examine the character codes at each letter, and this is what Flex has as the string:
name = cam?ra.jpg
[0] = c; 0x99
[1] = a; 0x97
[2] = m; 0x109
[3] = ?; 0x232
[4] = r; 0x114
[5] = a; 0x97
[6] = .; 0x46
[7] = j; 0x106
[8] = p; 0x112
[9] = g; 0x103
Note that the è prints as gibberish in the trace statement, and shows a numeric encoding of 0x232. According to
http://docstore.mik.ua/orelly/web2/action/appb_01.htm
The unicode equivalent of Latin1 for è is 0xE8, which is equivalent to 0x232. That implies that the string is already Latin1, which I would think would mean that Windoze would recognize the file name and open it properly -- but it does not.
I then tried taking the "camèra.jpg" string, pasting it into NotePad++ in a UTF8 document, then telling NotePad++ to display as ASCII. The result is "camèra". I then tried just forcing the file name within Flex to this new mangled string. The result then is:
MAGIC name = camèra
[0] = c; 0x99
[1] = a; 0x97
[2] = m; 0x109
[3] = ?; 0x195
[4] = ?; 0x168
[5] = r; 0x114
[6] = a; 0x97
[7] = .; 0x46
[8] = j; 0x106
[9] = p; 0x112
[10] = g; 0x103
Note this time the trace statement looks proper. More important, the IMAGE DOES LOAD! (Our display of the name to the user now looks like crap, but that just means I need to modify our class to have a separate 'name' property, rather than extracting it from the 'image.source')
So... my remaining question -- what encoding did I just do through that NotePad++ incantation? That site I quoted above said that it was already Latin1, which is what I thought I was trying to get to. I clearly need to write a method to map from incoming (UTF8 I thought, but maybe Latin1?) to Windows file system (Latin1 I thought, but maybe ASCII).
In other words, I am not sure what charcter set to come from or go to... It turns out the code was already in the character set I had been trying to go to (which is why it wasn't working) and the set I seem to need to go to is not the one I thought...
Maybe you are looking for
-
Image not displayed correctly in image control at small zoom level
I am displaying an image in an image control with a zoom factor of ~0.015 and it appears as shown in image 1.jpg. When I zoom in a little more to ~0.016 the image is displayed correctly as shown in image 2.jpg. Both images are attached. Why is the
-
How do I add HTML5 animations from Adobe Edge in my Muse site?
For now, here are the steps to use Edge output in Muse. Put all output files generated from Edge in the same folder that you want to export Muse output files. (keep all the subfolder structure e.g. edge_includes In Muse, use Object->Insert HTML... me
-
Import External Bank Statement in SAP B1 Patch level 34
Hi all, How do we do External reconciliation in SAP B1 2005. How to Import External Bank statement in to SAP B1 2005. Regards Shashi
-
Problem with "Edit With" in CS4
what is the best place to call GetEditOriginalEditorList or GetEditorList to get a list of application that can open a placed file in the Links Panel. when I place a asset for my InDesign CS4 plugin and rightclick on the placed file I don't find the
-
SAINT Update on phase IMPORT ABAP Dictionary objects.
Hi All, While uploading package using SAINT i am facing some errors. I am at phase CHECK_REQUIREMENTS and RUN_SPDD just completed, and getting the below message button Repeat Skip Cust.Cockpit "Phase CHECK_REQUIREMENTS: Explanation of Errors Open Da