ALTER SESSION in sql script produces strange results

Why "alter session set NLS_DATE_FORMAT" would interfere with the operation of a sql script?

First of all, the script without the ALTER SESSION:
SQL> !cat doit1.sql
--alter session set NLS_DATE_FORMAT = "DD-MON-YYYY"
set pagesize 99
set trimspool on
col BIRTH_MONTH for a11
break on BIRTH_MONTH skip 1
spo doit.txt
prompt My Membership
set feedback off heading off
select 'As of ' || sysdate from dual;
set heading on
--
select count(*) from dual;
--
spool off
And its execution:
SQL> @doit1
My Membership

As of 14-JAN-10

  COUNT(*)
----------
 1
Everything is well with the world. Now let's throw in the ALTER SESSION:
SQL> !cat doit2.sql
alter session set NLS_DATE_FORMAT = "DD-MON-YYYY"
set pagesize 99
set trimspool on
col BIRTH_MONTH for a11
break on BIRTH_MONTH skip 1
spo doit.txt
prompt My Membership
set feedback off heading off
select 'As of ' || sysdate from dual;
set heading on
--
select count(*) from dual;
--
spool off
And its performance
SQL> @doit2
set pagesize 99
*
ERROR at line 2:
ORA-00922: missing or invalid option



  COUNT(*)
----------
 1
not spooling currently
SQL> 
Don't like the SET commands (I played a bit with many, he does not like one any of them) and does not take account of the order of the opening COIL

First of all, I've noticed this with a 10.2.0.1 connected to a 10.2.0.4 (windows) client database (HP - UX). Confirmed on my laboratory portable VM, 10.2.0.4 under OEL5, client and db on the same virtual machine.

You are missing just the leak ';' at the end of the line to alter session. Add to that, it all works.

Tags: Database

Similar Questions

  • Several alter session and SQL * Net message from dblink in APEX

    Hello

    I have Apex 4.2.3 and I use Glassfish more listener of the Apex.

    Database is 11.2.0.4 under linux

    Looking for the session active database, I see that apex run several alter session with a lot of expectation as SQL * Net message from dblink the.

    Ex:

    ALTER session set NLS_TERRITORY = "AMERICA."

    call the query of disc elapsed to cpu count current lines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse 58 0.00 0.00 0 0 0 0

    Run 58 0.06 3.53 267 58 0 0

    Fetch        0      0.00       0.00          0          0          0           0

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Total 116 0.06 3.53 267 58 0 0

    Chess in the library during parsing cache: 0

    The analysis of the user id: 277 (recursive depth: 1).

    Elapsed time are waiting on the following events:

    Event waited on times max wait for the Total WHEREAS

    ----------------------------------------   Waited  ----------  ------------

    SQL * Net message to dblink 174 0.00 0.00

    SQL * Net message from dblink 174 3.47 0.03

    ********************************************************************************


    Why he is doing a lot to change session? Why the wait is SQL * Net message from dblink the?

    We have recently to load a new language, but I'm not sure that this is the main problem.



    I think that you have the link db in the workspace schema and data requested by the Apex of this link. For example, it may be

    report which uses db link. Check dba_db_links or user_db_links for the existing links. Check if this link used by Apex.

  • I want to write a PL/SQL script to kill a session.

    I wrote a script for which considers a SID as input requests, V$ SESSION and verifies that the SID that you are trying to kill is not a background process, not SYS or SYSTEM and is the same user that you are. Once it checks these things, it issues an alter system kill session.

    If I create the SYS account service is very good. But I don't want end users to be able to run this script on the SYS account.
    I have another schema with privileges DBA I would love to own the PL/SQL script.

    Here's the rub, because the function queries session$ v, apparently not I can compile like no other function than to the SYS.
    If anyone can confirm this?

    I know that in PL/SQL, I can't access an object through a ROLE, I have been granted a SELECT on the object if I want to refer to it.
    But, if I'm in the SYS schema, I can't grant SELECT on v$ session to any account, because it's a dynamic performance view.

    Does anyone have a suggestion?

    Thank you

    I can't grant SELECT on v$ session to any account, because it's a dynamic performance view.

    Use V_$ SESSION

  • ALTER session set current_schema

    Hello

    We have multiple instances of the database (for example, MR01DEP, MR02DEP,...).

    Each instance is composed of more than stores (called schemas): for example, for MR01DEP, we have STORE1, Bank 2, 3, to MR02DEP we STORE5, STORE6,... and so on.

    Now, using developer PL/SQL, SQL Developer or even SQL Plus, when I connect to these databases, I connect using the user SUP_TMP (who has the privileges necessary for the actions that I have to do), and I have something like this:

    Conn SUP_TMP / < password > @STORE1 (I can connect like this and not with @MR01DEP; However, even @MR01DEP is correct).

    Today, all the tables are on these patterns (STORE1, STORE2,..), and when I connect with the SUP_TMP user, each time, at each meeting, I have to write:

    ALTER session set current_schema = STORE1, or

    ALTER session set current_schema = Bank 1

    At the beginning of every script that I have to run, I want to write a little routine so that I don't need every time to this «alter session set current_schema» statement

    If I connect with SUP_TMP / < password > @STORE1.

    so I see in the instance of v$, as the instance_name is (correct) MR01DEP.

    But I need to somehow get that banks '1', which I use when I connect to it (although, normally, I connect to a database, such as MR01DEP, but I'm specifying STORE1 in the connection string).

    So, in other words, I need that at the beginning of each script, to determine the current connection string I'm specifying after '@', and which is the current_schema.

    If I log in as SUP_TMP / < password > @STORE5, then I'll have something like immediate execution "alter session set current_schema = STORE5'."

    SUP_TMP user should be the I connect each time, but the current pattern of each script in each session, must come from the connection string.

    Is this possible?

    Thank you!

    I know, I specify the store, and it will automatically connect to the correct database (this is the case).

    No - NOT sure that connect you to the right base.

    As said ground that alias 'keep' is on the client and can be mapped to ANY DATABASE at all.

    Also - what you specify with is the DATABASE - this isn't a pattern.

    You're talking about two different things.

    You set the current schema - you connect to a database. TWO DIFFERENT THINGS.

    It may not even be a schema with the same name as the database.

    Do not use the same name for the databases and schemas. Oracle is NOT sql server.

    You can create a trigger AFTER the opening of SESSION to define the schema for you, but you must be able to know which schema must be defined.

  • SQL script problem

    Hi all

    I have a sql script which is given below.

    Select "alter system kill session ' |" SID | «, » || SERIES # session $ v where MACHINE = "Skykollap27";

    Out: -.

    "ALTERSYSTEMKILLSESSION" | SID | «, » || SERIAL NO.

    -----------------------------------------------------------------------------------------------------------

    alter system kill session 57.25

    But it should be

    alter system kill session '57.25';

    How to do this. Help, please.

    Thanks in advance

    its solved...

    Thank you

  • PL/SQL Script finishes the job.

    I started today with PL - SQL
    So I use the book of Fred Feuerstein's Oracle PL/SQL Programming.

    As example of paintings serve a table book... you can create and populate with the date by a script of the home page of O'Reilly.
    But it don't work on my Oracle database get a mistake.

    Error on line 27
    ORA-01858: A non-digit character was found, while awaiting a numeric character
    ORA-06512: In line 34

    Script done on line 27.

    Below is the script to create and fill the database. The tool used is the Toad and the database used is Oracle 11 g Enterprise 2.

    What's wrong???

    --------------------------------------------------------------------------------------
    REM $Id: books.tab, v 1.1 2001/11/30 23:09:48 bill Exp $
    REM of the "learning Oracle PL/SQL" page 64

    Create table 'books' REM

    (Books) CREATE TABLE
    ISBN VARCHAR2 (13) NOT NULL PRIMARY KEY,
    title VARCHAR2 (200),
    Summary VARCHAR2 (2000).
    author VARCHAR2 (200),
    date_published DATE,
    page_count NUMBERS
    );




    REM Script to insert sample records to books

    REM Note: Must SET DEFINE OFF or SQL * Plus will intercept the ampersand
    Characters of REM (&) before they are sent to the server. SQL * more generally uses
    REM an ampersand to designate a variable that requires the user to provide a
    REM value interactively.

    SET DEFINE OFF

    DECLARE
    PROCEDURE insert_book_no_complaints (isbn_in IN VARCHAR2, title_in IN VARCHAR2,
    summary_in IN VARCHAR2, author_in IN VARCHAR2, date_published_in IN DATE,
    page_count_in in NUMBERS)
    IS
    BEGIN
    INSERT INTO books (isbn, title, author, abstract, date_published,)
    page_count)
    VALUES (isbn_in, title_in, summary_in, author_in, date_published_in,
    page_count_in);
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX
    THEN
    NULL;
    END;

    BEGIN

    insert_book_no_complaints ('' 0-596-00381-1)
    "Oracle PL/SQL Programming,"
    "Of reference for PL/SQL developers, including examples and best practices"
    || "recommendations."
    'Syndrome Feuerstein, Steven, with Bill Pribyl',
    25-sep-2002 ", / * best guess from August 22 02 * /"
    (NULL); / * do not yet know how many pages * /.

    insert_book_no_complaints ('0-596-00180-0 ",)
    "Oracle PL/SQL for learning."
    "Beginner" s guide to Oracle "s PL/SQL programming language",
    'Bill Pribyl with Steven Feuerstein',
    November 29, 2001 ",
    401);

    insert_book_no_complaints ('1-56592-578-5',
    "Oracle SQL * more: The Definitive Guide", ".
    "The complete treatment of Oracle" interactive database tool of is,
    "Gennick, Jonathan."
    March 1, 1999. "
    502);

    insert_book_no_complaints ('1-56592-457-6 ",)
    "Oracle PL/SQL Language Pocket Reference.
    "Quick guide to Oracle PL/SQL developers. Includes Oracle8i '
    || 'coverage.',
    "Feuerstein syndrome, Steven, Bill Pribyl, Chip Dawes,
    APRIL 1, 1999 ", 94);

    insert_book_no_complaints ('' 0-14071-483-9)
    "The tragedy of King Richard the third.
    "The popular historic Shakespeare play in which a modern publication.
    || "royal treacherous tries to steal the Crown but died without horses."
    || "in the battle."
    "Shakespeare, William,
    AUGUST 1, 2000 ",
    (158);

    insert_book_no_complaints ('' 0-14-071415-4)
    "The storm."
    "Duke and the girl on the enchanted island to meet old enemies in this."
    || "comic tale of mystery, love, magic, and (eventually) forgiveness."
    "Shakespeare, William,
    JANUARY 1, 1959.
    (120);

    insert_book_no_complaints ('' 0-672-31798-2)
    "Sams Teach Yourself PL/SQL in 21 days, second edition."
    "Tutorial for Oracle" language procedural s organized presentation.
    || "the features of language in three weeks learning annex.",
    'Gennick, Jonathan, with Tom Luers',
    DECEMBER 1, 1999 ",
    692);

    insert_book_no_complaints ('' 0-07-882438-9)
    "Oracle PL/SQL tips and Techniques."
    "Voluminous tome with tips, techniques and reference documents on.
    || "Oracle" PL/SQL s.',
    "Trezzo, Joseph C."
    JULY 1, 1999 ",
    942);

    insert_book_no_complaints ('' 0-13-794314-8)
    'Create smart with Oracle PL/SQL triggers and stored databases'
    || "Procedures - 2nd ed.",
    "Programmer" PL/SQL s guide, oriented to the reusable construction. "
    || "components for large Oracle applications.",
    "Owens, Kevin T."
    JUNE 1, 1999 '.
    544);

    insert_book_no_complaints ('1-56592-674-9',
    "Oracle PL/SQL Developer's Workbook',
    "" Beginner, intermediate and advanced exercises to test the "."
    || "drive s"knowledge"of Oracle PL/SQL programming language s."
    'Syndrome Feuerstein, Steven, with Andrew Odewahn',
    1 May 1999 '.
    588);


    END;


    COMMIT;

    ALL SET ON

    ;

    privrt, PRIVET ;)
    use in the script

    alter session set nls_language='AMERICAN';
    alter session set NLS_DATE_LANGUAGE='AMERICAN';
    

    and inserts

    to_date(,)
    
  • question about pl/sql script

    Hi all
    I need to manage other tables that will contain as follows:
    whenever the user query it will be an insert in this table called mng_rishui_session that contain
    track:
    NUM of user's session id,
    Date and time of execution of the request,
    type of query
    every 15 minutes, I need to delete the data of the user of some the various tables according to the type of the query.
    the tables that contain the data:
    mng_rishui_session / / DESC
    session_id_num NOT NULL VARCHAR2 (30)
    type_query not null number (2)
    date of time_query
    I want to write a pl/sql script like this:
     
    declare cursor c1 as 
    select session_id_num,type_query 
    from mng_rishui_session 
    where time_query (/*here i need to do the condition that 15 minutes has passed from the time query 
     i don't know how to do this */
    begin 
    for e in c1 loop 
    
    case e.type_query 
    when 1 
    delete query1_table where session_id_num :=e.session_id_num;
    when 3 
    delete query3_table where session_id_num :=e.session_id_num;
    end
    end loop;
    end;
    issues related to the:
    1. how to check if 15 minutes where the past
    2. it is good to do with loop for writing valid deletion in the loop
    or do I have to do it another way to write this.
    Thanks in advance
    Naama

    Hi, Naama,

    Naama wrote:
    ... now my script looks like this:
    mng_session. SQL

    
    declare cursor c1 as
    select session_id_num,type_query
    from mng_rishui_session
    where  (sysdate - t_query) * 24 * 60 >= 15;  
    
    begin
    for e in c1 loop
    case e.type_query
    when 1 then
    delete query1_table where session_id_num = e.session_id_num;
    when 3 then
    delete query3_table where session_id_num  =e.session_id_num;
    end case;
    end loop;
    end;
    

    first of all, I want to know where I'm going to do the validation, if I need to do.

    In the PL/SQL code (so we won't do it in case of error) but after the LOOP is finished.
    In other words, assuming you are using a LOOP. It will be much more effective if you just do a DELETE statement on each table. Think about it: If your mng_rishui_session has 1,000 rows where t_query (or time_query, if the column is always so called) is fortunate to have one of the type_queries you want at least 15 minutes, and 100 of these lines, then you must fetch the 1,000 rows (if not all of the table) , and separate 100 DELETE queries. It is more effective to extract 100 lines (assuming that there is an index composed of type_query and t_query) and to only 2 DELETE statements. See below.

    Second:
    I run this script through linux system, in order to head to sleep.
    My problem is that I am trying to append the output of script;
    but it won't let me

    People on this site will try to help you. Why not try to help them do it?
    Do not say "he won't let me": show all that you know the problem. What exactly have you tried? That's happened? If you got an error, display the full error message, including the line number. If you got the wrong results, describe what happened.

    My goal is:

    a script running the sql scripy called:
    CS-mng-session:

    #!bin/bash
    sqlplus user/passwd@dbname @mng_session /*mng_session is the script were i declare the cursor etc.*/
    in the command line i want to write :
    (sleep 600; sh cs-mng-session)& 
    

    the problem is that if I do not exit. He recorded in sql and the script does not return to the command line.
    How do I overcome this problem?

    Make an EXIT.

    Try something like this:

    DECLARE
         cutoff_date     DATE     := SYSDATE - (15 / (24 * 60));
    BEGIN
         DELETE     query1_table
         WHERE     session_id_num  IN (
                             SELECT  session_id_num
                             FROM     mng_rishui_session
                             WHERE     type_query     = 1
                             AND     t_query          <= cutoff_date
                           );
    
         DELETE     query3_table
         WHERE     session_id_num  IN (
                             SELECT  session_id_num
                             FROM     mng_rishui_session
                             WHERE     type_query     = 3
                             AND     t_query          <= cutoff_date
                           );
    
         COMMIT;          -- If desired
    END;
    /
    
    EXIT;
    

    Is there a reason why query1_table should be different from query3_table? Why can't you have just a query_table, with a column of type_query?

    What happens if there is an error? You won't want to know? You must add an EXCEPTION section to write the details about the error in a log table and someone send an email on this subject.

    Published by: Frank Kulash, August 31, 2010 09:07
    Added / issue;

  • either or in the sql script

    Hi all

    Oracle db 10g

    I have a sql script that is like
    CURSOR c IS
    select s.sid,s.serial#
              from gv$session s, gv$process p, gv$locked_object l
                where l.session_id = s.sid
                and floor(mod(last_call_et,3600)/60) > 3
                and l.object_id in (438239,332790,46237,362927)
                and s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD')
                and s.status='INACTIVE'
                and s.paddr = p.addr;
    
    c_row c%ROWTYPE;
    
    l_sql VARCHAR2(100);
    
    BEGIN
    
    OPEN c;
    
    LOOP
    FETCH c INTO c_row;
    EXIT WHEN c%NOTFOUND;
    l_sql := 'alter system kill session '''||c_row.sessionid||','||c_row.serialid||'''';
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    
    CLOSE c;
    END;
    /
    In the above script as I must include conditions
    s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD') and
    s.last_call_et/1800 > 1
    and
    s.action like 'FRM%'
    and
    s.status='INACTIVE'
    So that the cursor c gets all the inactiive and serial No. session id and put loop and kills the session... ? He must check the two conditions and if any condition returns the lines, he should kill?

    Thank you
    Baskar.l

    Loops of slider like the one you posted since out-of-date Oracle 8i over 12 years ago.

    Learn how to process rows tables not simple.
    http://www.morganslibrary.org/reference/array_processing.html

  • What SQL script to use to configure the default TestStand tables?

    Hello

    I'm setting up a small test application and want to record the results of the test to a SQL Server database. Page in preparation for the implementation of logging database mentions the scripts I use to set my database. In my case, I found 3 table creation scripts:

    • SQL Server create insert generic result Tables.sql
    • SQL Server create Recordset result generic Tables.sql
    • SQL Server Create Tables.sql stored Proc result

    What are the differences between them, and which one should I use?

    Thank you!

    In the options dialog of database--> go to the patterns tab and click on each of the options (generic recordset, insert generics, etc.). In the comments section, you will find the difference.

    You can use one of them but to ensure that any script that you ran the DB tables same option is selected in the DB options.

    I hope this helps.

  • How to run multiple parallel sql scripts?

    I try to execute multiple sql scripts parallel to the short run of the process via sqlplus. Are there opportunities to do? LINUX ORACLE 5. XX

    I do it too via Scheduler, but now I need to do this via sqlplus or shell + sqlplus?

    How do I start using shell script several xterminals and ech session begins all the sql scripts?

    nohup./SQL1.sh &

    nohup./sql2.sh &

    nohup./SQL3.sh &

    The '&' causes the script1.sh to run in the background so that the command prompt is returned immediately.  This means that sql2.sh can start immediately and at the same time as sql1.sh.  It doesn't have to wait for sql1.sh.   This assumes that there are no dependencies between scripts!  This meets your need to run scripts in parallel.

    The nohup untie your shell script.  So, even if you disconnect, the script continues to run.  Without the nohup, if you were to close your session before the end of the scripts running, they would get fired.

    Hemant K Collette

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • Running SQL scripts on different databases

    Hello!

    At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

    So my question may be separated into 2 sections:

    1 - is possible to let users SQL scripts run directly from the application?

    I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

    is 2 - possible to let users choose what database to run these scripts?

    Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

    Thank you!

    Fallen_Kaede wrote:

    Thanks for the quick response. I confirm that we are talking about databases on a server.

    The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

    It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

    1 - is possible to let users SQL scripts run directly from the application?

    Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

    The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

    is 2 - possible to let users choose what database to run these scripts?

    The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

  • ALTER session nls_date_format not retained

    Hello guys,.

    Here is the environment:

    Oracle 11.2.0.1 on Linux 64-bit RHEL DB

    Oracle 11 g 2 on Windows 2008 R2 32-bit client

    Our product works service (code generated in c ++) and the service opens 5 sessions of database and alter session set nls_date_format questions to HH24:MI:SS DD/MM/YYYY in each of them.

    But searching through the service logs, I see that select statements (to_char (date)) return date in format other than what has been defined via "alter session" i.e. they do not see the part and just JJ-LUN-AA. But the same select instructions out the date in the format of correct/expected (according to alter session statement).

    The problem is that we do an insert in a table taking the current system time and running to_date (< time system >). It is a failure with: ORA-01843: not one month valid. I understand that it must specify a format for the input string, the date system, but we do not and was not a problem for someone else.

    I'm also no disconnected sessions or reconnects.

    Customer Oracle NLS_LANG is: AMERICAN_AMERICA. UTF8.

    This problem occurs for one of our customers who use this product. All other clients do not encounter this problem, as this has been a long-standing code. I'm not saying that the code is perfect and looking at some of the SQLs, we rely on implicit conversion of data in Oracle instead of editing the SQL code, but this has never caused a problem to any other customer.

    I understand the hierarchy of setting NLS_DATE_FORMAT i.e. the database, register of operating system of the customer, the customer Oracle (alter session) and finally to_date/to_char functions.

    It seems that the session format game becomes overloaded as when they restart the service in our product everything is back to normal until a couple of days, when queries in the service connects begin to show the date incorrect without time portion and just JJ-LUN-AA.

    Any help would be appreciated as I had read a lot on the internet with no evidence outside this site including our customer:

    ttp://StackOverflow.com/questions/15396241/CX-Oracle-ora-01843-not-a-valid-month-with-Unicode-parameter h

    Thank you

    Bharath

    Bharath3 wrote:

    ...

    My question is, why the session loses the settings of NLS_DATE when it doesn't happen to anyone else? I think that the format is getting replaced in the sessions but how do I know that? How to find environmental changes to current public meetings?

    Maybe you have a connection pool if every session is used by different... hmm applications or threads. Even if you issue a command of nls alter at the start of the session, some processes could change this setting later. This is why it is best to not depend on any parameter of session happened when the connection was established.

    Best solution: just use the correct format inside the to_Char conversion. Or issue a command to alter session immediately before running the selection.

  • Inverse of command 'ALTER SESSION SET.

    Hello

    I have a READER user and when I connected with this user that I can set the current session settings such as

    alter SESSION set smtp_out_server = '123.345.134.123';
    
    

    or

    alter session force parallel query parallel N;
    
    

    If it would be sysdba or any other user with grant on parameter $ v we could use:

    select value from v$parameter where name = 'smtp_out_server'
    
    

    Is it possible that I can get the current session settings without going through subsidies on the parameter $ v?

    PS: it seems strange, that we have the setter (alter session set), but haven't Get accessor.

    Maybe the function dbms_utility.get_parameter_value, assuming that you have the privileges.

  • executing sql script in ApplicationModule before processing a request

    Hello

    I have an obligation to run a sql script, just after the application module is read to process the request and before it actually processes the request.
    Basically, I View object in the AM based on a guaranteed table, that script allows the user to access the data in the table.

    Is there a particular method in ApplicationModuleImpl that I can replace to add the execution of the script. Or is there another way to do it.

    Thank you
    Anil

    Just replace prepareSession, it is executed each time an appmodule is associated with a user session. If you have just run the code on a specific VO, simply substitute the method executeQuery or executeQueryForCollection (in the VOImpl).

Maybe you are looking for