Midrange News for the IBM i Community


Posted by: Robert Gilsdorf
qpgmr
Wayne, Michigan
What Am i missing?
has no ratings.
Published: 03 Nov 2011
Revised: 23 Jan 2013 - 1703 days ago
Last viewed on: 22 Sep 2017 (3655 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

What Am i missing? Published by: Robert Gilsdorf on 03 Nov 2011 view comments(5)

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: abc4000
Premium member *
Comment on: What Am i missing?
Posted: 5 years 10 months 20 days 5 hours 23 minutes ago

Are you using SQLPKG ?

IF YES find User-profile-level Job-de!--script--ion *LIBL when you connect then add RSHPROBJ in *LIBL.

IF NO, I am not sure !

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: What Am i missing?
Posted: 5 years 10 months 19 days 23 hours 16 minutes ago
Edited: Thu, 03 Nov, 2011 at 20:08:19 (2150 days ago)

Maybe this...

http://www.midrangenews.com/view?id=1458

Parameter style GENERAL

Posted by: BrianR
Premium member *
Green Bay, WI
Comment on: What Am i missing?
Posted: 5 years 10 months 19 days 8 hours 9 minutes ago

SQL functions are located by the name and the parameter definition list.  When you use a character literal, the system casts that as a varchar field, so its looking for the function with parameters defined as varchar.  Try casting your character literals as type char:

SELECT DUMMY1 , ONTIM(char('01'), char('8640'), 20111101, 20111102, char('LT'), char('AL')) FROM dummy

You may also have to cast your numeric literals into another data type, I'm not sure what type the system defaults numeric literals to.

 

Posted by: Ringer
Premium member *
Comment on: What Am i missing?
Posted: 5 years 10 months 19 days 7 hours 27 minutes ago

SQL is complaining because it can't find that function "signature" (count and type of parms).

 

However, SQL will internally / automatically cast integers  and characters (your literals) to decimal and varchar but not the other way around when trying to find a matching function signature. So I usually try to define the parms as decimal and varchar.

 

Chris Ringer

Posted by: rgilsdor
Premium member *
Wayne, Michigan
Comment on: What Am i missing?
Posted: 5 years 10 months 9 days 7 hours 58 minutes ago

What I was missing was the varchar to char. Once I cast the constant to Char(2), it started working. Never showed up before because my other functions are called from within stored procedures which get parameters passed to them as char(2) and thus the parameters can be imported to the function as a char(2)