1 Reply Latest reply on Apr 12, 2016 7:58 PM by Gianni Ceresa

    SQL Table References


      When creating a stored procedure within SQL, would I have to explicitly state which tables would be used if that procedure is shared?

      Here is an example:


      I wrote a procedure that would allow for easy modifying of data. The procedure is meant to truncate all of the relevant tables to my task, then adds the original data back in, always providing me a clean copy of the tables. - Yes I know this is not realistic in production.


      Here is a snippet:


      /* trauncate info in all existing tables */

             execute immediate 'truncate table Customers';


      /*insert data into table */

            insert into customers values(2111,'JCP Inc.',103,50000);



      Would I have to pass in as a parameter the username of the tables that are accessed if every user has teh same tables as me? - making the new truncate command:

      execute immediate 'truncate table userName.Customers';