LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2004, 04:30 PM   #1
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
DB2 question


I'm hoping there is at least 1 DB2 expert here that can help me with a problem I am running into. I am in the process of changing some of our code so that we can run on a DB2 database as well as MS SQL Server. Most of my expertise is in the MS SQL Server domain, so it's been a bit of a learning experience switching over to DB2...

My problem is this: I converted our data model from our SQL Server to a DB2 server we have setup. After some fiddling around, I finally was able to get IBM's DB2 MTK to work... Our original database used a number of User defined data types, which got converted to User Defined Distinct DataTypes in DB2... All that is fine, so far...

Now, I am running into a problem where I get errors trying to execute any SQL statements that contain a LIKE clause on a column that uses one of those UserDefined Distinct DataTypes... For instance, one of those Types is an EchelonName, defined as a vargraphic (128). (In SQL Server it was an nvarchar(128))

If I execute the following SQL statement on our "Types" table where "Name" is a type of "EchelonName":

Code:
SELECT * 
FROM Types 
WHERE Name LIKE '%CISCO%'
I get the following error:

Quote:
ERROR [42884] [IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named \"LIKE\" of type \"FUNCTION\" having compatible arguments was found. SQLSTATE=42884\r\n
It appears to be a problem caused by the column being a user defined type, because I created a table with the following:

Code:
create table NESUSER.TEST 
(
    C1 VARCHAR(32),
    C2 VARGRAPHIC(32),
    C3 NESUSER.EchelonName   
)
Then tried the following queries:

Code:
-- Query 1, SUCCEEDS
SELECT * FROM NESUSER.TEST WHERE C1 LIKE '%ABC%';

-- Query 2, SUCCEEDS
SELECT * FROM NESUSER.TEST WHERE C2 LIKE '%ABC%';

-- Query 3, FAILS with same error as above
SELECT * FROM NESUSER.TEST WHERE C3 LIKE '%ABC%';
So... I'm hoping someone knows of some setting that allows me to get LIKE to work with user defined data types. The alternative is going back through my script to create the database and getting rid of the user defined data types altogether. A task I do not look forward to doing...
 
Old 09-14-2004, 09:42 AM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Original Poster
Rep: Reputation: 32
Update: = doesn't work either??

Doing some more testing I found that I can't even do something like so:

Code:
SELECT * 
FROM NESUSER.TEST
WHERE C3='a'
Where C3 is again an EchelonName of type vargraphic....

The more I think about this, the more I think I should just change my conversion script so that it doesn't use any User-defined datatypes in the DB2 database...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DB2 on Linux nabil Linux - General 11 11-22-2005 09:09 PM
DB2 installation ,,,,,please... apenguinlinux Debian 6 07-28-2005 04:51 AM
[help] db2 v8 on FC4 kevinpan Linux - Software 0 07-11-2005 01:24 AM
DB2 question Urgent juby Programming 3 09-25-2003 10:44 PM
DB2 nightmare mr_mandrill Slackware 1 05-12-2003 03:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration