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: The case preference of writing SQL, PL/SQL, SQL*PLUS comands/scripts

Re: The case preference of writing SQL, PL/SQL, SQL*PLUS comands/scripts

From: Frank Hubeny <fhubeny_at_ntsource.com>
Date: Mon, 04 Jun 2001 23:38:09 -0700
Message-ID: <3B1C7E51.A176ED5C@ntsource.com>

I agree with Giorgos Tsiamitas comments on formatting: there is no need to imitate the various sql and pl/sql styles shown in the Oracle examples one finds in manuals or training materials, unless one is forced to.

When I began learning pl/sql, I tried to follow Steven Feuerstein's (O'Reilly Press) rather pedantic standard of formatting. I can still remember working with an Asian programmer whose courteous look of confusion when I tried to explain why this should be upper cased and that should not suddenly made me realize that >>none of it<< need be upper cased. And today I personally prefer seeing sql, plsql and sql*plus commands all lower cased.

Frank Hubeny

Giorgos Tsiamitas wrote:

> "Dino Hsu" <dino1_at_ms1.hinet.net> wrote in message
> news:0dfhht44o0un1gea4ri1bglifq6i59dbb0_at_4ax.com...
> > Dear all,
> >
> > In Oracle PL/SQL training merterial, upper cases are used for key
> > words, while lower cases for variable names (ex.1); but in many books
> > about Oracle the reverse are used (ex.2).
> >
> > (ex.1)
> > CREATE OR REPLACE FUNCTION sf_age
> > (i_date IN DATE)
> > RETURN NUMBER
> > IS
> > v_year1 NUMBER;
> > v_year2 NUMBER;
> > BEGIN
> > v_year1 := TO_NUMBER(TO_CHAR(SYSDATE,'yyyy'));
> > v_year2 := TO_NUMBER(TO_CHAR(i_date,'yyyy'));
> > RETURN v_year1 - v_year2;
> > END;
> > /
> >
> > (ex.2)
> > create or replace function SF_AGE
> > (I_DATE in date)
> > return number
> > is
> > V_YEAR1 number;
> > V_YEAR2 number;
> > begin
> > V_YEAR1 := to_number(to_char(sysdate,'YYYY'));
> > V_YEAR2 := to_number(to_char(I_DATE,'YYYY'));
> > return V_YEAR1 - V_YEAR2;
> > end;
> > /
> >
> > Which one is the proper usage? Thanks for your comments.
> >
> > Dino
> >
>
> There is no such thing as "proper usage" as regards case sensitivity. The
> only proper usage is to decide yourself what should appear in
> uppercase/lowercase and stick to your decision. It's a matter of personal
> style and taste. The only exception is when you have to maintain code
> inherited by others: there you should stick with their taste to keep the
> coding style consistent (or modify it completely to your taste!).
>
> If you use an editor capable of color-formatting then case-sensitivity does
> not really add to the readability, so you can even ignore it.
>
> What makes statements more readable is spiltting the statement in many lines
> so that each clause appears in a new line and using proper identation.
>
> ---
> Giorgos
Received on Tue Jun 05 2001 - 01:38:09 CDT

Original text of this message

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