473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Seek equivalent of Oracle's empty_clob() for CLOB creation

In Oracle you can have a statement such as

insert into foo (foo_id,some_clob) values (100,empty_clob())

where empty_clob() inserts a clob address.
What is the approach in DB2 (8.1) to creating a row
having with a CLOB and no contents but with no null?

If someone has a user defined method that does about
the same thing that would be a help.

Thanks.

Nov 12 '05 #1
5 5310
Ian
gi*******************@yahoo.com wrote:
In Oracle you can have a statement such as

insert into foo (foo_id,some_clob) values (100,empty_clob())

where empty_clob() inserts a clob address.
What is the approach in DB2 (8.1) to creating a row
having with a CLOB and no contents but with no null?


See the CLOB() function.

Nov 12 '05 #2
Good idea ...

insert into foo (foo_id,some_clob) values (100,clob())

Returns :

No authorized routine name "CLOB" of type "FUNCTION" having compatible
argu

Having reviewed DB2 Documentation nothing came up on CLOB() or CLOB
FUNCTION.

Nov 12 '05 #3
Ian
gi*******************@yahoo.com wrote:
Good idea ...

insert into foo (foo_id,some_clob) values (100,clob())

Returns :

No authorized routine name "CLOB" of type "FUNCTION" having compatible
argu

Having reviewed DB2 Documentation nothing came up on CLOB() or CLOB
FUNCTION.


You obviously did not read the documentation. Since you seem to have
trouble, here's the reference for the CLOB() function:
-CLOB--(--character-string-expression--+------------+--)-----><

'-,--integer-'
The schema is SYSIBM.

The CLOB function returns a CLOB representation of a character string
type. In a Unicode database, if a supplied argument is a graphic string,
it is first converted to a character string before the function is executed.

character-string-expression
An expression that returns a value that is a character string.

integer
An integer value specifying the length attribute of the resulting
CLOB data type. The value must be between 0 and 2 147 483 647. If
integer is not specified, the length of the result is the same as the
length of the first argument.

The result of the function is a CLOB. If the argument can be null, the
result can be null; if the argument is null, the result is the null value.

This topic can be found in: SQL Reference, Volume 1.
Nov 12 '05 #4
gi*******************@yahoo.com wrote:
In Oracle you can have a statement such as

insert into foo (foo_id,some_clob) values (100,empty_clob())

where empty_clob() inserts a clob address.
What is the approach in DB2 (8.1) to creating a row
having with a CLOB and no contents but with no null?

If someone has a user defined method that does about
the same thing that would be a help.

Thanks.

Just use an empty string ('') DB2 will cast it it up as appropriate.
But if you want a function:

CREATE FUNCTION CLOB() RETURNS CLOB(10M)
NO EXTERNAL ACTION DETERMINISTIC CONTAINS SQL
RETURN ''

Note that in DB2 and empty string/LOB and NULL completely different.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #5
Thanks Serge and Ian. Without you guys it would be a lot harder to get
things done.

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: freak | last post by:
hi i have problems reading an oracle(9i) clob from a php-script with the MDB-class from pear. the table files has 3 fields: id integer document clob picture clob
0
by: Bryan Jackson | last post by:
Greetings, (I am an Oracle newbie -- been working with SQLServer for quite some time, however. I'm using Oracle9i and Oracle9i JDeveloper v9.0.3.1 (build 1107) for my programming environment)....
8
by: gimme_this_gimme_that | last post by:
Is there something equivalent to Oracle's SELECT DBMS_LOB.GETLENGTH(COLUMN_NAME) FROM FOO where COLUMN_NAME is a CLOB in table FOO returning an integer with a count of the number of...
3
by: premmehrotra | last post by:
I am using Access 2000 and Oracle 9.2.0.x on a Windows 2000. I have setup Oracle 9.2 ODBC Driver (I have not yet figured how to set Microsoft's Oracle ODBC driver). I am exporting a table from...
3
by: Gox | last post by:
Hi. This is my situation: Backend: Oracle 8i Frontend: MS Access 2k (ODBC driver support LOBs) Q: How insert (upload) a CLOB (pdf or doc file) to an Oracle using MS access (form)?? Q: How...
3
by: egarobar | last post by:
I am using Access 2003 (on WinXP) to read from an Oracle db, where there is a table with a CLOB which is a variable-size text field. In the 'linked table' which is created in the Tables panel of...
0
by: *Davide* | last post by:
Hello, This query (PHP+Oracle) works: global $user,$pass,$sid; $db_charset = 'UTF8'; $db = OCILogon($user, $pass, $sid, $db_charset); $clob = OCINewDescriptor($db, OCI_D_LOB); $txt_clob =...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
1
by: Server Applications | last post by:
Hello I am trying to build a system where I can full-text index documents with UTF8 or UTF16 data using Oracle Text. I am doing the filtering in a third-party component outside the database, so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.