Command Line sqlplus without using @filename

How can I pass sql statement directly to sqlplus on command line without using an external file ?

If the insert happens infrequently, then the cost of writing
to a temporary file may not matter overall. And if the
insert happens frequently, the cost of invoking SQL*Plus and
connecting to the DB could outweigh the time for writing to
a file.
Do you have any problem doing something like:
tail -f mylog.txt | myawkprog | sqlplus -s scott/tiger
Here I'm thinking that 'myawkprog' prints appropriate INSERT
and COMMIT statements.
For what it is worth, I have an old, old Perl 4 script for a
similar log parsing task. It keeps the SQL*Plus connection
alive forever and makes sure there is no I/O buffering. The
outline of it is below. Use at own risk.
-- CJ
#! /usr/local/bin/perl -w
# Open I/O pipes
open(LG, "tail -f /tmp/mylog.txt|") || die "Can't open input";
open(SP, "| sqlplus -s scott/tiger") || die "Can't open sqlplus";
# unbuffered I/O
select(LG); $| = 1;
select(SP); $| = 1;
while(<LG>)
chop;
print SP "insert into mytab values ('$_');\n";
print SP "commit;\n";
# Never actually get here
close(LG);
close(SP);

Similar Messages

  • Create a Multiple-Line JButton Without Using HTML format

    I used html format for multiple-line JButton and it took a long time to load that button up (about 5 seconds more). Does anyone know how to create a multiple-line JButton without using html?
    Any suggestion or sample code will be appreciated.
    javamesser

    Hello,
    You could try using the following:
    -give your button some layout (e.g.: BoxLayout.Y_AXIS, or BorderLayout).
    -create the wrapped text in separate JLabels (one line in each label)
    -add your labels to the button
    Advantage:
    this solution does not affect the laf classes
    Disadvantage:
    focus rectangle is not calculated accurately
    Regards,
    G

  • What is happening about: The GNU Bourne Again Shell (Bash) is a command line utility widely used in many Unix-based operating systems including Linux and OS X.  Researchers have discovered a critical flaw in Bash which could allow remote code executi

    Authoritative advice today:
    The GNU Bourne Again Shell (Bash) is a command line utility widely used in many Unix-based operating systems including Linux and OS X.
    Researchers have discovered a critical flaw in Bash which could allow remote code execution by an unauthenticated user
    APPLE response?

    Also see:
    http://www.macrumors.com/2014/09/26/apple-os-x-users-safe-bash-flaw-update-soon/
    If you are not running a web server
    If you have not enabled CUPS web interface
    If you do not allow anonymous users to ssh into your Mac.
    If all are no, they you are not at risk.
    This IS a very serious bug for web servers, but the typical consumer Mac user is not at risk.

  • Is there any command line i can use to install a .pkg file to my own directory?)

    I'm a newer of Mac OS X, i need to insatll lots of .pkg package to my mac machine, so i think of install them use a script automatically, but i cnanot find any way to use the command line to insatll the .pkg package to my own forder(like /myapp). can somebody help me? thanks a lot.

    Here's a article on how to move your home dir:
    How to Move the Home Folder in OS X – and Why
    The key basic steps are to copy your home dir to another drive and using the Accounts Preferences advanced options for the your account to redefine where your home dir is.
    With or without the home dir moved you can organize your apps as you see fit.  I keep my apps categorized; doc/text related apps, video apps, calculators, etc.  They could even be on a third drive if you want, but that makes backups a bit more complicated (always backup).
    The advantage of keeping the home dir separate from the boot dir is (a) if the boot drive fails it doesn't take your stuff with it, (b) it allows you to have multiple boot drives and switch among them if necessary while using the same home dir, and (c) if you use a ssd for a boot drive it allows you to use a relatively small ssd (I use a 120GB).
    With a ssd as a boot drive you could still elect to put key apps on it for performance reasons.  I do that for commonly used stuff.  But it's mainly reserved for the boot system.  I try not to put any more that I have to on it just to minimize needless writing to the ssd.  Of course you cannot stop ssd writes by the OS itself (e.g., swap space -- but that too can be minimized with enough ram).

  • Edit command line parameters without restarting LabVIEW

    Is there a way to edit the command line parameters passed to a VI WITHOUT having to restart LabVIEW?  Perhaps I'm accustomed to how it works in just about every other development environment, but having to do so is quite frustrating.
    Solved!
    Go to Solution.

    ronbrown wrote:
    I'm just surprised that LabVIEW doesn't have just a simple "command line parameters" option somewhere in the VI options for debugging purposes, just like Visual Studio and other deveopment environments.
    If memory serves, Visual Studio runs the compiled program as a separate process. That should make it easier to give it separate switches. In LabVIEW, if you let the user change the parameters, you would have to do some conflict resolution, since this is a global setting (e.g. did the changes you make affect everything or a single VI/hierarchy/app instance, are the original switches lost or can you get them back somehow and when).
    If you want a workaround, I suggest you create a simple subVI with a 1D array output and a 1D array control on its FP or BD. If the control has something in it, use it. Otherwise, use the CLA[] property. Alternatively, you can check if you're running in the IDE or use a boolean, etc. Personally, the only time I think I needed to use switches, I believe the code was simple and I simply tested it by building the EXE. It probably took longer to figure out that I needed to explicitly turn on CLA support for the EXE than the actual testing.
    Try to take over the world!

  • Can Only Add Cert Template through Command Line (Can't use GUI)

    I am hoping somebody can figure this issue out.
    We have a Server 2008 Enterprise 32 Bit server running AD certificate Services.  Plan was to migrate the server to 2012 R2 (64 bit).  I went through the migration guide and everything was going great until I went to add a new template after the
    fact.  After duplicating a template and changing the settings, I went to Cert Templates on the CA and did a:  new --> Certificate Template to Issue.  Sadly, the cert I created did not show up.  I deleted it, and did it again, still it
    did not show up.  I figured something was wrong with the migration since this work previously, so I followed the guide and recovered everything back to my original 2008 Enterprise server. 
    Everything is back to where it was before except this problem of not being able to add new certs to issue through the GUI has stayed.  I can add them using command line: 
    certutil -setcatemplates +TemplateName  and they show up and are usable.
    Why can't I do this through the GUI? 

    Hi,
    In additon to above suggestion, hope the below link be helpful also:
    Can’t Create a New Certificate Template to Issue?
    Regards,
    Yan Li
    TechNet Subscriber Support
    If you are
    TechNet Subscription
    user and have any feedback on our support quality, please send your feedback
    here.
    Regards, Yan Li

  • Converting string inputs for command line to integers using parseInt()

    Hi,
    My program takes in an input from the command line - "args[0]".
    This line is supposed to be an integer but of course I depending on the user entering the correct data which is never a good scenerio. I used the line "int year = Integer.parseInt(args[0]); I get an error though if the user enters something like "java myProgram Hello" instead of "java my Program 1982".
    I want my program to continue running even if the input can't be converted to an integer. At the moment, it is terminating due to an invalid input. Is there anything I can do to keep this program running even if the input is invalid?
    Thanks

    Use a try/catch block
    int year;
    try {
       year = Integer.parseInt(args[0]);
    } catch (NumberFormatException nfe) {
        System.err.println("Usage: java myProgram  {year}");
        System.exit(-1);
    }

  • Delete command in SQLPLUS by use wrong column name command

    Assume I have three table T1,T2 and T3 shown as follow...
    sql> desc T1 ;
    cusid number
    name varchar2(50)
    sql> select * from T1;
    cusid name
    1) 101 TEST1
    2) 102 TEST2
    3) 103 TEST3
    4) 104 TEST4
    sql>desc T2;
    ref_cusid number
    sql>select * from T2
    cusid
    1) 103
    if I want to delete account in T1 that deleted account is in T2.
    I must use query1 , it will work
    query1::>
    delete from T1 where cusid in (select ref_cusid from T2);
    but if i type wrong by this command
    query2::>
    delete from T1 where cusid in (select cusid from T2);
    in query 2,it should be have warning message because field cusid is not in T2.Right ? But it will delete all account in table T1.
    compare query2 with query 3,
    query3::>
    delete from T1 where cusid in (select field_test from T2);
    it will show warning message like 'ORA-00904: "FIELD_TEST": invalid identifier'
    I noticed that in query2 and query3 , Different Thing is query 2 wrong column name in T2 has same name as column in T1. I wonder why it is.

    I doubt very much if this is really what you did:
    sql>desc T2;
    ref_cusid number
    sql>select * from T2
    cusid
    1) 103The desc command shows a column name ref_cusid. The select command shows a column title cusid, not ref_cusid.
    You start by saying that you have 3 tables, without doing anything with T3. Are you sure you you haven't mixed up a copy and paste somewhere?

  • Javac command line program can use class, need tomcat to do same

    This may be simple, but any assistance to a newby would be greatly aprreciated. I have a this class file:
    import java.io.*;
    public class OCrypt
    static public String getEncryptedText (String plainText)
    Runtime R;
    String _encryptedText = "";
    char[] someData = new char[16];
    R = java.lang.Runtime.getRuntime();
    try
    java.lang.Process P = R.exec("./OCrypt " + plainText
    InputStreamReader ISR = new InputStreamReader(P.getInputStream());
    ISR.read(someData);
    _encryptedText = new String(someData,0,11);
    catch (Exception e)
    _encryptedText = "***ERROR***";
    return (_encryptedText);
    Where ./OCrypt is a compiled program writtine in C in the same folder. A small test program calls the class and C code and works. Now for the tomcat part, I need to be able to call this code from tomcat. I know it has worked in the past on a much older version of tomcat. I need to figure out how to make it work on tomcat 5.5.9
    Thanks

    Thanks for the reply. Please bare with me. I am reading in the SAMS teach yourself book to know how to create the folder structure. I assumed this folder should be off of my WEB-INF/classes folder. See the full path below.
    Couple of things
    1 - Your class should be in a package. Otherwise you
    will have problems.I added the .class file to a package. Or at least I think I did. I added this line to the top of the code.
    package OCrypt;
    The file is in this folder:
    /var/local/jakarta-tomcat-5.5.9/webapps/ROOT/pss/WEB-INF/classes/OCrypt
    Then I ran 'javac OCrypt' in that folder.
    2 -
    Where ./OCrypt is a compiled program writtine in C
    I always keep the C file in the same location as the class. That may be a problem later when tomcat can resolve the class but then can't find that program. I hope that will generate a completely different error.
    in the same folder.
    In the same folder as what?
    The current working directory for Tomcat is normally
    [TOMCAT]/bin. Is that the folder you mean? I will put it there if I get the class resolved.
    If you want to use this tool, I would say put it in
    the PATH for the machine (so it can be found from
    anywhere) or use an absolute reference to it.I can put a complete path in the .java file before I compile if you think that will help.
    You> can't count on the working directory being where you
    think it is. But right now I would just like to create a simple class like adding two numbers together and returning a result. My larger issue is more of a server configuration. I am using a enterprise wide tomcat server and have been told EACH application folder has it's own classpath. I even attempted to write a JSP that would output my enviroment to a simple page. This didn't work because the env was only for the user, not the env AFTER all the startup scripts run for the server.
    >
    One solution is to use ServletContext.getRealPath().
    Is there any reason you couldn't rewrite the
    encryption into Java - that way you wouldn't have to
    bother with Runtime.exec()
    Another alternative would be to use JNI to get a Java
    interface to the C class.
    http://www-128.ibm.com/developerworks/edu/j-dw-javajni
    -i.html
    I think either of those solutions are preferable to
    using Runtime.exec().

  • Starting command line exec without dos window...

    I'm trying to start a console window application under my java swing application with the Runtime.exec(cmd) function.
    A dos window appear during the execution of the application. How to remove the screen echo ?
    Thanks
    SEB

    Hi ollie lord and thank you for your suggestion.
    I tried to use a *.bat file instead but the result was the same. I tried to use the word "start" in the command but nothing more.
    My .bat file is simple:
    start myprogram or myprogram
    ...where myprogram.exe is a win32 console application from Visual C++.
    Is there any option in function Main() in C++ to remove the dos console ?
    I head about the JNI tech. Is it a solution ?
    Thanks
    SEB

  • How I can set my default browser mozilla firefox from the command line in Windows 7?

    I need to set my default browser mozilla firefox from the command line, ie without using the GUI.

    '''-setDefaultBrowser''' is the correct command - you need the two capital letters.
    Why Firefox 17.0.1? You would be missing a number of important security updates. Firefox 17.0.'''9''' is the current ESR release version.

  • RunInstaller in command line mode

    Hi All
    Can I runInstaller in command line mode without using the GUI?
    I download linux_11gR2_examples.zip and upload it onto my Amazon AMI
    I would like to iinstall the examples but I am not able to set xdisplay so how I can get around this?
    -Thanks for all your input

    Hi;
    Please see below doc
    http://download.oracle.com/docs/cd/E11882_01/install.112/e16763.pdf << Oracle Database Installation Methods
    By the way why you can not xdisplay? What is error?
    Please see:
    Re: 11gR2 Grid Infrastructure cannout launch installer OEL 5.5
    Regard
    Helios

  • Install UCM 11g in command line mode

    Hi there,
    I am installing oucm 11g on a linux system (suse 11). I would like to know if it is possible to run the installer in command line mode (without using any X11 window server).
    I have tried with this command
    ./runInstaller –jreLoc $JAVA_HOME
    but after some requirements check failed because it cannot connect to X11 window server.
    Thanks,
    al

    Though following installation procedure may not be supported but it worked for me.
    create Inventory Location
    mkdir /var/SP/weloadm/home/oraInventory
    Create an file oraInst.loc with contents in the
    software directory:
    inventory_loc=/var/SP/weloadm/home/oraInventory
    inst_group=welo
    ./runInstaller -jreLoc $JAVA_HOME -silent -
    invPtrLoc /var/SP/weloadm/home/software/oraInst.loc
    “ORACLE_HOME=/opt/SP/weloadm/Middleware/Oracle_ECM1
    ” “MIDDLEWARE_HOME=/opt/SP/weloadm/Middleware”
    Hope it helps

  • Variable does not work for sqlplus (command line)

    Here is an select:
    variable x number;
    variable y number;
    variable a number;
    define x = 2000;
    define y = 2*1000;
    define a = &x+&y;
    select ener from adding where ener = &a;
    When I execute it under SQL*Plus Worksheet (client installed on my PC) then I get output:
    ENER
    4000
    1 row selected
    When I execute this same under command line sqlplus (under unix shell) then I get output
    old 1: select ener from adding where ener = &a
    new 1: select ener from adding where ener = 2000+2*1000
    no rows selected
    What is worng ?

    Nothing.
    Sqlplus is correct and sql worksheet is buggy.
    Define works with strings only. You cannot use it to calculate an expression.
    Apparently sql worksheet did calculate the expression, and sqlplus didn't, submitting it as a string.
    This is the expected behavior.
    This behavior can likely vary by version, so thank you for not providing version info.
    Will anything awful happen when you do, or is this just the lazyness epidemia in this forum?
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • Can you use command lines to copy files in UNIX to Oracle Apps

    Hi! We have installed the oracle apps 11.5.0 to a unix operating system. And we use ftps to upload the rtf and xml files to the unix server. Is there any command lines we can use to copy all the rft and xml files in the server to the real location of where the report files stored without going through the XML Publisher font end through the internet explorer? Thanks for your help!

    Hi,
    From what you have mentioned, I believe you are writing custom xml pub report
    1) Storing all your template and sample xml data file on Unix box by FTPing it. This step is not required as XML publisher picks template from XDO tables (where it is stored in CLOB), unless you are explicitly Coding to use templates from a fixed location like <CUST_TOP>/<xml_templates>
    2) As part of XML setup, you need to define the template and datasource using the front end. This causes the Template and XML data (sample) to be stored in XDO tables (as clobs). This step is basically required and unavaoidable.This step can be automated using FNDLOAD tool (not sure).
    Hope it helps somewhat.
    Neeraj

Maybe you are looking for

  • Anyone else having an issue with TCP connections using iCloud for Windows?

    Hi, Before I asked this question, I did wait to see if any related questions came up, but none did, so I submit it now. On my admittedly older laptop running Windows 7 64b Home, I've run into difficulties with the iCloud for Windows app to the extent

  • Built in MacBook speakers do not work

    My digital out only lists microphone out.  My headphones are not plugged in during this screenshot below.  When my headphones are plugged in they work and I have volume control.  When I unplug them, the volume stuff has the "no sign" so my laptop spe

  • Full screen pictures in slideshow not sharp

    Full screen pictures shown in the slideshow are not sharp, they're blurry. Very disappointing. In the library they look sharper but not as sharp as exported files (jpeg). Is this normal?  Is it not possible to see sharpening inside Lightroom? thanks

  • Printing shaped fabric, distortion?

    Hello, I'm searching for a solution to create accurate distortion to artwork, that will then be formed in a shape at finishing. The easiest example is a papercup. The art is set on a curve, and when the cup is finished and  the art is correct. My sho

  • Upgrading Organizer 11 to 12

    I am a relatively new user to Photoshop Elements.  I bought Photoshop Elements 11 and have enjoyed the organizer 11 for tagging etc all of my photos.  I just purchased Premiere Elements 12 (as I couldn't get 11) for my videos and now am not sure if t