Link to home
Start Free TrialLog in
Avatar of Mark_Co
Mark_CoFlag for United States of America

asked on

User defined records and how to declare in spec as well as body

If I have a record declared in the body of my package for the purposes of passing records instead of variables as parameters, must I also declare the record in the spec. I seem to be getting an error that makes me believe that I need to declare it in the spec as well as the body.

The error was PLS-00201. params_rec must be declared

my record in the body is this:
TYPE PARAMS_REC IS RECORD(
                             P_SCHEMA VARCHAR2(4000)
                            ,P_TABLENAME VARCHAR2(4000)
                            ,P_QUERY VARCHAR2(4000)
                            ,P_LOGGING_Y_N VARCHAR2(1)
                            ,P_COMPRESS_Y_N VARCHAR2(1)
                            ,P_TABLESPACE VARCHAR2(4000));

Open in new window


must it also go in the spec? Things don't need to be declared in the spec unless I want them public right?

This is from the SPEC and is the procedure I want to pass the record variables to:
PROCEDURE DROP_TABLES
              (
                            /*P_SCHEMA VARCHAR2
                           ,P_TABLENAME VARCHAR2*/
                          P_PARAMS_REC PARAMS_REC; --THIS ISN'T WORKING

              ); --DROPS PRE-EXISTING TABLES

Open in new window

SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark_Co

ASKER

"since the procedure and it's params_rec parameter are defined in the spec" did you mean body?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark_Co

ASKER

OH i think i see what you mean. So i remove it from the body altogether, and just declare it in the spec only?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark_Co

ASKER

...and if I chose to not declare the procedure at all in the spec, then I could leave the record defined in the body and I should be ok?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark_Co

ASKER

Great! I appreciate you helping me understand that