Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> how to validate incoming pl/sql arguments for type/size?

how to validate incoming pl/sql arguments for type/size?

From: Bomb Diggy <techguy_chicago_at_yahoo.com>
Date: 7 Jul 2003 11:35:51 -0700
Message-ID: <94599bb3.0307071035.7f7ed94e@posting.google.com>


My procedures have been generating 'ORA-01401: inserted value too large for column' errors when I try to insert runtime parameters into tables. I would like to catch this before an insert attempt is made, but I'm not sure of the best way to proceed.

For example, if I was accepting an incoming parameter of type CHAR(8) and I wanted to verify that it was not a string of length <= 8, what would be the best way to do that, syntax-wise?

My ideal, I suppose, would be:

IF (F_PARAMETER_DOES_NOT_FIT_INTO_TYPE( p_my_parameter, table.col%TYPE ) ) THEN
  RAISE a custom exception;
END IF Can a column '%TYPE' be passed as an argument to a function?

Here is my proc declaration:

PROCEDURE MYPROC( P_MY_NUMBER IN [TABLE_NAME].[COLUMN_NAME]%TYPE ); Thanks. Received on Mon Jul 07 2003 - 13:35:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US