Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Substitute for SUBSTR

Re: Substitute for SUBSTR

From: sybrandb <sybrandb_at_gmail.com>
Date: Tue, 12 Jun 2007 04:44:40 -0700
Message-ID: <1181648680.892174.139810@d30g2000prg.googlegroups.com>


On Jun 12, 1:29 pm, Buck <BuckTheManTurgid..._at_gmail.com> wrote:
> I am working on a system (SAP) which uses Oracle, but its language
> disallows the use of any Oracle functions, we can just use generic
> SQL.
>
> I need to do the following SUBSTR in SQL, without using SQL, comparing
> '010' against '010001'. Is there a way to do this in generic SQL?
>
> create table t_1 (
> pos_nr varchar2(3)
> );
>
> create table t_2 (
> ref_posid varchar2(10)
> );
>
> insert into t_1 (pos_nr) values ('010');
> insert into t_2 (ref_posid) values ('010001');
>
> commit;
>
> -- this is what I need to do, but substr not allowed.
> select * from t_1
> where exists (select 'match'
> from t_2
> where t_1.pos_nr = substr(ref_posid,1,3));
>
> -- so, how can we use "LIKE" or "BETWEEN"?
> select * from t_1
> where exists (select 'match'
> from t_2
> where t_1.pos_nr like ref_posid);

If SAP uses a different SQL dialect than Oracle, why are you asking an Oracle related forum to resolve this?

--
Sybrand Bakker
Senior Oracle DBA
Received on Tue Jun 12 2007 - 06:44:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US