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: Tricky SQL even possible?

Re: Tricky SQL even possible?

From: Andreas Sheriff <spamcontrol_at_iion.com>
Date: Mon, 8 Aug 2005 16:32:23 -0700
Message-ID: <%YRJe.34428$bp.16439@fed1read03>


<michaeljc70_at_hotmail.com> wrote in message news:1123539535.036966.307850_at_z14g2000cwz.googlegroups.com...
> BTW, I need a select. I know I could create a procedure or function to
> do this.
>

Here's a hack for you:

Create a table and populate it with an arbitrary number of rows; say:

CREATE TABLE arb ( arbnum NUMBER);

DECLARE
v_count NUMBER;
BEGIN
for v_count in 1..500 loop
insert into arb (arbnum) values(v_count); end loop;
END;
/

and try a query like this:

VARIABLE mystr VARCHAR2(400)
exec :mystr := 'This is my string';

select arbnum from arb where arbnum <= ceil(length(:mystr) / 5);

And you get as a result:

    ARBNUM


         1
         2
         3
         4


May I ask for what function you'd need such a query?

-- 
Andreas
Oracle 9i Certified Professional
Oracle 10g Certified Professional
Oracle 9i Certified PL/SQL Developer


"If you don't eat your meat, you cannot have any pudding.
"How can you have any pudding if you don't eat your meat?!?!"
---

WARNING:
DO NOT REPLY TO THIS EMAIL
Reply to me only on this newsgroup 
Received on Mon Aug 08 2005 - 18:32:23 CDT

Original text of this message

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