In C#, if you set up a method parameter using the params
keyword, that parameter will take in an indefinite number of arguments. When calling the method, you can then send a comma-separated list of arguments for that parameter.
Does PL/SQL have an equivalent feature for method parameters?
Thanks!
Andrew L
No. The params
keyword is syntactic sugar that is converted to an array by the compiler. Oracle apparently is less 'sweet'. The closest you can get is create a procedure that accepts a variable-size array ( Varray
).
You can use a temporary table, I suppose this is the most common option because it probably works in most RDBMS.
In SQL Server 2008 though, you can even pass a table parameter, like:
CREATE TYPE my_table_type AS TABLE(a int NOT NULL,
b int NOT NULL)
CREATE PROCEDURE [dbo].[test]
(
@model my_table_type readonly
)
AS
BEGIN
END
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.