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

    SQL Table References

    f55372a8-e53e-4312-b12b-a3fbdea96611

      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:

      BEGIN

      /* trauncate info in all existing tables */

             execute immediate 'truncate table Customers';

       

      /*insert data into table */

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

      END;

       

      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';