← PL/SQL Topics

Packages & Modularity

Explain IN, OUT, and IN OUT parameter modes in PL/SQL

IN, OUT, IN OUT Parameters

Oracle Fusion / EBS · Technical · PL/SQL

GeneralHigh confidence

IN passes a value in read-only; OUT passes a value back out; IN OUT does both.

Grounded in: Curated Oracle knowledge layer — PL/SQL

How it works

IN — the default if no mode is specified — passes a value into the subprogram, read-only inside it. OUT is write-only from the caller's perspective: the parameter starts NULL inside the subprogram, and whatever it assigns is copied back to the caller's variable once the subprogram completes successfully. IN OUT does both — an initial value comes in, and a possibly modified value goes back out.

How it works
CREATE OR REPLACE PROCEDURE apply_bonus(
  p_salary     IN     NUMBER,
  p_bonus_pct  IN     NUMBER,
  p_new_salary    OUT NUMBER
) AS
BEGIN
  p_new_salary := p_salary * (1 + p_bonus_pct / 100);
END;
/

DECLARE
  v_result NUMBER;
BEGIN
  apply_bonus(5000, 10, v_result);
  DBMS_OUTPUT.PUT_LINE(v_result); -- 5500
END;
/

Related Questions

Have a follow-up, or a different question?

Continue in Ask Oracle AI