SQL Keywords

SQL INPUT

What does the SQL INPUT keyword do?

INPUT marks a stored procedure or function parameter as read-only (incoming only) in certain SQL dialects and utilities.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL INPUT: Supported: Sybase ASE, SAP IQ, Informix, Teradata, Oracle SQL*Plus (as command). Not supported: PostgreSQL, MySQL, SQL Server T-SQL, SQLite, standard ANSI SQL.

SQL INPUT Full Explanation

INPUT is not part of the ISO/IEC SQL standard, but several commercial databases (notably Sybase Adaptive Server Enterprise, SAP IQ, Informix, and Teradata) accept the keyword when you declare parameters inside CREATE PROCEDURE or CREATE FUNCTION statements. When a parameter is declared with INPUT, the called routine can read the value passed by the caller but cannot assign a new value back to the caller. In practice, INPUT behaves the same as the more common IN keyword that appears in MySQL, Oracle, and the ANSI specification, but it exists for historical compatibility in the listed platforms.Some tooling environments also overload INPUT for other purposes. For example, Oracle SQL*Plus uses an INPUT command that lets you add lines to the SQL buffer interactively, and the SQL Server bcp utility uses INPUT to indicate the direction of data movement. Those are command-line features, not DML statements, and are outside strict SQL execution context.Because INPUT is non-standard, code that relies on it is portable only across systems that explicitly document support for the keyword. If you need vendor-agnostic scripts, prefer IN instead.

SQL INPUT Syntax

-- Stored procedure parameter declaration (Sybase ASE, Informix, Teradata)
CREATE PROCEDURE procedure_name (
    param_name data_type INPUT,
    another_param data_type INPUT
)
BEGIN
    -- procedure body
END;

SQL INPUT Parameters

  • param_name (identifier) - Name of the parameter declared as input only.
  • data_type (data type) - Any valid SQL data type supported by the dialect.
  • INPUT (keyword) - Specifies the parameter is inbound only.

Example Queries Using SQL INPUT

-- Sybase ASE example
CREATE PROCEDURE raise_salary
    (@emp_id INT INPUT,
     @pct     FLOAT INPUT)
AS
BEGIN
    UPDATE employees
    SET salary = salary * (1 + @pct)
    WHERE id = @emp_id;
END;
GO

-- Calling the procedure
EXEC raise_salary 42, 0.10;

Expected Output Using SQL INPUT

  • Procedure is created successfully
  • When EXEC is run, the employee with id 42 receives a 10 percent salary increase and the UPDATE statement returns the number of affected rows

Use Cases with SQL INPUT

  • Clarifying parameter direction in legacy Sybase or Informix code bases.
  • Maintaining backward compatibility for applications originally written for those platforms.
  • Enforcing read-only parameters in Teradata stored procedures.
  • Writing automated code generators that must emit dialect-specific parameter modifiers.

Common Mistakes with SQL INPUT

  • Assuming INPUT works in PostgreSQL, MySQL, SQLite, or standard SQL (it raises a syntax error).
  • Confusing INPUT with OUTPUT/OUT and expecting the caller to receive modified values.
  • Forgetting that IN is the standard equivalent and more portable.
  • Mixing SQL*Plus INPUT command with the keyword used in DDL statements.

Related Topics

IN, OUT, INOUT, OUTPUT, CREATE PROCEDURE, PARAMETERS

First Introduced In

Sybase ASE 12.0 (circa 1998)

Frequently Asked Questions

Is INPUT the same as IN?

Both mark a parameter as read-only, but only IN is defined by the SQL standard. INPUT exists mainly in Sybase, Informix, Teradata, and similar platforms.

Can I return values with an INPUT parameter?

No. INPUT parameters are read-only. To pass data back to the caller you must declare a separate OUT, INOUT, or OUTPUT parameter (depending on the dialect).

Will INPUT work in PostgreSQL or MySQL?

No. Those databases follow the standard IN/OUT/INOUT syntax. Using INPUT produces a syntax error.

How do I replace INPUT for cross-platform code?

Change the declaration from INPUT to IN, ensure the routine does not attempt to modify the parameter, and test the procedure in each target database.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!