Creating Stored Procedures in Oracle SQL Developer

Introduction

In this simple demo, I tried to answer the question: "How can we transform a given string into uppercase?" The goal was to ensure standardization and consistency in user input, especially when dealing with data that requires a uniform format for processing or display.

The aim was to create a stored procedure in Oracle SQL that accepts an input string, converts it to uppercase, and outputs the result. This task is common in data processing and helps maintain data integrity.

The Solution

To achieve this, I created a stored procedure in Oracle SQL Developer. The procedure takes an input string, converts it to uppercase using Oracle's built-in UPPER() function, and outputs the result using DBMS_OUTPUT.PUT_LINE.

SQL Code


CREATE OR REPLACE PROCEDURE P_TO_UPPER (P_STR VARCHAR2)
IS
    L_STR VARCHAR2(50);
BEGIN
    L_STR := UPPER(P_STR); -- Convert input string to uppercase
    DBMS_OUTPUT.PUT_LINE('Input string in Upper case: ' || L_STR); -- Display the result
END P_TO_UPPER;

        

Execution and Result

After creating the stored procedure, I executed it with an input string (e.g., 'hello world'). The result returned the desired uppercase version of the input string, i.e., 'HELLO WORLD'.

Query Execution Result

Query Execution Result 1