question

OracleApprender avatar image
OracleApprender asked

Can we pass a parameter to a cursor ?

Can we pass parameters to a cursor as functions ? If yes then please give me an example. Thank you in advance.

oracleparameterscursors
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Christian13467 avatar image
Christian13467 answered

Yes, you can.
Define cursor as:

CURSOR c_cur(i_param number) IS
    SELECT a, b, c, d
    FROM table
    WHERE e = i_param;

Use cursor:

OPEN c_cur(12345);
FETCH ...

The rules are the same as parameters in functions and procedures.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.