How to get Session ID in Teradata vs Oracle

Getting Session ID in Teradata is trivial:

SELECT SESSION

In Oracle, you would need to use sys_context (Oracle 10g and up)  or userenv function (legacy function) if you are not permitted to reference v$mystat or some other dynamic performance views:

SELECT SYS_CONTEXT('userenv','sid') sid
FROM dual;

SELECT USERENV('sid') sid
FROM dual;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s