Passing TableName to a Stored Procedure
I am trying to pass a table name to a stored procedure simple example code follows:
DELIMITER //
CREATE PROCEDURE myProcedure(IN tabName varchar(50))
BEGIN
SELECT tabName; -- Correctly outputs the expected value assigned to tabName
SELECT ClientID FROM tabName limit 100; -- Throws error
END //
DELIMITER ;
The first select statement displays the value of the variable as expected but the second select statement throws the error: Table 'mydatabase.tabName' doesn't exist
Subject
Views
Written By
Posted
Passing TableName to a Stored Procedure
531
June 09, 2022 04:13PM
308
June 10, 2022 10:09AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.