Alter Session Oracle PL/SQL

Change Schema

ALTER SESSION  can be used with a database has multiple schema owners. Example: a single database instance contains both development and test environments.

You need to alter your session in order to be able to access the tables that are not in your default schema. For this example you will need to access the test table PS_VOUCHER which happens to be in the SYSADM and the SYSDEV schema. You are logged into the default SYSDEV schema but you need to use the other table. You can access this by appending SYSADM  to each of the tables but that seems like a lot of work. You can do the following to change the schema for all the tables.

Change NLS_DATE_FORMAT

Use this to set the date format in an SQR (or SQL Plus) to a format that will return all dates form the database to the SQR in the standard format instead of using the TO_DATE function in every SQL statement all over the SQR.

Using ALTER SESSION  can be helpful and make your code easier to read and maintain.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image

This site uses Akismet to reduce spam. Learn how your comment data is processed.