1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Specifying length of variables in package specification?

Discussion in 'SQL PL/SQL' started by mukulverma2408, Sep 2, 2015.

  1. mukulverma2408

    mukulverma2408 Active Member

    Messages:
    38
    Likes Received:
    1
    Trophy Points:
    90
    Location:
    New delhi
    Hi,

    can we not specify the length of the variables in package specification?

    I am trying to create a package specification as below :
    Code (Text):

    CREATE OR REPLACE PACKAGE VIDEO_PKG IS
      FUNCTION NEW_RENTAL(TID NUMBER(10),MID NUMBER(10)) RETURN DATE;
      PROCEDURE RETURN_MOVIE(TID NUMBER(10),CID NUMBER(10), STATUS VARCHAR(20));
    END VIDEO_PKG;
     
    It is giving me compilation error.

    which is working fine with little modification
    Code (Text):

    CREATE OR REPLACE PACKAGE VIDEO_PKG IS
       FUNCTION NEW_RENTAL(TID NUMBER,MID NUMBER) RETURN DATE;
       PROCEDURE RETURN_MOVIE(TID NUMBER,CID NUMBER, STATUS VARCHAR);
    END VIDEO_PKG;
     
     
  2. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
  3. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    It is impossible to specify dimensionality of parameters.
    It is possible to check dimensionality of variables at a stage of execution

    for example :
    Code (SQL):
    DECLARE
      subtype sm_i  IS pls_integer range  1..3 ;
      PROCEDURE prc_test
          (
               a sm_i
          )
      AS
      BEGIN
          dbms_output.put_line(a);
      END;      
    BEGIN
        prc_test(1);
        prc_test(2);
        prc_test(3);
        prc_test(4);
    END;    
    /
     
    Last edited: Sep 2, 2015
    mukulverma2408 likes this.