Function for considering characters such ( , ,") in CLOB columns
If I excute following SQL statement:
SELECT XMLELEMENT("Inhalt",inhalt) from temp where id=5;
The result is:
<Inhalt>
<Datenblock ID="5">
</Datenblock>
</Inhalt>
The datatype of column "inhalt" is CLOB. The content of ID 5 is:
<Datenblock ID="5">
</Datenblock>
My question is:
Does a function exists which considers the right character set and does not quote characters (<,>,")? I use UTF-8 as a Database Character Set. Can anybody help me?
Try again
SQL> set define off
SQL> set long 10000
SQL> --
SQL> drop table temp
2 /
Table dropped.
SQL> create table temp
2 (
3 id number,
4 inhalt clob
5 )
6 /
Table created.
SQL> insert into temp values ( 5,
2 '<Datenblock ID="5">
3 <SomeXMLTag>Handel & amp; Grettle</SomeXMLTag>
4 </Datenblock>')
5 /
1 row created.
SQL> insert into temp values ( 6,
2 '<Datenblock ID="6">
3 <SomeXMLTag>Handel & amp; Grettle</SomeXMLTag>
4 </Datenblock>
5 <Datenblock ID="6">
6 <SomeXMLTag>Tom & amp; Jerry</SomeXMLTag>
7 </Datenblock>')
8 /
1 row created.
SQL> SELECT XMLELEMENT("Inhalt",inhalt)
2 from temp where id=5
3 /
XMLELEMENT("INHALT",INHALT)
<Inhalt>& lt;Datenblock ID="5"& gt;
& lt;SomeXMLTag& gt;Handel & amp;amp; Grettle& lt;/SomeXMLTag& gt;
& lt;/Datenblock& gt;</Inhalt>
SQL> SELECT XMLELEMENT("Inhalt",xmlparse(CONTENT INHALT WELLFORMED) )
2 from temp where id=5
3 /
XMLELEMENT("INHALT",XMLPARSE(CONTENTINHALTWELLFORMED))
<Inhalt><Datenblock ID="5">
<SomeXMLTag>Handel & amp; Grettle</SomeXMLTag>
</Datenblock></Inhalt>
SQL> SELECT XMLELEMENT("Inhalt",inhalt)
2 from temp where id=6
3 /
XMLELEMENT("INHALT",INHALT)
<Inhalt>& lt;Datenblock ID="6"& gt;
& lt;SomeXMLTag& gt;Handel & amp;amp; Grettle& lt;/SomeXMLTag& gt;
& lt;/Datenblock& gt;
& lt;Datenblock ID="6"& gt;
& lt;SomeXMLTag& gt;Tom & amp;amp; Jerry& lt;/SomeXMLTag& gt;
& lt;/Datenblock& gt;</Inhalt>
SQL> SELECT XMLELEMENT("Inhalt",xmlparse(CONTENT INHALT WELLFORMED) )
2 from temp where id=6
3 /
XMLELEMENT("INHALT",XMLPARSE(CONTENTINHALTWELLFORMED))
<Inhalt><Datenblock ID="6">
<SomeXMLTag>Handel & amp; Grettle</SomeXMLTag>
</Datenblock>
<Datenblock ID="6">
<SomeXMLTag>Tom & amp; Jerry</SomeXMLTag>
</Datenblock></Inhalt>
SQL>
Similar Messages
-
ORA-01461 when trying to insert text 4000 characters into a CLOB column
I work on a Windows application that connects to databases using ODBC. I'm currently working on adding Oracle support to the application, but I'm running into a lot of problems inserting strings of more than 4000 characters into CLOB columns. First, I tried to do that directly using code similar to the following (setup, cleanup, and error checking snipped for clarity).
SQLHDBC hDbc;
SQLHSTMT hStmt;
unsigned char query[200];
SQLAllocStmt(hDbc, &hStmt);
strcpy(query,"INSERT INTO test_table (col_clob, col_int) ('long string', 1)");
SQLExecDirect(hStmt,query,strlen(query));
Of course, "long string" was really a string of more than 4000 characters. When I did that, I got an error indicating that I needed to use bind parameters for strings that long. However, bind parameters don't seem to work either. I changed my code to something like the following:
SQLHDBC hDbc;
SQLHSTMT hStmt;
unsigned char query[200];
+unsigned char *str=NULL;+
int str_size;
SQLAllocStmt(hDbc, &hStmt);
strcpy(query,"INSERT INTO test_table (col_clob, col_int) (:strvar, 1)");
SQLPrepare(hStmt,query,SQL_NTS);
str = (unsigned char*)malloc(6000 * sizeof(unsigned char));
SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARBINARY, 0, 0, str, sizeof(str), &str_size);
strcpy(str,'long_string');
str_size = SQL_NTS;
SQLExecute(hStmt);
This code works fine when 'long_string' is less than 4000 characters. When it's greater than that, I get the following error:
+[Oracle][ODBC][Ora]ORA-01461: can bind a LONG value only for insert into a LONG column+
I'm using Visual Studio.NET 2003 on Windows XP, and Oracle client 11.1.0.6.0. My server version is as follows:
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
I thought I read somewhere that this is a known bug with Oracle 10.2.0.1.0, but I can't seem to find the reference now. Can anyone confirm this or provide some assistance with this problem? Frankly, it seems kind of ridiculous that I can't do something as simple as inserting a reasonably sized amount of text into a CLOB column. I'm considering using BFILEs instead, but that would be kind of a pain to fit into our application, so I'd prefer not to do this if at all possible.
Thanks in advance for any help.I found this link referring to a similar problem that was apparently fixed in version 10.2.0.4 of the server: ORA-01461: can bind a LONG value only for insert into a LONG column Should I try to upgrade the server and see if that fixes things?
-
Urgent !!! csv to File function for international characters
Hi ,
We are using fileToBinary() function provided by the samples of Weblogic Integration
Server to read one csv file.
It works absolutely fine when all characters in the csv file are english.
But when we have some japanese characters , they are going to be tempered and
replaced by '?'
Any solutions to this problem at the earliest would be really helpful to us.
Thanks and Regards
PavitraWell that was weird??
I just installed all the fonts here:
Japanese
otf-ipafont - Formal style Japanese Gothic (sans-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja. (AUR)
ttf-vlgothic - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux (AUR)
ttf-mplus - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace). (AUR)
ttf-ipa-mona, ttf-monapo - Japanese fonts to show 2channel Shift JIS art properly. (AUR)
ttf-sazanami - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environments.
which automatically configures the font cache however, when run mate-terminal with Japanese kanji style fonts; the terminal still shows a bunch of #### signs where the Kanji should be displayed?
Now I'm lost :-S -
Need help in using replace function with special characters
I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
The data looks like this:
CREEK'S LANE
ie for a street named CREEK'S LANE.
I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
When I try the query below I get prompted for substitution variable value.
I don't seem to be able to find the right syntax to make this query work.
SELECT REPLACE (street_name, ''', '''')
FROM
streets WHERE street_id = 1
Does anybody know how to do this?
Any help would be much appreciated.
Thanks.
Georgegeorge91 wrote:
I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
The data looks like this:
CREEK'S LANE
ie for a street named CREEK'S LANE.
I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
When I try the query below I get prompted for substitution variable value.
I don't seem to be able to find the right syntax to make this query work.
SELECT REPLACE (street_name, ''', '''')
FROM
streets WHERE street_id = 1
Does anybody know how to do this?
Any help would be much appreciated.
Thanks.
GeorgeHa! The codes you specified rendered in the HTML, but showed properly when I listed your original posting above. I didn't understand what you meant initially because the 5-character string represenation got rendered as the quote that you said you weren't able to get - a display problem.
You're getting prompted for the substituon variable because of the ampersand; you appear to be doing this in SQL*PLUS. The first thing I would try is to SET DEFINE OFF when using the ampersands to see if that works. If That doesn't work check the docs to delmit the ampersand (I think its a backslash before it but can't remember offhand). Another, harder option might be to use the TRANSLATE function replacing the literal character instead of using REPLACE (though replacing a quote will be a little tricky). If you're on 10g also consider using the advanced quoting
Good luck!
Edited by: riedelme on May 22, 2009 12:45 PM -
Req: New functionality for Skype
Will there be further development of new functionality for Android tablets, such as
1. Optional recording of video conversations to clouds storage
2. Administrating Group conversations for more than 5 usersHello We are not currently able to support Skype Number in Ukraine, but we continue to look into how we can increase the list of supported countries. We don't yet have any specific timelines on those. We'll keep our website updated as to any changes in that regard. Thanks for your question
-
Setting Line Terminator for a CLOB column by script
Hello Everyone,
I have a CLOB column in my table that receives external data (more than 400 sources).
The GUI application displays it in different ways because of the multiple incoming Line Terminators.
Here is the weird thing:
In SQL developper 3.1.06. In the Preferences->Environment I selected as Line Terminator: Carriage Return and Line Fe(Windows)
Once I committed the changes the data was properly displayed in the application (apparently was also re-coded).
My Question is:
How can I setup this property on the column or table to fix the issue??
(I'm looking for a DDL script or something alike).
Thanks in advance.
Mijail O. T.914451 wrote:
If that's the case, What is the SQL DEveloper doing then??
I tested and looks like is a global parameter, not sure if works only for the table. (That what I need).
If is possible to setup this feature from the GUI it should be a way to do it running a Script.
Right????No.
Tables don't have any concept of "lines".
CLOB's don't have any concept of "lines".
"lines" only exist in the context of the data you are providing, but that's not of concern to the database.
So it looks like, what SQL Developer is doing (I assume as I don't use it), is to have a setting such that when it comes to display character data from VARCHAR2's or CLOB's it determines if there are CR/LF or just LF characters (as per the setting) and then uses those as line terminators for displaying the data in it's own interface. Thus it sounds like an interface specific setting, or to put it bluntly, it's something that is a part of SQL Developer to control how it displays things.
Have you tried querying back the raw version of the data from the database to see that it still has the CR/LF characters in it? It should.
I think you'll find the setting is a "display" setting, not a "alter my data" setting. -
Hi Guys,
We have a CLOB column in our PNR database with the complete PNR details as below (all information has been changed ):
<PNR><PNR_Body>AXYDFB -ETKT-
REC LOC HDQ1P37EJNM/XAV/24639860/CHI/1P/T/US/USD/GS
HDQ RM 1P 01OCT0000Z
1.1TEST/ONE
1 VS3011N 14DEC SA LHREDI HK1 1950. 2120. 03C*
2 VS3002N 18DEC WE EDILHR HK1 0910. 1040. 03C*
FONE-
1.LHR*[email protected]/N000
2.LHR72582/H530
3.LHR8200144*I24639860 ORBITZ/A877
4.LHR3072582/H415
TKT-T/TBC/CCAX379461823464012/12/72601233655/0001/$
GEN FAX- *TKN/SSR FOR TKT NBRS
1.OSI YY BF0.00 TX141.10 TF141.10 PADT@FSR
2.SSRSEATVSKK1LHREDI3011N14DEC.03CN/RS
3.SSRSEATVSKK1EDILHR3002N18DEC.03CN/RS
4.SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 141013
5.SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
6.SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 141013
7.SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM
8.SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 141013
9.SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
10.SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 141013
11.SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM
12.SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 141013
13.SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
14.SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 141013
15.SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM</PNR_Body><PNR_History>REC LOC AXYDFB7EJNM/XAV/24631260/CHI/1P/T/US/USD/GS
HDQ RM 1P 01OCT0000Z
A3 SSRSEATVSNN1LHREDI3011N14DEC.03C/RS
RCVD-AXYDFB7EJNM/XAV/24612860/CHI/1P/T/US/USD/GS
HDQ RM 1P 01OCT0000Z
X3 SSRSEATVSNN1LHREDI3011N14DEC.03C/RS
A3 SSRSEATVSKK1LHREDI3011N14DEC.03CN/RS
RCVD-
HDQ RM 1P 01OCT0000Z
A3 SSRSEATVSNN1EDILHR3002N18DEC.03C/RS
RCVD-AXYDFB7EJNM/XAV/24612860/CHI/1P/T/US/USD/GS
HDQ RM 1P 01OCT0000Z
X3 SSRSEATVSNN1EDILHR3002N18DEC.03C/RS
A3 SSRSEATVSKK1EDILHR3002N18DEC.03CN/RS
RCVD-
HDQ RM 1P 01OCT0000Z
A3 SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
A3 SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM
RCVD-VSWEBSERVICE
CRC SU X1 01OCT0001Z D23B06 VS
A3 SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
A3 SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM
RCVD-VSWEBSERVICE
CRC SU X1 01OCT0001Z AXYDFB VS
A3 SSROTHSVSKK1LHREDI3011N14DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1LHREDI3011N14DEC.TKT PER FARE RULES TO AVOID ADM
A3 SSROTHSVSKK1EDILHR3002N18DEC.UNTKTD VS SEGS MAY CANX 142313
A3 SSROTHSVSKK1EDILHR3002N18DEC.TKT PER FARE RULES TO AVOID ADM
RCVD-VSWEBSERVICE
CRC SU X1 01OCT0001Z D12B06 VS
A3 SSRTKNEVSHK1LHREDI3011N14DEC-1TEST/ONE.4444123456C1
A3 SSRTKNEVSHK1EDILHR3002N18DEC-1TEST/ONE.4444123456C2
RCVD-AXYDFB7EJNM/XAV/24623860/CHI/1P/T/US/USD/GS
HDQ RM 1P 01OCT0042Z</PNR_History><Seating>SEATS ASSIGNED FLT 3011 14DEC HK1 1950. 2120. X CLASS
B7 * 1TEST/JA LHR TO EDI N 28Z*
NEXT FLIGHT AT EDI FLT 3002 18DEC HK1 0910. 1040. N CLASS
B2 * 1TEST/JA EDI TO LHR N 23D*</Seating><ETicket_Info>AXYDFB -ETKT- CPN FLIGHT DATE CLS FRM TO STATUS ISSUE
1. TEST/ONE 1. VS 3011 14DEC N LHREDI 1P
2. VS 3002 18DEC N EDILHR</ETicket_Info><ETicket_History>TEST/ONE 44443333222211110 $USD 141.10
FP CCAX44443333222211110/9306/142323
CHI 1P RS 01OCT0042Z 999999 VS
***END OF DISPLAY*** </ETicket_History><Fare_Quote>NO FQ DATA EXISTS</Fare_Quote><Fare_History>NO FQ DATA EXISTS</Fare_History><APIS>*NO APIS TO DISPLAY</APIS><Queue_History>SYSQ/IET/00
-Q SSRTKNE 01OCT0042Z </Queue_History></PNR>
Please can somebody suggest how I can browse through each row of the data identify credit card numbers (that we will be doing as per the business requirements from business) mask the numbers and put that back at the orignal location as it was.
Please can somebody explain me considering "44443333222211110" was a credit card number and requires to be masked.
Thanks,
ShazHere's a function you can use on 9i
CREATE OR REPLACE FUNCTION mask_cc_nums(i_clob CLOB)
RETURN CLOB IS
-- function to scan a clob and anywhere it finds a string of 16 consecutive numerics
-- replace then with 16 *'s
v_charpos PLS_INTEGER := 0;
v_outclob CLOB;
v_inlen PLS_INTEGER := dbms_lob.getlength(i_clob);
BEGIN
v_outclob := i_clob;
WHILE v_charpos+16 <= v_inlen LOOP
v_charpos := least(CASE WHEN dbms_lob.instr(v_outclob,'0',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'0',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'1',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'1',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'2',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'2',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'3',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'3',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'4',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'4',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'5',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'5',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'6',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'6',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'7',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'7',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'8',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'8',v_charpos+1)
ELSE v_inlen+1
END
,CASE WHEN dbms_lob.instr(v_outclob,'9',v_charpos+1) > 0
THEN dbms_lob.instr(v_outclob,'9',v_charpos+1)
ELSE v_inlen+1
END);
IF v_charpos <= v_inlen-16 AND
TRANSLATE(SUBSTR(v_outclob,v_charpos,16),' 0123456789',' ') IS NULL
THEN
v_outclob := SUBSTR(v_outclob,1,v_charpos-1)||'****************'||SUBSTR(v_outclob,v_charpos+16);
END IF;
END LOOP;
RETURN v_outclob;
END; -
Limitation for CLOB columns? - ORA-01704: string literal too long
Hello!
I'm trying to update a CLOB column with more than 35000 characteres, but I get "ORA-01704: string literal too long".
The code:
declare
l_clob clob;
begin
update test set test = empty_clob()
WHERE ID = 1
returning test into l_clob;
dbms_lob.write( l_clob, length('A...here 35000xA...A'), 1,'A...here 35000xA...A');
end;
Is there any limitation for CLOB columns?
Thanks for help.
Danieluser605489 wrote:
32768 characteres :)Actually it's 1 character less than 32K...
*32767*
SQL> declare
2 v_vc varchar2(32768);
3 begin
4 null;
5 end;
6 /
v_vc varchar2(32768);
ERROR at line 2:
ORA-06550: line 2, column 17:
PLS-00215: String length constraints must be in range (1 .. 32767)
SQL>I guess it comes from a legacy thing where signed words (2 bytes) are/were used to represent a value. As the most significant bit of the word is used to represent the sign of the number the range goes from -32768 to 32767. -
I have CLOB column and want to do a select with a replace kind of function- replacing certain characters. E.g. if body is a CLOB field, I need
select Clobreplace(body,'abcdef','123456') from t1;
Does anyone have a function or equivalent to do this?
ThanksThere isn't one readymade. However, it would be relatively simple to write one yourself. You would need to iterate around the input clob doing the following:[list]
[*]use DBMS_LOB.INSTR to locate occurances of the token;
[*]use DBMS_LOB.SUBSTR to segment your input CLOB using the offset from the INSTR call;
[*]write each segment appended with the replacement string to a temporary LOB;
[*]return the temporary LOB
[list]
I suggest you have a play around with the logic of this using SQL SUBSTR and INSTR on a varchar2 string. Once you understand what you're doing you can introduce the complication of operating on a CLOB.
Good luck, APC -
SQL LOADER: how to load CLOB column using stored function
Hi,
I am a newbie of sql loader. Everything seems to be fine until I hit a
road block - the CLOB column type. I want to load data into the clob
column using a stored function. I need to do some manipulation on the
data before it gets saved to that column. But I got this error when I
run the sql loader.
SQL*Loader-309: No SQL string allowed as part of "DATA" field
specification
DATA is my CLOB type column.
here is the content of the control file:
LOAD DATA
INFILE 'test.csv'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
REPLACE
INTO TABLE test_table
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
codeid BOUNDFILLER,
reason BOUNDFILLER,
Checkstamp "to_date(:CHECKSTAMP, 'mm/dd/yyyy')",
"DATA" "GetContent(:codeid, :reason)"
All references are suggesting to use a file to load data on
CLOB column but I want to use a function in which it generates
the content to be saved into the column.
Any help is greatly appreciated.
Thanks,
Baldwin
MISICompany*** Duplicate Post ... Please Ignore ***
-
Problem in Loading data for clob column using sql ldr
Hi,
I am having problem in loading data for tables having clob column.
Could anyone help me in correcting the below script for ctrl file inorder to load the data which is in mentioned format.
Any help really appreciated.
Table Script
Create table samp
no number,
col1 clob,
col2 clob
Ctrl File
options (skip =1)
load data
infile 'c:\1.csv'
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
Data File(1.csv)
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"
Error Encountered
ORA-01461: can bind a LONG value only for insert into a LONG column
Table sampThanks in advanceI can't reproduce it on my 10.2.0.4.0. CTL file:
load data
INFILE *
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
BEGINDATA
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
SQL> Create table samp
2 (
3 no number,
4 col1 clob,
5 col2 clob
6 );
Table created.
SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
SQL> select * from samp
2 /
NO
COL1
COL2
1
asdf
assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
2
sfjass
dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
NO
COL1
COL2
SQL> SY. -
This is reports 11g
I've got a clob column. Reports seems to recognize its type, but if I try to reference it in a format trigger, I get this error at compile time:
"No pl/sql translation for the blind type given for this bind variable"Actually, Reports is in something better than Forms.
Neither Forms nor Reports do not have "complete" SQL engine (both have only "complete" PL/SQL engine), but have their own SQL parser, which does not understand SQL commands after the database 8.0.
But, in Reports Data Model - SQL Query Statement, we can write "modern" SQL statement (> database 8.0), because Reports sent it directly to the database, without using their own SQL parser.
For example, in Reports Data Model - SQL Query Statement, we can write this (scalar subquery expressions, in bold):
select empno,
ename,
deptno,
(select dname from dept where deptno = emp.deptno) dname
from emp
order by empno;
although scalar subquery expressions was introduced in the database 9.0.1, and in databases 8.0 and 8.1 we should write someting like this:
select emp.empno,
emp.ename,
emp.deptno,
dept.dname
from emp,
dept
where dept.deptno = emp.deptno
order by empno;
Regards,
Zlatko -
SQL loader Field in data file exceeds maximum length for CLOB column
Hi all
I'm loading data from text file separated by TAB and i got the error below for some lines.
Event the column is CLOB data type is there a limitation of the size of a CLOB data type.
The error is:
Record 74: Rejected - Error on table _TEMP, column DEST.
Field in data file exceeds maximum length
I'm using SQL Loader and the database is oracle 11g r2 on linux Red hat 5
Here are the line causing the error fronm my data file and my table description for test:
create table TEMP
CODE VARCHAR2(100),
DESC VARCHAR2(500),
RATE FLOAT,
INCREASE VARCHAR2(20),
COUNTRY VARCHAR2(500),
DEST CLOB,
WEEK VARCHAR2(10),
IS_SAT VARCHAR2(50),
IS_SUN VARCHAR2(50)
CONTROL FILE:
LOAD DATA
INTO TABLE TEMP
APPEND
FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
CODE,
DESC,
RATE,
INCREASE,
COUNTRY),
DEST,
WEEK,
IS_SAT,
IS_SUN
Data file:
BHS Mobile Bahamas - Mobile 0.1430 1 "242357, 242359, 242375, 242376, 242395, 242421, 242422, 242423, 242424, 242425, 242426, 242427, 242428, 242429, 242431, 242432, 242433, 242434, 242435, 242436, 242437, 242438, 242439, 242441, 242442, 242443, 242445, 242446, 242447, 242448, 242449, 242451, 242452, 242453, 242454, 242455, 242456, 242457, 242458, 242462, 242463, 242464, 242465, 242466, 242467, 242468, 24247, 242524, 242525, 242533, 242535, 242544, 242551, 242552, 242553, 242554, 242556, 242557, 242558, 242559, 242565, 242577, 242636, 242646, 242727"
BOL Mobile ENTEL Bolivia - Mobile Entel 0.0865 Increase 591 "67, 68, 71, 72, 73, 740, 7410, 7411, 7412, 7413, 7414, 7415, 7420, 7421, 7422, 7423, 7424, 7425, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7440, 7441, 7442, 7443, 7444, 7445, 7450, 7451, 7452, 7453, 7454, 7455, 746, 7470, 7471, 7472, 7475, 7476, 7477, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7490, 7491, 7492, 7493, 7494, 7495, 7496" Thank you.Hi
Thank you for youe help, I found the solution and here what i do in my Control file i added
char(40000) OPTIONALLY ENCLOSED BY '"' .
LOAD DATA
INTO TABLE TEMP
APPEND
FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
CODE,
DESC,
RATE,
INCREASE,
COUNTRY,
DEST
char(40000) OPTIONALLY ENCLOSED BY '"',
WEEK,
IS_SAT,
IS_SUN
Thank you for your help. -
Function for column validation in SQl Loader control file.
Hello Gurus,
We have an requirement to create a function to validate all date and number columns in control file, and return 0/1 accordingly to valid_column which is last column . I have developed the function which accepts the number and date type columns as parameter and return Y/N. My question is, is there any way so that the function could be created without passing any parameter to it?
If yes, then how to call the function in control file?
I have been searching since a while on Google to find out any solution but could find out.
Using Oracle 11g Enterprise Edition Release 11.2.0.1.0
Thanks!
Edited by: Sush on Jul 5, 2012 2:23 AM
Edited by: Sush on Jul 5, 2012 4:16 AM
Edited by: Sush on Jul 5, 2012 7:28 AMHi Srini,
I have gone through this document and i couldn’t find out any solution. That’s why i was seeking help from you Gurus.
Thanks for your help, i think i have learnt few new things abt SQL Loader by studying this document :)
Thanks! -
Create hash value for clob column ?
Hi,
does anybody know a way to calculate a hash value for a clob column (9i) ?
DBMS_UTILITY.GET_HASH_VALUE could only handle varchar2(4000).
Thank you!
Regrads
Michael
Message was edited by:
mseiwertI can't reproduce it on my 10.2.0.4.0. CTL file:
load data
INFILE *
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
BEGINDATA
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
SQL> Create table samp
2 (
3 no number,
4 col1 clob,
5 col2 clob
6 );
Table created.
SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
SQL> select * from samp
2 /
NO
COL1
COL2
1
asdf
assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
2
sfjass
dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
NO
COL1
COL2
SQL> SY.
Maybe you are looking for
-
How do I run a thread without its panel.
I have created a vi in my application that I run as a thread. I run the thread by using an invoke node. When I am testing under LabView everything is fine but when I create the executable I have found problems. As I am starting the thread with an inv
-
Connecting to a database through Business View Manager
Hi, I am connecting to various application databases (Oracle) using the Business View Manager. When does the connection between my Business View Manager Data Connection and my application database gets "released"? If I have scheduled, say a report to
-
Can't burn cd on version 7.2 !!!!
I have tried burning playlists for my car, and it does not do anything. It asks for a blank disc and says checking media, then it just goes back to the playlist without actually doing anything. Downloading version 7.2 has however solved my backup pro
-
Smart objects generate huge ( 10 GB) temp files ??
Hi folks. I think there's a bug in CS3's smart object handling. Everytime I move (not resize!) a smart object, the temp file's size increases by some 100-200 MB. I easily get over 10 GB just by moving around a single object repeatedly. I find that qu
-
Bluetooth and Leopard Screen Sharing
Is it possible to use the Screen Sharing feature in Leopard between a MBP and a Mac Mini using Bluetooth? The area where we will be using the two computers will be in a remote environment with no internet or cellphone service to connect with. The oth