Retrieve sqlplus output in a windows variable

How can I put a script output variable in a Windows batch file variable? I am looking for the Windows equivalent of something like this in Unix:
MY_VAR=`sqlplus -s un/pw @myscript`
where myscript.sql is
variable myvar varchar2(20);
begin
  <<some code>>
end;
print myvar
exit

You could spool the output to some other file, then use this file somehow.
Also what I do occasionally is using some unix commands under windows. E.g. Search the web for "cygwin".

Similar Messages

  • How to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?

    Is there a way to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?
     Thx

    No. I don't think there will be such API to do so. Hooks may help do something related stuff.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms644959(v=vs.85).aspx

  • Hello, How do I tell sql+ to spool output file from windows to Unix server?

    Hello, How do I tell sql+ to spool output file from windows to Unix server?
    I am new to SQL+ and just learned how to spool the file. But file is saved in my local windows enviroment and since it's 2GB in size...I want to spool it directly to another remote unix server.
    Pls answer in detail... I have been to most of the thread and didn't see relevant answer to above question.
    Am I suppose to develope some script which FTP the spool file directly to the server I want to
    or
    i Have to use UTL_FILE Package ?
    Thanks for reply

    You may not be able to...
    SQL*Plus can only spool to the local machine. If you have mapped a directory on the Unix server from your Windows machine, you can specify that directory in your SPOOL command.
    You could telnet to the Unix server, run SQL*Plus there, and spool the file to a local (Unix) directory.
    If the Unix server is also the Oracle database server, you could use the UTL_FILE package rather than using SQL*Plus to spool a file.
    If the Unix server is also an FTP server, you could also FTP the file from your local machine to the server.
    Of course, I would tend to re-examine a requirement to regularly generate a 2 GB text file. It seems likely that there is a better way...
    Justin

  • How to format sqlplus output

    In previous OTN Forum format we used {code} to format sqlplus output , how to do in this version ?

    Click on "Use Advanced Editor".
    Highlight your code.
    Click on the symbol >>
    Select Syntax Highlighting
    Select SQL...output looks like below:
    select sysdate from dual;

  • Query value window variable in a grid

    Hi experts !
    I am a novice in SAP B1 2005B and am with the following problem:
    I need to return all the values of a column in one grid, using changeable of screen since the procedure not yet was concluded and  not yet I am recorded in the table. In the case, the window variable is $ [$38,160], however the formatted consultation that I mounted is only returning the first line from grid. I am using the following instruction sql:
    Select distinct convert (to varchar (254), T0.text) from OPDT T0 where T0.textcode = $ [$38.160]
    In I wait it of an aid, since already I am thankful.
    Ps.: They forgive my English…

    Hello Sudha!
    First it would like to thank its attention my problem.
    Well, let's go… in Sales-A/R - > A/R Invoice...
    Here in Brazil, in some nourishing products(i.e milk), us we have the reduction or tax exemption, however in the forma bill of sale I need to specify in which tax law this exemption or reduction is protege, then as they will be being inserted these itens in the forma bill of sale, I I need that the messages are inserted in the field of comments/remarks… these messages are in predefined texts and the code of the text of these messages is equal to the code of the tax of the product, remembering that they will be in maximum three messages for forma bill of sale…For example, in the predefined text I have : (OPDT table)
    TextCode  -
       Text
    PIBI23      -
        Redução de ICMS conforme artigo 389/00 de....etc,etc
    ISS-3       -
         Isenção de IPI conf. artigo 4389, inciso XI de 01/08/00
    SudesteC -
        Redução de 33%,conf. inciso III do art. 987, paragrafo 2
    Summarizing, I need to make one select of all $[$38,160] the referring lines (TaxCode) and to return all the messages where OPDT.TextCode = $ … the problem is that it is only returning the first line or the selected line and not from all the lines as I need…and this has that to be before saving the forma bill of sale…
    Thanks regards...

  • In trace file and output file showing bind variable instead of value

    Hi,
    database 9i
    optimizer = choose(for cost based)
    In my trace file and output file showing bind variable instead of value.
    in my trace file 20 queries.
    I alse set this parameter in session level.
    alter session set events '10046 trace name context forever, level 4';
    but still showing traceoutput file bind variable.
    Pls help its very urgent

    Can you post the query for which the bind variable values are not being shown and the trace output for the same?
    Probably it is listed down somewhere when you actually executed the query among the others. Try completely analyzing your trace file..

  • Setting up the windows variable

    Hello i need the first step, how do i set up my windows variable so i can conline my java programs? thanks

    Before running the J2EE SDK, you must set these environment variables:
    * J2EE_HOME - the directory where you installed this release.
    * JAVA_HOME - the directory where the Java 2 SDK Standard Edition is installed.
    * PATH - include the bin directory beneath the directory where you've installed this release.
    If you don't know how to set environment variables:
    right mouse click on my pc - properties - tab advanced - button environment variables.
    This should do it.

  • Is it possible to read windows variables ?

    Hi,
    I create a webdynpro view - there is a UIElement where
    i want to insert the Username from the windows variables automatically ?!
    Thanks in Advance.
    Regards
    Anilkumar

    Hi Anil,
    You can use the UME api's to read the user id. There is a weblog also on this. You can use the code below to read the user id.
    <i>IWDClientUser user = null;
    try
              user = WDClientUser.getCurrentUser();
    catch(Exception ex)
      /* Exception Handling */
    IUserAccount[] accounts = user.getSAPUser().getUserAccounts();                     
    if ( accounts!= null && accounts.length >= 1)
         String username = (String) accounts[0].getLogonUid();                             
    }</i>
    Hope this is helpful.
    Regards
    Sidharth

  • Open report output in new window

    Hi,
    I know this topic has discussed many times earlier. But I cannot achieve that still.
    My requirement is to open PDF output of concurrent program in new window.
    I have a print button in page, in my extended controller I executing the concurrent and getting the URL of the output once it finishes.
    Then I'm forwing to the URL. It is working fine. But I want to open that PDF output in new window.
    I tried by setting Target Frame property value as '_blank' but if I change like that it is not even opening.
    I'm using IE8.
    Please give any solution.
    Thanks,
    SAN

    Hi,
    Still I cannot achieve this..
    Any suggestions please..
    Thanks,
    SAN

  • Is it possible to ready windows variables ?

    Hello,
    I create a BSP Page - there is a filed where
    i want to insert the Username from the windows variables automatically ?!
    maybe someone can help me ?
    thank you!
    set
    USERNAME=NTUSER

    Hi Thomas,
    I think you need to use client side coding.
    Googling I found this: http://www.forum4designers.com/archive22-2004-3-64751.html
    There Martin Honnen suggests this code:
    var wshell = new ActiveXObject('WScript.Shell');
    var env = wshell.Environment('System');
    alert(env('Java_HOME'))
    He warns about security issues related to use of ActiveX.
    After obtained your environment variable value, you need to post it to your BSP page.
    Bye.
    Dany
    P.S.: alternatively you could use, server side, <i>nbtstat</i> MSWindows command, which lets you to know who is logged on a remote machine (type 20 UNIQUE), but:
    1. both server and client need NetBIOS over TCP/IP active  (you can't control client settings - you <b>don't want</b> to let NetBIOS active on your server);
    2. more than one user can be logged on a client;
    3. you need to reach client directly (no proxy).

  • FORMATTING SQLPLUS OUTPUT

    I am running a shell script
    shell script
    #!/bin/sh
    sqlplus /nolog <<EOF>/ora01/file1
    CONNECT aaa/bbb@abc
    select table_name from user_tables;
    exit
    EOF
    output
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 13 17:01:53 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> Connected.
    SQL> SQL> SQL> SQL> SQL>
    COUNTRIES
    REGIONS
    JOBS
    JOB_HISTORY
    EMPLOYEES
    DEPARTMENTS
    LOCATIONS
    SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    desired result
    COUNTRIES
    REGIONS
    JOBS
    JOB_HISTORY
    EMPLOYEES
    DEPARTMENTS
    LOCATIONS
    how can i format my sqlplus output so that my desired result is as above.
    Thanks!

    Yes, this seem to work, however, only if connect is done not from within sqlplus but from the shell prompt.
    ~ >cat s.sh
    #!/bin/sh
    sqlplus -s scott/tiger <<EOF
    set term off feed off head off pages 0
    select table_name from user_tables;
    exit
    EOF
    ~ >./s.sh
    DEPT
    EMP
    BONUS
    SALGRADE
    SCHEME_CBFOWF1
    DR$SCHEME_CBFOWF1_IDX$I
    DR$SCHEME_CBFOWF1_IDX$R
    PROVATAB1
    DR$PROVAINDEX1$I
    DR$PROVAINDEX1$R
    CREATE$JAVA$LOB$TABLE
    X
    SYS_IOT_OVER_57950
    SYS_IOT_OVER_57953
    JAVA$OPTIONS
    PROVA1
    DR$PROVAINDEX1$N
    DR$PROVAINDEX1$K
    DR$SCHEME_CBFOWF1_IDX$N
    DR$SCHEME_CBFOWF1_IDX$KBest regards
    Maxim

  • Oracle 10gR2 SQLPLUS Does Not Pickup SQLPATH Variable on Windows

    Hi guru,
    I installed Oracle 10gR2 Client (10.2.0.1) on one Windows Server 2003 and run a batch file in MS DOS command line to setup all envirionments including SQLPATH. After I connected to a database sever (another windows server 2003, installed Oracle DB 10gR2 -10.2.0.4) thru command line, and tried to run a SQL script that is in the directory defined in the path of SQLPATH, but the file is never found and get this error.
    SP2-0310: unable to open file "gupuser.sql".
    Any idea?
    BTW, I don't have this isuue on Oracle 9.2.0.6 on Windows server 2003.
    Thanks,
    lixidon

    Haha, this is a bug. Below is from Oracle support:
    ===============================
    the issue you are having is described in the following BUG.
    Bug 4766094 - SQL_PATH IS NOT WORKING CORRECTLY
    There is a limit of 256 characters for SQLPATH environment variable and that is the reason when you add more than 256 characters to
    SQLPATH it will ignore the value. Unfortuenatly there is no workaround
    available for this bug.

  • Weird sqlplus output error

    I have a user here experiencing some bizarre behavior w/ sqlplus.
    If she logs into database ABDC as user X and executes any script that utilizes dbms_output, she gets the following printed out repeatedly:
    SQL> set serveroutput on
    SQL> spool gradeload
    SQL> exec dummy_package.dummy;
    before v-user
    before v-user
    before v-user
    before v-user
    before v-user
    before v-user
    etc....
    If I log into the same database, as the same user, from my own computer, or toad, or a terminal window, then I do NOT experience the same behavior.
    Seems to me like some sort of variable stored to her sqlplus exe, but I don't really know how that works. Anybody know what's causing this and/or how I can get rid of it?

    Dear Abdujaparov!
    SQL*Plus writes it's output through stdout. Even ORA-XXXX errormessages are written through stdout. The stderr channel is only used if SQL*Plus is suffering an error and terminates abnormaly so you won't get ORA-XXX errormessages into your error file with 2>>.
    I think that's not the answer you wanted to hear but I hope that it could be of any help to you.
    Yours sincerely
    Florian W.

  • Misaligned SQLPlus output

    Hi,
    Yes, I know this should go in the SQLPlus (tumbleweed) forum, but somebody there asked exactly the same question over a month ago and it still hasn't received even one attempted reply!
    So, simple question; why is the following output misaligned? Specifically, the value 14 for SAMPLE_SIZE is placed in the middle of its column, and consequently LAST_ANALYZED (21-feb-13) is shoved into the SAMPLE_SIZE column:
      1  select column_name, data_type, avg_col_len, density, num_distinct NDV, histogram, num_buckets buckets, sample_
    size, last_analyzed,data_type
      2  from dba_tab_cols
      3  where owner  = 'SCOTT'
      4  and table_name = 'EMP'
      5  and column_name = 'EMPNO'
      6* order by internal_column_id
    SYS@ORCL> /
    COLUMN_NAME               DATA_TYPE  AVG_COL_LEN     DENSITY          NDV HISTOGRAM       BUCKETS SAMPLE_SIZE LAST_
    ANAL DATA_TYPE
    EMPNO                     NUMBER               4  .071428571           14 NONE                  1       14 21-FEB-1
    3 NUMBER
    SYS@ORCL>Btw, the **** above should read A N A L (without the spaces) as in LAST_ANALYZED but a rather enthusiastic filter seems to be at work.
    Second question - I was wondering if I had entered a COLUMN ... FORMAT command that had screwed things up..but as far as I can tell, there is no way to retrieve the list of column formats that SQLPlus is currently using - or is there?
    *****Edit - ignore the second question - I just found that you can simply type
    COLUMNto get a listing of all column formatting instructions currently in use. I checked to see if SAMPLE_SIZE has any formatting applied to it and it does not.
    Many thanks,
    Jason
    Edited by: Jason_942375 on Mar 25, 2013 9:53 PM
    Edited by: Jason_942375 on Mar 25, 2013 9:55 PM

    Jason_942375 wrote:
    Hi guys
    Sorry, forgot to "watch" the thread.
    Well, thanks for your advice, which all seems to boil down to setting linesize. I should have said, I had already looked at this and discounted it as responsible for the issue. I've been able to refine the problem with the following use case:
    SCOTT@ORCL> SHOW LINESIZE
    linesize 120
    SCOTT@ORCL> DROP TABLE T;
    Table dropped.
    SCOTT@ORCL> create table T (X number);
    Table created.
    SCOTT@ORCL> insert into t values (14);
    1 row created.
    SCOTT@ORCL> commit;
    Commit complete.
    SCOTT@ORCL> select * from t;
    X
    14
    SCOTT@ORCL> select lpad('Z',100,'Z') dummy , X from T;
    DUMMY                                                                                                      X
    ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ      14
    SCOTT@ORCL>What you can see is that the formatting of the column X changes. When just that column is selected, all is fine. When it is output next to other column output, it gets misaligned.
    I think it may have something to do with the Window width, which I currently have set to 115.
    If I set the linesize to a few less (not one less) than 115, it seems to wrap the next column okay. But more testing is needed (though it's not exactly the kind of thing you want to waste hours on...although it's bloody annoying!!).Probably a combination of your window width, AND the font. If it is a 'proportional' font, a space will not be as wide as a "Z" or a "W" ... a string of spaces will tend to pull everything following it to the left. Oracle and SQLPlus have no control over how your windows client renders things.

  • What is the difference between Constant Window, Variable Window,Main Window

    hello all
    what is the difference between 1) Constant Window
                                                2) Variable Window
                                                3) Main Window   in SAP SCRIPT

    Hi,
    Window Types
    When defining a form window, you must select a window type for the window.
    You can choose between three types:
    Constant Windows (CONST)
    Variable Windows (VAR)
    Main Windows (MAIN)
    Constant Windows (CONST)
    Starting with Release 4.0, the system internally processes windows of type CONST similar to windows of type VAR.
    Therefore, if you create a new window, always use type VAR.
    Variable Windows (VAR) 
    The contents of variable windows is processed again for each page, on which the window appears.
    The system outputs only as much text as fits into the window. Text exceeding the window size is truncated;
    the system does not trigger a page break. Unlike constant windows, the page windows declared as variable windows may have different sizes on different form pages.
    As far as the processing of the window contents is concerned, the system currently treats constant and variable windows alike.
    The only difference is that constant windows have the same size throughout the form.
    Main Windows (MAIN) 
    Each form must have one window of type MAIN. Such a window is called the main window of the form.
    For SAPscript forms, the main window has a central meaning:
    It controls the page break.
    It contains the text body that may cover several pages.
    It allows to fix text elements at the upper and lower margins of the allocated page window (for example, for column headings).
    As soon as a window of type MAIN is full, SAPscript automatically triggers a page break and continues to
    output the remaining text in the main window of the subsequent page. Page windows of type MAIN have the same width throughout the form.
    The SAPscript composer thus avoids reformatting of the text after each page break.
    If a page does not have a main window, the system implicitly processes all other windows of the page and continues with the subsequent page.
    This page must not call itself as subsequent page (recursive call), since this would produce an endless loop.
    In such a case, SAPscript terminates the output after three subsequent pages.
    For printing header lines or totals, the different output areas of the main window are of special importance.
    go through this links:
    In Scripts Variable window and constant wind difference?
    Main Window
    Re: Main Window in SAP Script
    What is the difference between Constant window and variable window?
    Regards
    Adil

Maybe you are looking for

  • New Hardware-Old OS Version

    I have an application that is supported only on 2.6. I have a new Sun220R, and due to a Purchasing Snafu, no OS Media Kit was sent with it. I have an older issue of 2.6 (5/98) that I can load up. Will this Code or build version work with this new har

  • Inventory Management differences between 3.5 and 7 versions doubt

    Hi We plan to upgrade BW system from version 3.5 to version 7 next year. And we plan to initiate Inventory Management in BW (Cube 0IC_C03). It is good idea to start Inventory Management before upgrade? OR the better idea is wait befor upgrade? THX fo

  • Error installing 11.5.9 on ENterprise linux 4.0

    Hi, I am trying to install 11.5.9 on ES Linux 4.0. I am getting the following error. Your help on this highly appreciated. Rgds Processing DriverFile = /Stage11i/startCD/Disk1/rapidwiz/template/adriapps.drv Running Instantiation Drivers for /Stage11i

  • Should EntityManaer be Closed in a Desktop Application Environment

    Hi All, I'm developing a desktop application with persistence api to connection to database. The application consists of two simple classes Order and Customer, where Customer is used as a field in Order. There is a ManyToOne relationship from Order t

  • HOW DO I GET WEB SITE TO FILL THE WINDOW?

    Various web sites I visit only fill the middle of the full open window. There is 3 or 4 inches of white space on the left and right side of the information within the open window. [it's happening here too]. I've used Safari and Foxfire with the same