Example of calling utl_http command on trigger

I am generating trigger on oracle 11g db table,on trigger i want to communicate to other linux machine.Can any one provide me running example of utl_http command,so that i can refer it?
thanks in advance

What about searching in Oracle documentation ? You can find following example:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_web.htm#CHEFFGBA.
But I'm not sure it 's a good idea to use UTL_HTTP in a trigger: what would happen if communication fails or is slow ?

Similar Messages

  • Call unix command in sqlplus script

    Hello, I wanna to know how to call a unix command in the sqlplus script.
    For exemple,
    I've a sqlplus script to lauch a oracle report, after the report is generated, I wanne to replace the output file in an other directory.
    So that, I have to call the unix command mv here in the sqlplus script
    How can I do it?**
    I completed my situation:
    I don't have dbms_scheduler untility in my database.
    Thanks a lot for your help
    Edited by: user11930885 on 17 janv. 2010 14:53

    Yes, at the begining, I'll tried the unix shell by calling SQL.
    I've the problem of passing the parameters through.
    It seems to me
    we can use
    Host in the SQLPLUS to run the unix command.
    but I've written it in my sqlplus script, it doesn't work. so I wanna to find an exemple how to use HOST in sqlplus script?
    I would have loved to give you an example..but its not unix on my laptop.
    But what i can tell you is...u should be doing otherway round.
    Not calling Unix commands from SQL but calling SQL's form unix.
    You got shell scripts for that.
    Write a shell script. Login to SQL execute your code.
    exit from sql and then move your file with MV. That's it.
    Do post how far you get after trying this.

  • Call Unix Command From Reports Using Java

    Hi,
    Could somebody please show me a sample coding to call Unix command from 10g report using java?
    In metalink doc id 361857.1 does not show much.
    Thanks,
    neemin

    Hi,
    I have a problem with synchronization of the java commands.
    In the Before Parammeter Form trigger, I have:
    function BeforePForm return boolean is
    rt ORA_JAVA.JOBJECT;
    proc ORA_JAVA.JOBJECT;
    v_txt varchar2(32000);
    i integer := 0;
    v_cd_modulo int;
    v_arqlog text_io.file_type;
    cursor c_evento is
    select codigo,
    nome
    from
    (select e.cd_evento || e.cd_edicao codigo
    ,nm_evento nome
    from grh_ev_evento e
    where e.CD_GRUPO in (select cd_grupo
    from grh_ev_adm
    where cd_usuario = (select cd_usuario
    from usuario
    where login_usuario = :AUTHID)))
    order by substr(nome, 11);
    begin
    -- Create the context for logged user
    if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
    :AUTHID := :SSO_USUARIO;
    end if ;
    TCEENV.SET_TCEENV(:AUTHID);
    if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
    srw.message(100, 'Access denided!');
    return (FALSE);
    end if;
    -- Create file in Report Server (UNIX)
    v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
    :p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
    pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
    v_arqlog := text_io.fopen (:p_file, 'A');
    text_io.put_line (v_arqlog, v_txt);
    for reg in c_evento loop
    i := i + 1;
    if i = 1 then
    v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
    else
    v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
    end if;
    text_io.put_line (v_arqlog, v_txt);
    end loop;
    v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
    text_io.put_line (v_arqlog, v_txt);
    text_io.fclose (v_arqlog);
    SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
    rt := RUNTIME.GetRuntime();
    proc := RUNTIME.exec(rt,'rm ' || :p_file);
    return (TRUE);
    end;
    The problem is that there isn't a "synchronize" command, and the
    RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
    the SRW.SET_AFTER_FORM_HTML has a large delay and the following
    command is ignored.
    How can I solve it?
    thanks,
    lmprestes

  • How can i call shell command in JSP?

    My OS is Linux, and my WWW server is Tomcat,
    can i call shell command , such as gcc or setup,
    If yes, how can i? Would you give a source example?
    Thank you!

    Hi,
    I did this simple class to launch a process and after the cose there is an example to use it:
    import java.io.*;
    import java.util.*;
    public class ProcessExec {
    private String[] command;
    private StreamGobbler errorGobbler;
    private StreamGobbler outputGobbler;
    public ProcessExec() {
    public ProcessExec ( String[] command) {
    this.command = command;
    this.errorGobbler = null;
    this.outputGobbler = null;
    public String[] getCommand() {
    return ( this.command );
    public void setCommand( String[] command ) {
    this.command = command;
    public void exec() {
    try{
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(this.command);
    // any error message?
    errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    }catch (Throwable t){
    t.printStackTrace();
    }//catch
    public String getErrorMessage() {
    while ( this.errorGobbler.isAlive() ) {;}
    return ( this.errorGobbler.getResult().toString() );
    public String getOutputMessage() {
    while ( this.outputGobbler.isAlive() ) {;}
    return ( this.outputGobbler.getResult().toString() );
    } // ProcessExec
    Example to use it:
    try {
    ProcessExec pe = new ProcessExec( command );
    pe.exec();
    errorMessage = pe.getErrorMessage();
    outputMessage = pe.getOutputMessage();
    } catch ( Exception e ) {
    System.out.println (e);
    As you can guess the string "command" must be the command you have to launch and errorMessage and outputMessage will contain the error and the output that the process will generate.
    Try it; i hope this will help you.
    Cheers.
    Stefano

  • Call java from sybase trigger

    Is it possible to call java from Sybase trigger ? If so can you please supply example or URL to one ? Alternative solution is to call shell script from sybase trigger (as app is based on Solaris).
    Regards
    Michal

    Thank for your opinion, but what idea is better ?Doing things in the middle tier, where Java lives.
    Ever heard of event-based trading systems?
    pooling a table every 30 sec. ?. I need to implment
    real-time system which process each trade from table
    once it appears there.Sounds like you have it backwards - you're trying to drive Java from the database.
    I think it'd be better to write that event-based system in Java and leave the database just for persistence.
    GigaSpaces and their ilk are being used this way for highly transactional trading systems. Maybe you could see how they're doing it.
    %

  • Call unix commands from stored procedures

    My stored procedure requires to call unix commands HOW DO I DO IT?
    null

    i do not know pl sql but in java you can use:
    Runtime.getRuntime().exec("YOUR UNIX COMMAND");
    real example:
    Runtime.getRuntime().exec("ls");
    but you must be careful with using that...
    especially if you want to wait till the process finishes..
    rgds,

  • Calling Shell commands in C programme

    How would i call shell command using C programme.

    #include <unistd.h>
    #include <sys/types.h>
    #include <stdlib.h>
    #include <sys/types.h>
    #include <wait.h>
    int main(void) {
    pid_t pid;
    pid = fork();
    if (pid == 0) {
    execl("/bin/sh", "sh", "-c", "/bin/ls -l > /tmp/ls", NULL);
    exit(1);
    else if (pid > 0) {
    wait(NULL);
    else {
    return -1;
    return 0;
    }

  • Calling CL command in java

    I would like to know how to call cl command in java to delete a file in my server. thanks

    Use the java.lang.Runtime interface. The exec() method allows you to execute commands from the command shell:
    String cmd = new String[2];
    cmd[0] = "cl";
    cmd[1] = fileToDelete;
    Runtime rt = Runtime.getRuntime();
    rt.exec(cmd);

  • Example of calling a function with passing parms

    Does anyone have an example of calling a function that returns a refcursor, but also has passing parms? I've looked at the samples and they don't have passing parms. I've tried what you would think (adding an in passing parm to the function call and I get an ora-06550 error. If I don't pass the in parm, it works.
    i.e. FUNCTION MyFunction(ininteger in integer) returns refcursor;
    Thanx in advance,
    Frank

    Here is an example:
    plsql code:
    CREATE OR REPLACE PACKAGE testfun IS
    TYPE RefCursor IS REF CURSOR;
    FUNCTION fun1(keyid_in IN VARCHAR2) RETURN RefCursor;
    END testfun;
    SHOW ERRORS;
    CREATE OR REPLACE PACKAGE BODY testfun IS
    FUNCTION fun1(keyid_in IN VARCHAR2) RETURN RefCursor IS
         myCur RefCursor;
    BEGIN
         OPEN myCur FOR
    SELECT table_name
    FROM user_tab_columns
    WHERE rownum < 20;
         RETURN(myCur);
    END fun1;
    END testfun;
    SHOW ERRORS;
    c# code:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace ODPSample
         /// <summary>
         /// Sample: Demonstrates array binding
         /// </summary>
         class ArrayBind
              static void Main(string[] args)
                   // Connect
                   string connectStr = "User Id=fedpro;Password=password;Data Source=fedprodev";
                   OracleConnection connection = new OracleConnection(connectStr);
                   connection.Open();
                   OracleCommand loCommand = new OracleCommand("testfun.fun1", connection);
                   loCommand.CommandType = CommandType.StoredProcedure;
                   //RETURN VALUES MUST BE FIRST IN THE LIST OF PARMS!!!
                   OracleParameter loReturnValue = loCommand.Parameters.Add("refcursor",OracleDbType.RefCursor);
                   loReturnValue.Direction = ParameterDirection.ReturnValue;
                   //Parm1
                   OracleParameter loParm1 = loCommand.Parameters.Add("keyid_in",OracleDbType.Varchar2);
                   loParm1.Direction = ParameterDirection.Input;
                   loParm1.Value = "TEST";
                   //Create an OracleDataAdapter
                   OracleDataAdapter loDataAdapter = new OracleDataAdapter(loCommand);
                   DataTable loDataTable = new DataTable();
                   try
                        //Execute the function call
                        loCommand.ExecuteNonQuery();
                        //Populate the DataTable
                        loDataAdapter.Fill(loDataTable,(OracleRefCursor)loReturnValue.Value);
                        int rowcnt = loDataTable.Rows.Count;
                        Console.WriteLine(rowcnt);
                   catch (Exception e)
                        Console.WriteLine(e.Message);
                        throw;

  • Call a Procedure in Trigger

    Dear Sir
    How to call a Procedure in Trigger and if any exception occurs in trigger then How do we rollback it?
    Regards
    Thakur Manoj R

    [email protected] wrote:
    Dear Sir
    How to call a Procedure in Trigger Just call it by passing its parameters.
    and if any exception occurs in trigger then How do we rollback it?You dont have to rollback. Trigger depends on the parent transaction. So if you just allow the raise the exception it will automatically rollback.

  • Call *.jar inside the trigger (MS SQL)

    Hi!
    I'm just looking around google and can't find any good news.. The problem is: how to call *.jar inside the trigger. Trigger is stored in M$ Server.
    Tnx, if any response! ;)

    What?

  • Calling oracle command window through forms

    I need to call oracle command window in the forms. in the sence when i clicked a button in forms then oracle window has to open.
    Is that possible to call a oracle command window in forms.
    Please help me in this.
    Thanks in advance,
    raju.

    I need to call oracle command window in the forms. in
    the sence when i clicked a button in forms then
    oracle window has to open.
    Is that possible to call a oracle command window in
    forms.
    Please help me in this.
    Thanks in advance,
    raju.What do you mean by "Oracle command window"???

  • How to call gnuplot command from java

    Hi there,
    In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
    By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
    Thanks a lot for any suggestions!
    Jack

    Hi, there:
    Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
    BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
    Thanks,
    Jack
    P.S. Would you guys answer my question after I use up my duke dollars? :- )

  • Calling linux command line in Java

    Hi guys,
    I met a problem about calling linux comand in java program.
    In linux, I type :
    similarity.pl -type WordNet::Similarity::vector -file /home/csunix/fzsu/exam.txt
    it returns:
    Loading WordNet... done.
    Loading Module... done.
    good#a#1 nice#a#1
    good#a#1 nice#a#1 0.885813537770033
    dog#n#1 cat#n#1
    dog#n#1 cat#n#1 0.712603873475428
    good#a#6 nice#a#1
    good#a#6 nice#a#1 0.822428178005622
    From above, we can see that it works well, similarity.pl is a perl program for computing similarity between two concept, and -type and -file are the parameters.
    Now I want to use java to call these command, and here is my code:
    public static void main(String[] args) {
    try{
    String command="similarity.pl -type WordNet::Similarity::vector -file /home/csunix/fzsu/exam.txt";
    Process p=Runtime.getRuntime().exec(command);
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line=null;
    while ((line=br.readLine())!=null){
    System.out.println(line);
    }catch (IOException ex){
    ex.printStackTrace();
    But noting is print out. I also add the full path for similarity.pl, like /home/csunix/fzsu/similarity.pl in the variable "command", but still the same.
    I also change variable "command" to a string array in this way:
    String command[]={"/home/csunix/nlplib/WordNet/2.1-F7/perl/bin/similarity.pl",
                        "-type","WordNet::Similarity::vector","-file","/home/csunix/fzsu/exam.txt"};
    Again, I get nothing from it.
    Can anyone point out how to solve this problem?
    Thanks,
    Joe

    Crosspost.
    Don't do this if you want help!
    This question is answered on "New to Java".

  • Can we call OS commands and SQLLOADER from pl/sql

    Hi,
    Please provide me a solution for calling OS commands and SQLLOADER from pl/sql

    See http://www.oracle-base.com/articles/10g/Scheduler10g.php for OS Commands.
    Another option for your SQLLoader question would be the use of external tables,
    http://www.oracle-base.com/articles/9i/ExternalTables9i.php
    C.

Maybe you are looking for