LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Oracle Alter Session in DB Execute

    Employee
    Posted 08-06-2014 03:39

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Patman

    I have the following script in my DB Execute

    sqlNonSelect("alter session set optimizer_mode = first_rows_10")
    sqlNonSelect("alter session set \"_hash_join_enabled\" = false")
    sqlNonSelect("alter session set \"_optimizer_sortmerge_join_enabled\" = false")
    sqlNonSelect("alter session set \"_optimizer_join_sel_sanity_check\" = true")
    sqlSelect(1,"{{^SQL^}}")



    My question is: Will all these 5 SQLs be executed under the same Oracle session? Thanks!


  • 2.  RE: Oracle Alter Session in DB Execute

    Employee
    Posted 08-08-2014 05:44

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    The answer may depend on which database version and type you are connecting to and which version of LAE you are using.

    Here is the code test I just used in LAE 5.0.0.1 that showed they did indeed execute in the same session in Oracle 10g Enterprise Edition Release 10.2.0.4.0
    sqlNonSelect("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY.MM.DD.HH24.MI.SS'")
    sqlSelect(1,"select to_char(sysdate) as z from dual")

    There may be another way to do the things that your "alter session" commands in your example above. In Oracle you can use Hints as part of your SQL Select statement. A quick Internet search about them brought up this page which might be a way to get started learning to use them. I have used Hints in SQL Statements before and they do work. http://www.dba-oracle.com/t_oracle_hints.htm