On 13.11.2012, at 9:18, Hugh Williams <hwilli...@openlinksw.com> wrote:

> Hi Quentin,
> 
> The error is saying you are trying to concat and integer when a strings is 
> expected, thus the integer should be cast as varchar for it to work:
> 
> create procedure
> DB.q.testBug() returns varchar
> {
>     declare str varchar;
>     declare intIn int;
> 
>     intIn := cast (4 as varchar);
>     str := intIn;
>     
>     return concat('test:',str,'.');
> }
> 
> You could argue that concat could implicitly perform the cast I suppose, but 
> it is strictly enforcing the type it would seem ...
> 
> In what way is this a problem for you ?

You misunderstood

Quentin correctly wrote, that he defined "str" to be varchar and "intIn" to be 
int.
So he wonders why doesn't error happen on "str := intIn;" line, when he tries 
to assign int to varchar variable


> 
> Best Regards
> Hugh Williams
> Professional Services
> OpenLink Software, Inc.      //              http://www.openlinksw.com/
> Weblog   -- http://www.openlinksw.com/blogs/
> LinkedIn -- http://www.linkedin.com/company/openlink-software/
> Twitter  -- http://twitter.com/OpenLink
> Google+  -- http://plus.google.com/100570109519069333827/
> Facebook -- http://www.facebook.com/OpenLinkSoftware
> Universal Data Access, Integration, and Management Technology Providers
> 
> On 13 Nov 2012, at 01:53, Quentin wrote:
> 
>> Is this a bug?  It doesn't seem desirable behaviour.
>> 
>> =============================
>> create procedure
>> DB.q.testBug() returns varchar
>> {
>>     declare str varchar;
>>     declare intIn int;
>> 
>>     intIn := 4;
>>     str := intIn;
>>     
>>     return concat('test:',str,'.');
>> }
>> =============================
>> 
>> In isql:
>> =============================
>> select DB.q.testBug();
>> =============================
>> Query result:                                     
>> testBug
>> VARCHAR
>> SQLState: 22023
>> Message: SR007: Function concat needs a string or UNAME or NULL as argument 
>> 2, not an arg of type INTEGER (189)
>> =============================
>> 
>> I would (perhaps naively) expect that the error should be in the uncast 
>> assignment if we are being strictly typed or implicitly cast the variable to 
>> varchar on assignment if we want to be weakly typed.
>> 
>> -- 
>> Quentin | Clear Blue Water Pty Ltd
>> quent...@clearbluewater.com.au
>> ------------------------------------------------------------------------------
>> Monitor your physical, virtual and cloud infrastructure from a single
>> web console. Get in-depth insight into apps, servers, databases, vmware,
>> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
>> Pricing starts from $795 for 25 servers or applications!
>> http://p.sf.net/sfu/zoho_dev2dev_nov_______________________________________________
>> Virtuoso-users mailing list
>> Virtuoso-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov_______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to