1.

Why do we use RPAD function in PL/SQL?

Answer»

A subprogram in PL/SQl is a standalone subprogram at the schema level. The CREATE PROCEDURE or the CREATE FUNCTION statement is used in PL/SQL to create a standalone procedure.

  • If you want to execute a standalone procedure, then use the EXECUTE keyword.
  • If you want to delete a standalone procedure in PL/SQL, then you need to use the DROP PROCEDURE or DROP FUNCTION statement.

The FOLLOWING is the syntax to create a procedure:

CREATE [OR REPLACE] PROCEDURE name_of_procedure [(parameter_name [IN | OUT | IN OUT] TYPE [, ...])] {AS} BEGIN  < procedure_body > END name_of_procedure;

Here,

  • CREATE [OR REPLACE] means a new procedure is created or modifies the existing one.
  • name_of_procedure is the procedure name.
  • procedure_body is the EXECUTABLE part.

Here is an example of a procedure:

CREATE OR REPLACE PROCEDURE one AS BEGIN   dbms_output.put_line('Chalk and Duster!!'); END; /

The output displays the procedure created successfully:

  • Procedure created.
  • Now to execute the procedure created above, you need to use the EXECUTE keyword. The name of the above procedure is “one”.
  • To call it:
EXECUTE one;

The above call will give the following output:

Chalk and Duster!


Discussion

No Comment Found