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: PL/SQL : Alternative way of doing if any

Re: PL/SQL : Alternative way of doing if any

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 19 Aug 2005 09:11:14 +0800
Message-ID: <430531B2.2BA4@yahoo.com>


baka wrote:
>
> Dear Sir/Madam & others
>
> i have one simple procedure to get some code if a string match exists.
> written procedure to achive this. but feel it is not an efficient one.
> can any one give altenative approch to this problem if any.
>
> Thanks in advance for looking into this problem.
> You are all great people.
>
> data for this procedure
> -------------------------------
> create table tmaster(
> tcode varchar2(8),
> tfolder varchar2(1048);
> /
> insert into tmaster(tcode,tfolder) values('T0000001','oracle');
> insert into tmaster(tcode,tfolder) values('T0000002','db2');
>
> SQL> exec gcode;
> pathand file=D:\Google\oracle\@searchresult of
> oracle\CDROM\__work\shiryou
> tcode=T0000001
>
> -------------------------------
>
> Procedure gcode
>
> ----------------------------------
> create or replace procedure gcode as
>
> spthatandfile varchar2(512):='D:\Google\oracle\@searchresult of
> oracle\CDROM\__work\shiryou';
> /*
> spthatandfile varchar2(512):='D:\Google\db2\@searchresult of
> db2\CDROM\__work\shiryou';
> the above data comes from the outer loop records
> */
> tcode char(8);
>
> CURSOR get_tcode_cur IS
> SELECT TCODE
> FROM TMASTER tm
> WHERE INSTR( spthatandfile,'\'||tm.TFOLDER||'\',1)!=0 ;
>
> begin
>
> OPEN get_tcode_cur;
> FETCH get_tcode_cur
> INTO tcode;
> IF (get_tcode_cur%NOTFOUND) THEN
> tcode := '99999999';
> END IF;
> CLOSE get_tcode_cur;
>
> DBMS_OUTPUT.PUT_LINE('pathand file='||spthatandfile);
> DBMS_OUTPUT.PUT_LINE('tcode='||tcode);
>
> end;
>
> ----------------------------------

Oracle Text

don't reinvent the wheel

sorry for brevity - ive got a broken hand

-- 
Connor McDonald
Co-author: "Mastering Oracle PL/SQL - Practical Solutions"
Co-author: "Oracle Insight - Tales of the OakTable"

web: http://www.oracledba.co.uk
web: http://www.oaktable.net
email: connor_mcdonald_at_yahoo.com


"Semper in excremento, sole profundum qui variat."

------------------------------------------------------------
Received on Thu Aug 18 2005 - 20:11:14 CDT

Original text of this message

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