How to run PL/SQL commands in this SQL browser

How to run PL/SQL commands in this SQL browser

This discussion should help Re: my pl/sql codes does not run in express edition what can i do????

Similar Messages

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • How to run a CMD command directly from run ?

    How to run a CMD command directly from run ?
    Like "cmd md D:\abcd". I did this before. But now I totally forgot how to do that ?
    Please help..........

    Hi,
    To add, here is the command CMD reference:
    Cmd
    Best regards
    Michael Shao
    TechNet Community Support

  • Run a shell command using Pl/Sql

    hi all
    i wonder if anyone knows a way to run a shell command using pl/sql
    other than java stored procedure
    as it seems not to be working in my case
    thanx in advance,
    Rasha

    ofcourse not
    i sent it once then i've got disconnected from interent then i reconnected
    and resend my question so it was sent twice
    now i hope you can answer my question !!!
    Do you really think when asking twice or more often you will get a quicker answer?

  • How to run O/S command from SQL * Plus.

    Hi,
    Can i run O/S commands, say copy or move, from SQL * Plus prompt? If yes, what is the command.
    Thanks.

    hi,
    or you can try the following
    slq > !
    and then your command
    rgds
    Alan

  • How to do SQL Command for this

    Hi,
    I have 2 tables.
    TempTT TempTB
    Name Place DeviceName Products
    Factory_55 Indonesia Factory_55##11122 Pencils
    Factory_22 USA Factory_22##23444 Pens
    Factory_33 UK Factory_22##82922 Erasers
    How do I do my SQL command if I wanted to extract DeviceName from TempTB
    if TempTT.Name is found in TempTB.DeviceName??
    Please advise me. Thank you!!

    I do not want to join them. I show my table here again. I wanted to SELECT DeviceName from TempTB if the Name from TempTT is found in DeviceName of TempTB. Thanks alot!
    TempTT
    Name Place
    Factory_55 Indonesia
    Factory_22 USA
    Factory_33 UK
    TempTB
    DeviceName Products
    Factory_55##11122 Pencils
    Factory_22##23444 Pens
    Factory_22##82922 Erasers

  • How can i run oralce copy command with in sql j code [urgent]

    I try it but it give me error inavalid sql command etc
    i need help urgent

    http://www.oracle.com/technetwork/database/enterprise-edition/calling-shell-commands-from-plsql-1-1-129519.pdf

  • How to run multiple DOS commands from a single Webutil Client_Host session?

    Hello all,
    I have a requirement where I need to create an interface with SVN from Forms for basic checkin-checkout of files.
    So, I've been trying to use webutil client_host to open a command line session and issue svn commands.
    For svn, sometimes I need to give multiple commands like change to a particular directory and then run an svn command.
    But client_host takes in only one command at a time and I'm unable to issue a series of DOS commands to perform
    a particular task.
    Is there a way to do this?
    Pls suggest.
    Regards,
    Sam

    First your original question... You can put more than one DOS command on a single line, simply separate each command with an ampersand (&). For example:
    mkdir c:\abc & cd abc & dir*
    Regarding your concerns about performance, well that would depend on exactly what you mean. Using CLIENT_HOST (or HOST on the server) simply opens a shell (DOS in this case) then passes your command to it. The performance of performing this action really isn't measurable. Basically you are just pressing a button and you should get a near immediate action. As for the performance of executing each command, that has nothing to do with Forms. Once the command is passed to the shell, the rest is a function of the shell and whatever command you passed.
    Having said that, if you were to write something sloppy like a loop (in pl/sql) which called CLIENT_HOST lots of times repeatedly, then yes there would be a performance problem because the pushing of the button will cause an exchange to and from the server and each cycle in the loop will do the same.
    So the answer to how performance is impacted will depend on what exactly you need to accomplish. If it is a single call to CLIENT_HOST, this should be fine.

  • Running sql commands from a .sql file

    Hello , I have this problem. How do i execute sql commands found in a .sql file with jdbc. My RDBMS is mysql.

    You will have to open and parse the .sql file, connect to the database, and execute the statements. You can't simply tell JDBC to run your .sql file.
    Depending on the complexity of your .sql file this is easy or hard. If its a bunch of e.g. updates or deletes or something you may be able to get away with running it as a block. In Oracle for example, you can put "begin" and "end;" around a bunch of statements and run it all together. In that case your program would open the SQL file, read the text, put it inside a "begin" and "end;", and run it as a single SQL statement.
    If its a bunch of statements that must be run independently then you'll have to programatically split them up to run one at a time. If its a select and you want to e.g. print results to the screen, well, then it gets tougher...
    - Jemiah

  • How to run piped Unix commands

    Hi,
    I'm trying to run piped Unix commands using Runtime.getRuntime().exec(...) but apparently the pipe symbol ("|") doesn't seem to work...
    Here is basically what I'm trying to do: running "command1 | command2" where both "command1" and "command2" have dynamic values. I could create a shell script and execute it through Java but there has to be a cleaner way...
    Can anyone help me with this?
    Thanks,
    Thierry

    The | symbol for a pipe is understood by a shell, so it was right to point to this direction.
    If you still have a problem, that might be because of another reason. What did happen, how exactly� did it not work? Did you take care of the stdin and stdout channels of the launched process?

  • How to run form from command prompt

    Hi,
    How to run a form from command prompt
    can anybody suggest me the way
    prasanth a.s.

    Well, if you are running windows, client server forms 6i, and your form is called 'myform', you could put this into a batch file :-
    start ifrun60 module=myform

  • How to run a DOS command from an Oracle form.

    How can I run a DOS command from an Oracle form (i.e. open the calculator located at c:\windows\system32\calc.exe)?

    first of all get the environment variable for the c:\windows\system32 direcotry for any of the windows
    you can use get variable from the ora env package
    now cancat the system32 variable with the calc.exe string
    now pass the string with host command as parameters
    this process will work for all type of windows.

  • How to run an external application from PL/SQL code?

    Hi,
    I want to call an application like "Notepad" from PL/SQL code in a Windows2000 server. Is there any way to do that?
    Thanks, best regards.
    Paulo.

    declare
    r varchar(4000);
    begin
    dbms_java.set_output(10000);
    system_util.runshell('sh /ora9/runBackup.sh', r);
    dbms_output.put_line(r);
    end;
    System_util package is
    CREATE OR REPLACE PACKAGE System_Util IS
    *System: Generic
    *Package Name: System_util
    *Description: This is an open source package which holds regular used
         * methods by developers and dba's.
    *Created by:         Rae Smith
    *Created Date:       27/06/2001
    *Notes: This ia an free open source package that holds no warranty and
    * therefore no-one connected to the development of this package
    * can be made reasponsible for any outcomes by it's use.
    MODIFICATION LOG**************************************************************
    *DETAILS                                    DATE          VERS          CHANGED BY
    *===============================================================================
    *Created                                 27-06-2001     1.0           Rae Smith
         /********************************* Public Methhods ***************************************/
         --- getDir returns the first directory value held in the init.ora file
         FUNCTION getDir RETURN VARCHAR2;
         --- getPrev.. returns the prevoise day from a gievn date
         FUNCTION getPrevSat(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevSun(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevMon(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevTue(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevWed(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevThu(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevFri(pDate IN DATE) RETURN DATE;
         --- isNumber returns TRUE or FALSE depending on a datatype passed
         FUNCTION isNumber(pnumber IN VARCHAR2) RETURN BOOLEAN;
         FUNCTION isNumber(pnumber IN NUMBER) RETURN BOOLEAN;
         FUNCTION isNumber(pnumber IN DATE) RETURN BOOLEAN;
         --- The writeFile allow you to write data to a file
         --- writeFile has 2 Versions
         --- v1 pass in the file name and the text to write to a file.
         --- v2 pass in the file name, dbms_sql.varhar2s object
         --- and the amount of rows to procces at a time
         --- This enables you to write to afile in batch mode
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2);
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
         --- The appendFile methods allow you to append data to a file
    --- This also has the inteligents to create the file if ts does not exist.
         --- appendFile has 2 Versions
         --- v1 pass in the file name and the text to write to a file.
         --- v2 pass in the file name, dbms_sql.varhar2s object
         --- and the amount of rows to procces at a time
         --- This enables you to write to afile in batch mode
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2);
         --- The clearFile clears the data from a file.
         PROCEDURE clearFile(pName IN VARCHAR2);
         --- checkSyntax is a quick syntax checker for sql statements the is a limit to
         --- the size used in the statement. If you have a error with
         --- a statement then pass in the statement watch as it displays
         --- the point where the error arose.
         PROCEDURE checkSyntax(pSql IN VARCHAR2);
         --- isEmpty this returns TRUE or FALSE
         FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN;
         --- getTimeInMins returns the time in minutes for a specified date
         FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER;
         --PROCEDURE get_time_in_mins (pDate IN DATE);
         --- incDate returns a specified date incremented by value
         FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
         --- decDate returns a specified date decremented by value
         FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
         --- getTime returns the time in milliseconds
         FUNCTION getTime RETURN NUMBER;
         --- daysDiff returns the amount of days between two values
         FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER;
         --- difference returns the diffeence between two numbers always
         --- taking the lowest away from the highest
         FUNCTION difference(pAnum IN NUMBER,pBnum IN NUMBER)RETURN NUMBER;
         --- total returns the value of two numbers added together
         FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER;
         --- numberToWords returns the string for a number passed in
         FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2;
         --- runShell allows you to run operating commands from pl/sql
         --- Only available with 8i
         --- PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2);
         /**************************** Public Vaiables *******************************/
         --- Public variable that holds the operating system directory
         --- that the can be written to from withing the database.
         vDir VARCHAR2(50);
    END;
    CREATE OR REPLACE PACKAGE BODY System_Util IS
         FUNCTION getDir RETURN VARCHAR2
         IS
         BEGIN
              RETURN vDir;
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
                   RAISE;
         END getDir;
         /**** Private module to get the first directory for utl_file to use ****/
         PROCEDURE getDir
         IS
              CURSOR cDir(p1 IN VARCHAR2)
              IS
              SELECT DECODE(INSTR(value, ','), 0, value, SUBSTR(value, 1, INSTR(value, ',')-1)) dir
              FROM v$parameter
              WHERE name = p1;
         BEGIN
              FOR rDir IN cDir('utl_file_dir') LOOP
                   vDir := rDir.dir;
              END LOOP;
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
                   RAISE;
         END getDir;
         FUNCTION getPrevDate(pDate IN DATE, pDay IN VARCHAR2) RETURN DATE
         IS
         BEGIN
              RETURN NEXT_DAY(pDate - 7, pDay);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevDate;
         FUNCTION getPrevSat(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'saturday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevSat;
         FUNCTION getPrevSun(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'sunday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevSun;
         FUNCTION getPrevMon(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'monday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevMon;
         FUNCTION getPrevTue(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'tuesday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevTue;
         FUNCTION getPrevWed(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'wednesday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevWed;
         FUNCTION getPrevThu(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'thursday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevThu;
         FUNCTION getPrevFri(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'friday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevFri;
         FUNCTION isNumber(pNumber IN VARCHAR2) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(pNumber)> 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
                   RETURN FALSE;
         END isNumber;
         FUNCTION isNumber(pNumber IN NUMBER) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(pNumber) > 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
              RETURN FALSE;
         END isNumber;
         FUNCTION isNumber(pNumber IN DATE) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(TO_CHAR(pNumber, 'YYYYMMDD')) > 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
                   RETURN FALSE;
         END isNumber;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
              UTL_FILE.PUT_LINE(vFtype,pText);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2, pFtyp IN OUT utl_file.file_type)
         IS
              vFtype utl_file.file_type;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
              UTL_FILE.PUT_LINE(vFtype,pText);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vRem := MOD(pText.COUNT, pRows);
              vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
              vCnt := pText.FIRST;
              LOOP
                   EXIT WHEN vCnt IS NULL;
              vRowcnt := vRowcnt + 1;
                   IF vCnt = pText.LAST THEN
                        vText := vText||pText(vCnt);
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF MOD(vCnt, pRows) = 0 THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF vRowcnt = vRem THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                   ELSE
                        vText := vText||pText(vCnt)||'\n';
                   END IF;
                   vCnt := pText.NEXT(vCnt);
              END LOOP;
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.WRITE_FILE');
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vMode VARCHAR2(2) := 'a';
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vRem := MOD(pText.COUNT, pRows);
              vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
              vCnt := pText.FIRST;
              LOOP
                   EXIT WHEN vCnt IS NULL;
                   vRowcnt := vRowcnt + 1;
                   IF vCnt = pText.LAST THEN
                        vText := vText||pText(vCnt);
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF MOD(vCnt, pRows) = 0 THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF vRowcnt = vRem THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                   ELSE
                        vText := vText||pText(vCnt)||'\n';
                   END IF;
                   vCnt := pText.NEXT(vCnt);
              END LOOP;
                   UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN UTL_FILE.INVALID_OPERATION THEN
                   IF vMode = 'a' THEN
                        writeFile(pName, pText, pRows);
                   ELSE
                        RAISE;
              END IF;
         WHEN OTHERS THEN
              dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
              UTL_FILE.FCLOSE(vFtype);
              RAISE;
         END appendFile;
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
              vMode VARCHAR2(2) := 'a';
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
              UTL_FILE.PUTF(vFtype, pText);
              UTL_FILE.FFLUSH(vFtype);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
         WHEN UTL_FILE.INVALID_OPERATION THEN
         IF vMode = 'a' THEN
              writeFile(pName, pText);
         ELSE
              RAISE;
         END IF;
         WHEN OTHERS THEN
              dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
              UTL_FILE.FCLOSE(vftype);
              RAISE;
         END appendFile;
         PROCEDURE clearFile(pName IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
              UTL_FILE.PUTF(vFtype,'');
              UTL_FILE.FFLUSH(vFtype);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
         WHEN OTHERS THEN
         dbms_output.put_line('ERROR...ERROR...System_Util.CLEARFILE');
         UTL_FILE.FCLOSE(vFtype);
         RAISE;
         END clearFile;
         PROCEDURE checkSyntax(pSql IN VARCHAR2)
         IS
         sqlCur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
         errPos PLS_INTEGER;
         sqlStmt VARCHAR2(2000);
         BEGIN
              sqlStmt := pSql;
              DBMS_SQL.PARSE(sqlCur, sqlStmt, DBMS_SQL.NATIVE);
         EXCEPTION
              WHEN OTHERS THEN
                   errPos := DBMS_SQL.LAST_ERROR_POSITION;
                   DBMS_OUTPUT.PUT_LINE(SQLERRM);
                   DBMS_OUTPUT.PUT_LINE(sqlStmt);
                   DBMS_OUTPUT.PUT_LINE(' ');
                   DBMS_OUTPUT.PUT_LINE(LPAD('^', errPos, '-'));
                   DBMS_SQL.CLOSE_CURSOR(sqlCur);
         END checkSyntax;
         FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN
         IS
         BEGIN
              IF pValue IS NULL OR pValue = '' OR pValue = ' ' THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         END isEmpty;
         FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER
         IS
              vHours NUMBER;
              vMins NUMBER;
              vRetval PLS_INTEGER;
         BEGIN
              vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
              vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
              vRetval := ((60 * vHours) + vMins);
              RETURN vRetval;
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getTimeInMins;
         PROCEDURE getTimeInMins (pDate IN DATE)
         IS
              vHours NUMBER;
              vMins NUMBER;
              vRetval PLS_INTEGER;
         BEGIN
              vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
              vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
              vRetval := ((60 * vHours) + vMins);
              DBMS_OUTPUT.PUT_LINE('The time IN minutes IS: '||vRetval);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getTimeInMins;
         FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
         IS
         BEGIN
         RETURN (TO_DATE(TO_CHAR(pDate + pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END incDate;
         FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
         IS
         BEGIN
         RETURN (TO_DATE(TO_CHAR(pDate - pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END decDate;
         FUNCTION getTime RETURN NUMBER
         IS
         BEGIN
              RETURN dbms_utility.get_time;
         END getTime;
         FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER
         IS
              vHighdate DATE;
              vLowdate DATE;
         BEGIN
         IF pHigh > pLow THEN
                   vHighdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
                   vLowdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
         ELSIF pLow > pHigh THEN
                   vHighdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
                   vLowdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
         END IF;
              RETURN (vHighdate - vLowdate);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END daysDiff;
         PROCEDURE dateCheck(pDateFrom IN OUT DATE, pDateTo IN OUT DATE)
         IS
              /* Declare the variable to hold the "from" date */
              vDateFrom DATE;
         BEGIN
              /* If either date_from or date_to is null then set to todays date **
              ** using the sysdate **
              ** today's DATE AND IN the correct format */
              pDateFrom := NVL(pDateFrom, SYSDATE);
              pDateTo := NVL(pDateTo, SYSDATE);
              /* Check that the from date is not greater than the to date if so **
              ** use the system_util.incDate to Increment the date by 1 day */
              IF (pDateFrom > pDateTo) THEN
              vDateFrom := pDateFrom;
              pDateTo := System_Util.incDate(1, vDateFrom);
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
              RAISE;
         END;
         /* calculates the difference of two numbers always taken the high from the low*/
         FUNCTION difference(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
         IS
              vTotal NUMBER;
         BEGIN
              IF (pAnum > pBnum )OR (pAnum = pBnum)THEN
                   vTotal := (pAnum - pBnum);
              ELSIF (pAnum < pBnum) THEN
                   vTotal := (pBnum - pAnum);
              END IF;
              RETURN (vTotal);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END difference;
         /* calculates the Total of two numbers*/
         FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
         IS
              vTotal NUMBER;
         BEGIN
              vTotal := (pAnum + pBnum);
         RETURN (vTotal);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END total;
         FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2
         IS
              vRetval VARCHAR2(255);
              vNumb PLS_INTEGER;
         BEGIN
              vNumb := pNumb;
              vRetval := REPLACE(TO_CHAR(TO_DATE(vNumb,'j'),'jsp'),'-',' ');
              RETURN (vRetval);
         EXCEPTION
              WHEN OTHERS THEN
              RAISE;
         END;
    /*************** Only Available on 8i ********************************\
         FUNCTION Catcherr(pStr IN VARCHAR2) RETURN VARCHAR2
         IS
              LANGUAGE JAVA
              NAME 'catchErr.run(java.lang.String) return String';
         PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2)
         IS
         BEGIN
              pErrMsg := Catcherr(pCmnd);
         EXCEPTION
         WHEN OTHERS THEN
              RAISE;
         END runShell;
    BEGIN
    getDir;
    END;

  • How to Run Operating System Command Before/After Message Processing SAP PI

    Hi,
    We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
    When we use single command say for example cp or mv (copy or move) the commands get executed fine.
    eg: cp %F /var/opt/data/outbound/Test/Dummy.txt 
    /this works fine/
    when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
    eg:
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    or
    wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
    Is it possible to execute multiple commands or redirect the output  of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.

    Hi Harleen,
    try like this
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    instead of semicolon try this
    (1) &
    command1 & command2
    Execute Command1 and then execute Command2
    (2) &&
    command1 && command2
    Runs the command2 only when command1 doesn't Complete successfully
    (3) ||
    command1 || command2
    Runs the second command if the first command had an error
    (4) ()
    (command1 || command2) || (command3 & command4)
    Defines the order in which commands are to be executed
    Regards
    Suraj

  • How to run a unix command in java

    Hi all,
    I need to run a unix command in my standalone java application.my java program is in windows.Is it possible to run unix command on windows system.help me out.
    I tried this
    Process p = Runtime.getRuntime().exec("ps -ef");
                BufferedReader stdInput = new BufferedReader(new
                     InputStreamReader(p.getInputStream()));
                BufferedReader stdError = new BufferedReader(new
                     InputStreamReader(p.getErrorStream()));i get IO Exception -Create Process ps-ef error=2

    If you want to run a command from java for a windows platform, you should check windows knows the command.
    So, load up a DOS prompt and type ps -ef and see what happens.

Maybe you are looking for

  • Deploying more than one webapplication on single cluster

    Hello Folks, Is there a way to deploy more than one webapplication on single cluster of weblogic. Presently, we are getting an error while deploying second webapplication as "Context path is already in use by the module: First Application Name". Awai

  • How to track material consumption before closing of Production Order

    Hi all, My customer needs to track online material consumption in Profit & Loss statment. Now when we take trials, we found that if we do not close a production order then Change in stock a GL under Expenditure drawer is not updated, and also the cos

  • Capture Sharpening & Lens Corrections- Does the order matter?

    Okay, I think I understand the concept that all of the changes made in Lightroom are metadata edits, and so it does not matter what order you make changes to your image. So using the lightroom controls for sharpening and lens corrections (chromatic a

  • Insert and then update on next page

    I've made a registration page and I want the following page to display the newly registered account in text boxes so the user is able to check the information and edit it then update their newly made registration. Essentially the form needs to go two

  • Mail won't stay open

    In the last 24 hours Mail has started crashing the moment I open it on my IPhone. The mail screen pops up for a second, and then closes again. I've updated my software, but it had no affect. Anyone know how to fix this?