From: markg@mymail.tm (MarkyG)
Newsgroups: comp.databases.oracle.server
Subject: Re: The case preference of writing SQL, PL/SQL, SQL*PLUS comands/scripts
Date: 6 Jun 2001 03:53:39 -0700
Organization: http://groups.google.com/
Lines: 52
Message-ID: <ab87195e.0106060253.5c65fcab@posting.google.com>
References: <0dfhht44o0un1gea4ri1bglifq6i59dbb0@4ax.com>
NNTP-Posting-Host: 163.166.150.21
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 991824819 17437 127.0.0.1 (6 Jun 2001 10:53:39 GMT)
X-Complaints-To: groups-support@google.com
NNTP-Posting-Date: 6 Jun 2001 10:53:39 GMT


There is no real right or wrong way.
The 'De Fecto' standard seems to be example 1 which I see mostly in
books, Oracle website (and i use personally).
If you are looking at a company point of view, create a standard and
make sure everyone sticks to it.

I could go on forever but no time.  Personally, uppercase for Oracle
reserved words and keywords, lowercase for variables and other stuff
and initcap for Procedure/package calls.

My two pence worth ;-)

M

Dino Hsu <dino1@ms1.hinet.net> wrote in message news:<0dfhht44o0un1gea4ri1bglifq6i59dbb0@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

