Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Substitute for SUBSTR
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 DBAReceived on Tue Jun 12 2007 - 06:44:40 CDT
![]() |
![]() |