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: Sql and Pl/sql --- Usage

Re: Sql and Pl/sql --- Usage

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 22 Mar 2002 07:27:53 -0800
Message-ID: <a7fihp02gjs@drn.newsguy.com>


In article <709f185b.0203212228.72e238a4_at_posting.google.com>, botham_ian_at_hotmail.com says...
>
>Hello..
>As I was driving back from my work this evening.. I was thinking of
>something that has been on my mind for a long time.. I made a quick
>analysis/research of my code that I developed two years ago. Ok,, Here
>is what I found...
>
>I had this tendency to write pl/sql most often rather than sql even
>when the latter would really have mattered..(For instance...I
>preferred to write a pl/sql function when a decode would have been
>just perfect) But for some reason that can be attributed to the
>programing skills I imbibed back at my M.S program,, I felt that
>pl/sql would enable me create my own world. A pl/sql code would help
>me reuse the code, helps abstraction, to troubleshoot and maintains a
>definite approach in creating the logic....I only feel that SQL be a
>mailman getting the data to work upon..
>
>By resorting to pl/sql most of the time, am I delaying the
>query/processing performance any bit or taxing the database
>resources??if so .. how.. aren't we calling pl/sql functions(like
>decode, replace, translate, rtrim etc., ) in sql ???
>
>I did read thomas kyte one-on-one but thought I found some relevance
>to pl/sql and sql,which , however got derailed in narration...

In that book, in chapter 1, I write:

I have a pretty simple mantra when it comes to developing database software:

o You should do it in a single SQL statement if at all possible. o If you cannot do it in a single SQL Statement, then do it in PL/SQL. o If you cannot do it in PL/SQL, try a Java Stored Procedure. o If you cannot do it in Java, do it in a C external procedure. o If you cannot do it in a C external routine, you might want to seriously think about why it is you need to do it

sorry if I got derailed from that in the narration at some point but basically -- if SQL can do it, it'll most likely be faster then doing it procedurally.

>
>Thanks
>Ian.....

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Fri Mar 22 2002 - 09:27:53 CST

Original text of this message

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