Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PL/SQL Procedure Char Parameter

This is quite possibly a very stupid question but I've tried searching for and answer and come up empty.

I'm writing a procedure that takes a single parameter of type CHAR. i.e:

  CREATE PROCEDURE Proc1 (Param1 CHAR(5))
  AS
  BEGIN
    ...
  END;

This doesn't work and throws an error around the CHAR(5) area. If I don't specify a size for the parameter, so just leave it as CHAR it works fine. I've tried including the keyword IN but this makes no difference.

Is there anyway of specifying a size for parameters in PL/SQL procedures?

like image 383
philb28 Avatar asked Oct 14 '25 07:10

philb28


1 Answers

Is there anyway of specifying a size for parameters in PL/SQL procedures?

No, as documented in the manual

Quote from http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/subprograms.htm#sthref1640

For each parameter, you specify:
- Its name.
- Its parameter mode (...)
- Its datatype. You specify only the type, not any length or precision constraints

(Emphasis mine)


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!