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: my function to run in Sqlplus console

Re: my function to run in Sqlplus console

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 3 Oct 2003 00:14:22 -0700
Message-ID: <1a75df45.0310022314.1d676441@posting.google.com>


quikquic_at_yahoo.com (quikquic_at_yahoo.com) wrote .
> I am running oracle. Besides all those build-in "select, insert,
> delete...", can I define my own function which can be run inside
> SQL-plus console?
>
> Suppose I save an image as a blob in the database, my table is
>
> ImageID blob
> 100 **
> 101 **
>
> and I would like to have something like "Showimage blob from
> imagetable where imageid = 100", where "Showimage" will be a function
> written in C and packaged as a dll.
>
> How can I do it?

With difficulty. Why do it using the wrong tools and approach?

So you have an image block.
Q. What is the easiest method to display it? A. Web browser

So, you write a PL/SQL procedure using the OWA_UTIL package. It returns a Mime Type of image/jpeg (or gif, png, etc.) and the streams the lob.

Now all you have to do is use a web browser that connects to a web server running the PL/SQL cartridge to view the image blob.

And then a few more minutes of coding to make your PL/SQL procedure parameter driven so that you can tell it what image id you want to display.

SQL*Plus is not a client interface into Oracle. Don't treat it like it is. Sure, it can do the job. But then by the same token you also can kill a mosquito with a shotgun.

Question is though, why on earth would you want to do that when mossie rep does the job easier, faster and better?

Real expertise is not whether you have the nuts and skills to do this in SQL*Plus rolling your own DLLs and what not.

Real expertise is using the *right* tool for the job *correctly* and *effectively*.

--
Billy
Received on Fri Oct 03 2003 - 02:14:22 CDT

Original text of this message

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