variable in a SAMPLE clause in a stored procedure

Database
Enthusiast

variable in a SAMPLE clause in a stored procedure

Can one use a variable in a SAMPLE clause in a stored procedure?

If so, is there any special syntax?

I've declared my input variables as SMALLINT (& tried INTEGER).

My query is

INSERT INTO foo

SELECT foo

SAMPLE :sample_size_in;

I get an error message "...expected something like an integer or decimal or floating point number or a 'WHEN' keyword...."

TIA,
Nolan
1 REPLY
Enthusiast

Re: variable in a SAMPLE clause in a stored procedure

Hi

Can I get the exact CREATE PROCEDURE statement you entered.
Because stored procedures accept variables.
for example,

creat procedure input_variables(IN variable1 INTEGER)
begin
update table_1 set salary=100
where col_1 = :variable_1;
end;

call input_variables(12);