real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language PL/SQL

Score: (3.00 in 14 votes)
PL/SQL is a programming language that resides in an Oracle database. 
As  PL/SQL has no standard input or output this version is written 
to be run from the SQLPlus command line using an anonymous PL/SQL block.

/* Start of code */
set serveroutput on

        counter         NUMBER;

        FOR counter IN REVERSE 1..99 LOOP
                dbms_output.put_line(counter || ' bottles of beer on the wall,');
                dbms_output.put_line(counter || ' bottles of beer.');
                dbms_output.put_line('Take one down, pass it around,');
                IF (counter != 1) THEN
                        dbms_output.put_line(counter - 1 || ' bottles of beer on the wall.');
                        dbms_output.put_line('No more beers.');
                END IF;
        END LOOP;
/* End of code (The "/" in the line above is very important) */

Download Source | Write Comment

Alternative Versions

Another take on Oracle's DB languageTysher11/13/090


>>  Dimus said on 12/19/05 23:41:32

Dimus Bad style. Contains all the code at the client side, so one must supply the same code with every installation of the program. This should be a DB trigger AFTER LOGON reporting the text as an exception, or something like this, although I am not shure that the full text fits into the standard buffer. If it doesn't, it should be splitted. The number of logon attempts for each user should be stored in a DB table using PRAGMA AUTONOMOUS_TRANSACTION, so that each time a user attempts to logon, he receives the corresponding line of text in an error message. Will try to write the code ...

>>  steve birtles said on 02/24/07 02:04:53

steve birtles you are an idiot , who does not know what he is talking about

>>  david said on 03/15/07 10:57:32

david The first line of the program (assuming that its run from SQL*Plus, as claimed), should read "SET SERVEROUTPUT ON;". Otherwise nothing will be printed.

>>  david said on 03/15/07 10:58:41

david (just realized...) Sorry, too early and not enough coffee...

>>  Paul said on 06/14/07 23:41:19

Paul I think you should select the lyrics from the Dual table - that would be much better.

>>  A. Jesse Jiryu Davis said on 05/13/10 04:50:01

A. Jesse Jiryu Davis PL/SQL is a dead language, and rightfully so: It was an abomination in the eyes of the Lord. Criticizing bad style in PL/SQL is like petitioning the operator of a gas chamber to make it environmentally friendly.

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!




Security Code: