How to declare "nullable" parameters in an Oracle database?

Asked

Viewed 468 times

2

I need my process to accept null values in some parameters of type Number. How do I do this in PL/SQL?

Currently:

PROCEDURE SP_EDITAR_QUADRO(
    P_IDQUADRO IN NUMBER,
    P_IDFUNC IN NUMBER,
    P_IDTRAB IN NUMBER
);
...

I need the parameter P_IDTRAB accepted null values.

1 answer

1

You can do it by the operator DEFAULT or :=

PROCEDURE ADD(aNUMBER, b NUMBER, c NUMBER DEFAULT 0)

If you use signature packages remember to replicate the process.

If you want to use it without explicit naming of parameters in calls, you should put your optional parameters at the end of the procedure signatures list.

Read More

  • 1

    I decided to leave P_IDTRAB IN NUMBER DEFAULT NULL

  • shoooooooowwww good boy. If you can score as

Browser other questions tagged

You are not signed in. Login or sign up in order to post.