select changedate from ingrmaster where changedate like changedate
this results in error:
SQL0132N A LIKE predicate or POSSTR scalar function is not valid because
the first operand is not a string expression or the second operand is not a
string. SQLSTATE=42824
State:42824,Native:-132,Origin:[IBM][CLI Driver][DB2/6000]
The changedate is a char column. This statement works in other database
like Oracle. If I change the above statement to this:
select changedate from ingrmaster where changedate like '20020115'
this works without returning an error.
Is there anyway I can make the first statement work with DB2?
--
Thanks in advance to anyone who responds.
Robert Drinovac
....like 'abcd12%'
....like '%cd12'
....like '%cd%'
the % symbol denotes any value that might precede or follow the stated
characters.
If you value (as in your example) is actually '20020115' and you said ....
like '20020115' (without a % ) then it would satisfy the condition. but if
you said like '200201' (without a %) you'd get nothing.
you can also use '_' (underscore) as a place holder, so '_bcd%' would return
any string containing 'bcd' in the third through fifth position.
Dave
"Robert Drinovac" <rdri...@invatron.com> wrote in message
news:lG218.88$EI....@tor-nn1.netcom.ca...
use = instead of LIKE ??
but seriously as the error message says the second operand must be a
(literal) string rather than a column or a variable, which can be a real
pain at times.
What SQL really needs is full regular expression capability. Anybody else
agree?
Regards
Paul Vernon
select changedate from ingrmaster where changedate like :changedate
"Robert Drinovac" <rdri...@invatron.com> wrote in message news:<lG218.88$EI....@tor-nn1.netcom.ca>...
> What SQL really needs is full regular expression capability. Anybody else
> agree?
Me! ;-)
Seriously, I missed regular expressions a few times. If you want to do
that, you can always write your own function today. So it's not that you
can't do it at all, it is just not that convenient.
--
Knut Stolze
DB2 Spatial Extender
IBM Silicon Valley Lab
Cheers
Serge
--
Serge Rielau
DB2 UDB SQL Compiler Development
IBM Software Lab, Canada
Are there any docs on the full usage of these functions? Some I can
guess:
--------------------------- Command entered ----------------------------
values SUBSTR(MS7.reverse('this is a string'),1,18)
------------------------------------------------------------------------
1
------------------
gnirts a si siht
--------------------------- Command entered ----------------------------
values MS7.islike(' 110% enough?','%110!% eno%','!')
------------------------------------------------------------------------
1
-----------
1
But others are more difficult,...
--------------------------- Command entered ----------------------------
values MS7.WAITFORFUNC('2', 'D')
------------------------------------------------------------------------
values MS7.WAITFORFUNC('2', 'D')
1
-----------
SQL4302N Java stored procedure or user-defined function
"MS7.WAITFORFUNC",
specific name "SQL020117152224698" aborted with an exception "Invalid
waitfor
options". SQLSTATE=38501
Why don't folks just use COMMENT ON ? (and that goes for the system tables
too ;-)
Regards
Paul Vernon
I have been harassing the respective manager for a while now to simply publish
the library.
Also I have been hoping that some participants in this newsgroup open-source
their handy funcs
(or sell them for good money to DB2 DD).
You have some explanation of the UDFs behavior in the MTK documentation under
the "Converter Reference: Sybase&MSSQLServer" page, "compatibility library
functions" and "conversion functions" pages.
We explain ( "very quickly" I must admit), what is the equivalent MTK UDF when
coming from Sybase or MS.
By using the MTK TSQL convertor (in MTK menu --> tools) you can actually see
how we translate the Sybase UDFs. This will help you understand what to
expect. Input the TSQL in the top text box, click convert, and you get the DB2
equivalent code using the MTK UDF in the bottom text box.
Try with a valid Sybase WAITFOR statement for instance.
You can also take a look at the MTKSyb.udf & MTKMS.udf file for more details
about the built-in functions.There is some comments in there.
For the future, we will try to share them somewhere on the web.But the initial
goal was not to share them stanalone, but to be part of the MTK conversion
process. To be shared standalone, we need to do more work on the files and
docs, something we cannot do right now.
But we are thinking of it. Be patient.
Regards
Patrick
Regards
Patrick
Regards
Patrick
Regards
Patrick
Regards
Patrick
Regards
Patrick