Legal and illegal formal parameters which are constrained by length. : Procedure Parameters « Stored Procedure Function « Oracle PL / SQL






Legal and illegal formal parameters which are constrained by length.

    
SQL>
SQL>
SQL>
SQL> SET echo on
SQL>
SQL> CREATE OR REPLACE PROCEDURE ParameterLength (
  2    p_Parameter1 IN OUT VARCHAR2(10),
  3    p_Parameter2 IN OUT NUMBER(3,1)) AS
  4  BEGIN
  5    p_Parameter1 := 'abcdefghijklm';
  6    p_Parameter2 := 12.3;
  7  END ParameterLength;
  8  /

Warning: Procedure created with compilation errors.

SQL> SHOW ERRORS
Errors for PROCEDURE PARAMETERLENGTH:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/31     PLS-00103: Encountered the symbol "(" when expecting one of the
         following:
         := . ) , @ % default character
         The symbol ":=" was substituted for "(" to continue.

3/29     PLS-00103: Encountered the symbol "(" when expecting one of the
         following:
         := . ) , @ % default character
         The symbol ":=" was substituted for "(" to continue.

SQL>
SQL> DECLARE
  2    v_Variable1 VARCHAR2(40);
  3    v_Variable2 NUMBER(7,3);
  4  BEGIN
  5    ParameterLength(v_Variable1, v_Variable2);
  6  END;
  7  /
  ParameterLength(v_Variable1, v_Variable2);
  *
ERROR at line 5:
ORA-06550: line 5, column 3:
PLS-00905: object JAVA2S.PARAMETERLENGTH is invalid
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored


SQL>
SQL>

   
    
    
  








Related examples in the same category

1.Number type parameter
2.create and pass in three parms
3.Store procedure with three parameters
4.create default values
5.positional and named notation for procedure calls.
6.Passing parameter by parameter name
7.Procedure with four parameters
8.First 2 parameters passed by position, the second 2 are passed by name
9.Pass null to procedure
10.Wrong way to reference parameters
11.Procedure with colunm type as parameter type
12.NOCOPY modifier.
13.ParameterLength using %TYPE for the parameters(Calling ParameterLength illegally (ORA-6502))
14.Use SYS_REFCURSOR as parameter type
15.Different ways of calling a procedure with default parameters.
16.Default Parameter Values
17.Positional vs. named parameter passing.
18.Use column type to control parameter type
19.Use concatenation to wrap string passed in
20.User-defined collection type parameter