X

Jeff Taylor's Weblog

Hello World with Oracle PL/SQL

Hello World with Oracle PL/SQL. The most boring blog entry, ever.

  Obi-Wan: "These aren't the droids you're looking for."

  Agent Kay: "Nothing to see here. Move along folks."



set serveroutput on;

--------------------
-- Drop package body hw;
-- drop package hw;

CREATE OR REPLACE PACKAGE hw AS
   PROCEDURE hello_world;
END hw;
/
CREATE OR REPLACE PACKAGE BODY hw AS
  PROCEDURE hello_world
  IS
    hw_str VARCHAR2 (42) := 'Hello World!';
  BEGIN
    DBMS_OUTPUT.put_line (hw_str); 
  END hello_world;
END hw;
/

begin
  hw.hello_world;
end;
/

--------------------
-- Drop package body hw_2;
-- drop package hw_2;

CREATE OR REPLACE PACKAGE hw_2 AS
   PROCEDURE hello_world_2(
     num IN NUMBER);
END hw_2;
/
CREATE OR REPLACE PACKAGE BODY hw_2 AS
  PROCEDURE hello_world_2 (
    num IN NUMBER)
  IS
    hw_str VARCHAR2 (42) := 'Hello World!';
  BEGIN
    DBMS_OUTPUT.put_line (hw_str); 
    DBMS_OUTPUT.put_line (num+1); 
  END hello_world_2;
END hw_2;
/
begin
  hw_2.hello_world_2(3);
end;
/

--------------------
-- Drop package body hw_34;
-- drop package hw_34;

CREATE OR REPLACE PACKAGE hw_34 AS
   PROCEDURE hello_world_3;
   PROCEDURE hello_world_4(
     num IN NUMBER);
END hw_34;
/
CREATE OR REPLACE PACKAGE BODY hw_34 AS
  PROCEDURE hello_world_3 
  IS
    hw_str VARCHAR2 (42) := 'Hello World!';
  BEGIN
    DBMS_OUTPUT.put_line (hw_str); 
  END hello_world_3;

  PROCEDURE hello_world_4 (
    num IN NUMBER)
  IS
    hw_str VARCHAR2 (42) := 'Hello World!';
  BEGIN
    DBMS_OUTPUT.put_line (hw_str); 
    DBMS_OUTPUT.put_line (num+2); 
  END hello_world_4;
END hw_34;
/
begin
  hw_34.hello_world_3;
  hw_34.hello_world_4(3);
end;
/

Join the discussion

Comments ( 1 )
  • guest Sunday, April 19, 2015

    A code that would lead to more students. Thanks for the info


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.