Sören Auer wrote:
> For our DBpedia query builder I need the quitecast option, but I'm not
> getting it to work.
> Consider the following simplified example:
>
> create table qctest (value varchar);
> insert into qctest values('100');
> insert into qctest values('1000');
> insert into qctest values('abc');
>
> Now I'm trying:
>
> select * from qctest where cast(value as int)>500 option (quietcast);
>
> which unfortunately results in the following error:
>
> *** Error 22005: [Virtuoso Driver][Virtuoso Server]SR341: Invalid
> integer value converting 'abc'
> at line 9 of Top-Level:
> select * from qctest where cast(value as int)>500 option (quietcast)
>
> What am I doing wrong?
>
Sören,

Mitko already replied you with the reason so I won't be going there.

There are many ways to get behaviour you were expecting. Here's one:

create procedure qc_int(in x any)
{
  declare exit handler for sqlstate '*'
    {
      return null;
    };
  return (cast (x as integer));
}

create table qctest (value varchar);

insert into qctest values('100');
insert into qctest values('1000');
insert into qctest values('abc');

select * from qctest where qc_int(value)>500;

Note that Virtuoso lets you use stored procedures in columns and
predicates part of a SELECT.

Yrjänä

> Sören
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


-- 
Yrjana Rankka            | gh...@openlinksw.com
Developer, Virtuoso Team | http://www.openlinksw.com
                         | Making Technology Work For You




Reply via email to