Problem with procedures...

hi all, I am creating a Times Tables (1 x 1, 3 x 5 etc...).
I am having trouble with the setting up the procedures. In this case the user must select between 1 - 4.
1 = multiplication
2 = divide
3 = add
4 = subtract
I am using If / else statemtents to direct to the appropriate procedure but am having errors as follows:
.java:67: 'else' without 'if'
else
Here is the code I am using up to now:
class assign2{
     public static void main(String[]args){
          int table;
          int lines;
          int type;
          do
               System.out.println("Please enter the times tables required (1 - 12)");
               Keyboard.skipLine();
               table = Keyboard.readInt();
               if (table < 1 || table > 12)
               System.out.print("INVALID ENTRY - Please try again and enter between 1 and 12"); // (C) Error msg if invalid
               System.out.println();
}while (table < 1 || table > 12);
do
     System.out.println("Please enter the number of lines required (1 - 12)");
     Keyboard.skipLine();
     lines = Keyboard.readInt();
               if (lines < 1 || lines > 12)
               System.out.print("INVALID ENTRY - Please try again and enter between 1 and 12"); // (C) Error msg if invalid
               System.out.println();
}while (lines < 1 || lines > 12);
          do
               System.out.println("Please select the table type from one of the following (1 - 4): ");
               System.out.println();
               System.out.println("1 = Multiplication");
               System.out.println("2 = Division");
               System.out.println("3 = Addition");
               System.out.println("4 = Subtraction");
               Keyboard.skipLine();
               type = Keyboard.readInt();
               if (type != 1 && type != 2 && type != 3 && type != 4)
               System.out.print("INVALID ENTRY - Please try again and select between 1 and 4 "); // (C) Error msg if invalid
               System.out.println();
          }while (type != 1 && type != 2 && type != 3 && type != 4);
          if (type == 1)
               getMultiply();
          else
          if (type == 2)
               getDivide();
          else
          if (type == 3);
               getAdd();
          else
          if (type == 4);
               getSubtract();
          static void getMultiply(){
               System.out.println("This is mulitply!!!");
          static void getDivide(){
               System.out.println("This is divide!!!");
          static void getAdd(){
               System.out.println("This is Add!!!");
          static void getSubtract(){
               System.out.println("This is Subtract!!!");

Multi-Post:
http://forum.java.sun.com/thread.jspa?threadID=5122115&tstart=0

Similar Messages

  • Problem with procedure in package

    Problem with procedure in package:
    create table accounts
    (acno number(10),
    name varchar2(20),
    balance number(10,2));
    create package banking is
    procedure new_acct(acno NUMBER, name IN VARCHAR);
    procedure acct_dep(acno IN NUMBER, amount IN NUMBER);
    procedure acc_wdr(acno IN NUMBER, amount IN NUMBER);
    procedure acc_bal(acno IN NUMBER, bal OUT NUMBER);
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN;
    end banking;
    create or replace package body banking is
    procedure new_acct ( acno IN number,
    name IN varchar) is
    begin
    insert into accounts
    (acno, name, balance)
    values
    (acno, name,0);
    end;
    procedure acct_dep(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance + amount
    where acno = acno;
    end;
    procedure acc_wdr(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance - amount
    where acno = acno;
    end;
    procedure acc_bal(acno IN NUMBER,
    bal OUT NUMBER) is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    acc_bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into acc_bal;
    close c_balance;
    end;
    end;
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into bal;
    close c_balance;
    if bal < 0 then
    return true;
    else
    return false;
    end if;
    end;
    end;
    end banking;
    begin
    banking.new_acct(123,'FRANKS');
    end;
    execute banking.acct_dep(123,100);
    execute banking.acc_wdr(123,50);
    Works fine up to this point, however when running the balance check the balance amount is not visible?
    SQL> set serveroutput on
    SQL> begin
    2 declare
    3 bal accounts.balance%type;
    4 begin
    5 banking.acc_bal(123,bal);
    6 dbms_output.put_line('Franks balance is '||bal);
    7 end;
    8 end;
    9 /

    procedure acc_bal(acno IN NUMBER,
       bal OUT NUMBER)
    is
    cursor c_balance(i_acno IN accounts.acno%type) is
       select balance
       from accounts
       where acno = i_acno;
       l_acc_bal accounts.balance%type;
    begin
       open c_balance(acno);
       fetch c_balance into l_acc_bal;
       close c_balance;
       bal := l_acc_bal;
    end;

  • Demantra - problem with procedure EP_BUILD_MODEL

    Hi,
    We have installed Demantra 7.3.1 Then create new model with Data Model Wizard. After clicking Build model we got the following error:
    Error - ORA-20001: Error in Procedure REBUILD_DATABASE ORA-1400: can not insert null in (DEAMANTRA.LOC_LEVELS.ENGINE_PROFILES_ID)
    I found out that reason of this problem is procedure Data_Model.rebuild_database
    Statements like this:
    INSERT INTO LOC_LEVELS (loc_level,loc_field_name,loc_field) VALUES (1,'Lowest Location Level',1);
    INSERT INTO LOC_LEVELS (loc_level,loc_field_name,loc_field) VALUES (2,'Highest Fictive Level',0);
    INSERT INTO ITEMS_LEVELS (item_level,item_field_name,item_field) VALUES (1,'Lowest Item Level',2);
    INSERT INTO ITEMS_LEVELS (item_level,item_field_name,item_field) VALUES (2,'Highest Fictive Level',0);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (1,1,1);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (2,1,2);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (3,2,2);
    gives error due to a fact that all this tables (LOC_LEVELS, ITEMS_LEVELS, FORECAST_TREE) has column ENGINE_PROFILES_ID with nullable set to no.

    Hi,
    The problem is solved it was a constraint violation when creating the data model on the location levels.
    Thank you

  • Strange problem with procedure calling from Java!!!

    I am using Oracle 8.1.7 Database, Oracle 8i Application server and WInNT platform.
    I am facing a strange problem while inserting a String from Java to Oracle database through Procedure. When i am passing the String containing single quotes(e.g "test' and ' and ' end") and without including any escape charactes for the single quotes I am passing the String by the setString() method then the procedure is inserting the single quotes without any problem.
    Of course when I am independently executing the procedure thru backend and passing the same String containing single quotes then the error message comes as " quoted string not properly terminated" which is justified,
    I have even printed the String in a file through sql on the runtime of the procedure when it is called by Java and then also the String contatins single quotes that is passed through java without any escape characters. This means that procedure is inserting the String into the column without any hassles!!!!!
    Can anyone tell me what may be the reason for the peculiar behaviour of Database?
    Thanks

    Sri Ram wrote:
    No actually in the documentation of oracle database 10g plsql user guide, oracle explains the concept of declaring nested plsql subprograms he gave the example but in the main block he gave NULL, without calling any procedure.Can you provide a link to where in the Oracle documentation you saw this example?
    in order to know which procedure is getting first i added a dbms statement in both the functions and called the function from the main block.
    the original example was
    DECLARE
    PROCEDURE proc1(number1 NUMBER); -- forward declaration
    PROCEDURE proc2(number2 NUMBER) IS
    BEGIN
    proc1(number2); -- calls proc1
    END;
    PROCEDURE proc1(number1 NUMBER) IS
    BEGIN
    proc2 (number1); -- calls proc2
    END;
    BEGIN
    NULL;
    END;
    ---------------------------------------------------------------------------------------------------------The original example is equivalent to:
    BEGIN
       NULL;
    END;That is, the main block never calls anything. Either you are misinterpreting the Oracle documentation, or if the example came from a non-Oracle source as I suspect, the author of that example has a deeply flawed understanding of how programming works.
    John

  • Problems with procedures with DEFAULT parameters on 9i

    The Forms builder shuts down when compiling a block that contains the reference to a stored procedure (packaged or not) that contains a defaulted parameter.
    Sometimes it just terminates the connection (ORA-3113)
    Is there a patch or a parameter setting that circumvents this failure?

    Hi Hema,
    There could be various things that explain this, but from your symptoms it looks like the engine is hung processing this report. This could be as simple as a PL/SQL trigger that is in an infinite loop. Anyway, a simple thing to do is to add TRACEFILE=filename&TRACEMODE=append&TRACEOPTS=TRACE_ALL onto your URL. This will create the specified file and dump information into it about what Reports is doing as it is processing your report. If it is hung in an infinite loop, you should be able to see how far it got when you kill it.
    Also, you can see the status of the reports job queue by using the http://.../rwcgi60?showjobs command. If the report is executing forever, you'll see it sitting there in the job queue.
    regards,
    Stewart

  • Problem with Collaborator Workbench

    Hi everyone, i have a problem with Demantra's Collaborator Workbench, after I'm creating a new data model. When I try to log in to collaborator to see my new levels that I've created, i am welcomed with the login error " Invalid user name or password".
    I've created a new user with full permission level, but it was in vain.
    What should I do?
    Thanks

    tnx. I have read those notes on metalink but it doesn't help me verry much. Now I can't even finish compile the new data model that I created, because of this error :
    *" Error-ORA-20001:Error in Procedure Build_Model ORA-20001:Procedure ADD_Column ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at DEMANT-Problem with procedure EP_BUILD_MODEL!! "*
    Cheers.

  • Raid0 problem with K8N NEO4 F1

    I have had some strange problems recently after running with complete stability for a couple of months.
    1. On booting up in the morning Windows XP Pro has failed to load. Only a MBR repair or image backup worked.
    2. Problems with Raid on boot occurred with 1. No array warning and only one disk showing up after deleting array.
    I have :-
    1. Run Memtest from Dos with no errors.
    2. Run WDDIAG on both disks with no errors
    3. Checked temperatures. All less than 45
    4. Checked power voltages etc - all good
    5. Re-flashed the bios from DOS.
    6. First thing I did was turn off overclocking btw.
    I have changed to RAID1 mirrored drives and things have been absolutely stable for a week. I even have the impression that the system is running faster!I have all the latest drivers installed. My feeling is that this is a bios or chip related problem though there are stories of XP fouling up the MBR when at the 137GB limit, I don't think these apply.
    Any comments would be appreciated.
    Thanks

    Meditek,
    First would like to go over your CD boot problem, because this totally a BIOS problem and Windows and its drivers not in the picture.  Therefore, I would like to make sure the BIOS running correctly and stably, before we get look at startup or running of Windows has problem.  BIOS Has problem Windows is going to have problems.
    The drive boot sequence; If you have a drive boot sequence of (1) Floppy Drive (2) CD Drive (3) Hard Drive and you have no disks in the floppy or CD drive the BIOS should not hang on the Floppy or CD Drive if the is not disk in them or should I give any type of air message.
    What I am getting from reading between the lines in your messages is that whenever you need to boot from a drive you are manually placing list in the boot priority less.  Please inform me, if I am wrong?
    I would like you to set your boot priority list like the one I listed above, that (1) Floppy Drive (2) CD Drive (3) Hard Drive.  If the is any other devices list place them after the Hard Drive.  Then go to your list of hard drive and insure the drive/Array with Window in stalled on it is first on the list, this tell the BIOS and Windows It is the Windows Boot device.
    Next, the CMOS Backup Battery, 2.89V is on the edge of being weak and we need to Totally Eliminate it as a problem.  I just took batteries of old motherboard that have been setting on the self for three to five years that read to same or higher.  So, get a new replacement battery the measures 2.950 or better.  Your current battery if you were having not problem I would you could still use it, but have a new on hand.
    A new battery will measure over 3 volts.
    Now, like take a look at the BIOS MOS reset procedure you are using.  I myself and others I have been in communications with have been having problems with procedure listed the Manual not completely clearing the CMOS Memory.  Leaving trash in some of the BIOS parameters, some of which are not even list so you do not your have completed a good total clearing of the BIOS and this alone can lead to some real weird problem that are imposable to trace to a cause.  Another MSI Form member gave me this procedure.  This procedure insures the there is no power let in the system to defeat your attempt to clear the clear the BIOS parameters.
    (1)   Unplug the AC Plug cord from the computer.
    (2)   Remove the Battery.  If your like me and has always struggled with get the little battery out when buried behind and under cables in between I/O cards.  Get a small pair of needle nose priers and press the two metal tabs together that make up the retaining clip.  Now this first time you do this it will surprise you, because if there is nothing it its way the spring contact behind it will pop it out with enough force to send it flying.  If you power supply is mounted in the bottom of your case, put paper over the grill, because if the battery goes in there you are in for at lest 12 pack day.
    (3)   With power, unplugged and the battery remove press the BIOS clear button and the Power switch and holed them for twenty to thirty seconds.
    (4)   Then, let the system set for as long as you have patience, at lest thirty minutes.
    (5)   Again, press the BIOS clear button and the Power switch and holed them for twenty to thirty seconds.
    (6)   Reinstall the battery and plug the power back in.
    (7)   Boot the system to the BIOS to BIOS Default Values, Save and Exit.
    (8)   Reboot to BIOS Setup Routine and Set all Bios parameters to the normal system operating parameters, save and exit.
    Note: Do not setup your system for any over-clocking, but check you memory default setting to insure the BIOS is setting them correctly.  Mine sets the default memory voltage to below the manufactures spec.
    (9)   Reboot the system to the BIOS setup routine, YES again, rechecks that all of you normal system operating parameters save and exit.
    (10)    Check and insure there are no disks in the Floppy or the CD, if there are remove them.
    (11)    Now when the system reboots it should not hang on the floppy or CD and the should be no error messages unless Windows itself has problem startup.
    Now, when you have all that done, reply and let me know how you system is operating.
    And that all for today, my communication center between my right and left brain is about a tenth the of normal and this has been working it on over load for about of about two hours, so time for med’s and a nap.
    Roger
    When submitting a problem, include a complete list of your system components; include part numbers, all Power Supply Voltages, and their output ratings.  It is almost impossible to estimate what your problem is without knowing something about it. 

  • Problem with HP-UX extended procedures that use C++ Standard library

    I am experiencing a problem with using the C++ standard library on HP-UX inside my extended procedures.
    Here is the definition for the library and procedures:
    -bash-3.2$ more nuhash2.sql
    CREATE OR REPLACE LIBRARY xp_nuencryption_l
    AS
    '/home/jchamber/datasecure/lib/libxp_nuencryption.sl';
    CREATE OR REPLACE PACKAGE xp_nuencryption
    AS
    PROCEDURE xp_nuhash2;
    END xp_nuencryption;
    CREATE OR REPLACE PACKAGE BODY xp_nuencryption
    IS
    PROCEDURE xp_nuhash2
    IS EXTERNAL
    LIBRARY xp_nuencryption_l
    NAME "xp_nuhash2"
    LANGUAGE C;
    END xp_nuencryption;
    Here is the PL/SQL test program:
    -bash-3.2$ more testnuhash2.sql
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
    BEGIN
    xp_nuencryption.xp_nuhash2 ();
    END;
    Here is the implementation of the extended procudure - notice how we are using the C++ Standard library:
    -bash-3.2$ more xp_nuhash2.cpp
    #include <string.h>
    #include <iostream>
    #include <fstream>
    class MyException {
    public:
    MyException() {}
    int func(std::ofstream& fout )
    fout << "func: About to throw exception in func()" << std::endl;
    throw MyException();
    extern "C"
    void xp_nuhash2 ()
    std::ofstream fout("/home/jchamber/xp_nuhash2.txt");
    try {
    fout << "xp_nuhash2: About to call func()" << std::endl;
    func(fout);
    catch (MyException& ex) {
    fout << "xp_nuhash2: caught MyException" << std::endl;
    fout << std::flush;
    fout.close();
    Here is how we build the library on HP-UX:
    # compile
    aCC -g -AA DA2.0W DS2.0 +z -c xp_nuhash2.cpp -o xp_nuhash.o
    #link using aCC
    aCC -g -AA DA2.0W DS2.0 +z -b -o /home/jchamber/datasecure/lib/libxp_nuencryption.sl xp_nuhash.o \
    /usr/lib/pa20_64/libstd_v2.a \
    /usr/lib/pa20_64/libCsup_v2.a
    chatr +dbg enable /home/jchamber/datasecure/lib/libxp_nuencryption.sl
    Here is how we test:
    SQL> @nuhash2
    Library created.
    Package created.
    Package body created.
    SQL> @testnuhash2
    DECLARE
    ERROR at line 1:
    ORA-28576: lost RPC connection to external procedure agent
    ORA-06512: at "JCHAMBER.XP_NUENCRYPTION", line 0
    ORA-06512: at line 3
    Now, if i use classic C++ (aCC -AP) it works. The trouble is, we have a lot of code that uses the Standard C++ library and we don't have the time to port it back to classic C++.
    The problem seems to be with an incompatibility with the standard C++ library. What is the magic potion of linker and/or compiler switches that would enable my extended procedures to use the standard C++ library?
    Here is the environment we are using:
    Oracle 9i (64-bit)
    HP UX 11.11
    Regards

    I am experiencing a problem with using the C++ standard library on HP-UX inside my extended procedures.
    Here is the definition for the library and procedures:
    -bash-3.2$ more nuhash2.sql
    CREATE OR REPLACE LIBRARY xp_nuencryption_l
    AS
    '/home/jchamber/datasecure/lib/libxp_nuencryption.sl';
    CREATE OR REPLACE PACKAGE xp_nuencryption
    AS
    PROCEDURE xp_nuhash2;
    END xp_nuencryption;
    CREATE OR REPLACE PACKAGE BODY xp_nuencryption
    IS
    PROCEDURE xp_nuhash2
    IS EXTERNAL
    LIBRARY xp_nuencryption_l
    NAME "xp_nuhash2"
    LANGUAGE C;
    END xp_nuencryption;
    Here is the PL/SQL test program:
    -bash-3.2$ more testnuhash2.sql
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
    BEGIN
    xp_nuencryption.xp_nuhash2 ();
    END;
    Here is the implementation of the extended procudure - notice how we are using the C++ Standard library:
    -bash-3.2$ more xp_nuhash2.cpp
    #include <string.h>
    #include <iostream>
    #include <fstream>
    class MyException {
    public:
    MyException() {}
    int func(std::ofstream& fout )
    fout << "func: About to throw exception in func()" << std::endl;
    throw MyException();
    extern "C"
    void xp_nuhash2 ()
    std::ofstream fout("/home/jchamber/xp_nuhash2.txt");
    try {
    fout << "xp_nuhash2: About to call func()" << std::endl;
    func(fout);
    catch (MyException& ex) {
    fout << "xp_nuhash2: caught MyException" << std::endl;
    fout << std::flush;
    fout.close();
    Here is how we build the library on HP-UX:
    # compile
    aCC -g -AA DA2.0W DS2.0 +z -c xp_nuhash2.cpp -o xp_nuhash.o
    #link using aCC
    aCC -g -AA DA2.0W DS2.0 +z -b -o /home/jchamber/datasecure/lib/libxp_nuencryption.sl xp_nuhash.o \
    /usr/lib/pa20_64/libstd_v2.a \
    /usr/lib/pa20_64/libCsup_v2.a
    chatr +dbg enable /home/jchamber/datasecure/lib/libxp_nuencryption.sl
    Here is how we test:
    SQL> @nuhash2
    Library created.
    Package created.
    Package body created.
    SQL> @testnuhash2
    DECLARE
    ERROR at line 1:
    ORA-28576: lost RPC connection to external procedure agent
    ORA-06512: at "JCHAMBER.XP_NUENCRYPTION", line 0
    ORA-06512: at line 3
    Now, if i use classic C++ (aCC -AP) it works. The trouble is, we have a lot of code that uses the Standard C++ library and we don't have the time to port it back to classic C++.
    The problem seems to be with an incompatibility with the standard C++ library. What is the magic potion of linker and/or compiler switches that would enable my extended procedures to use the standard C++ library?
    Here is the environment we are using:
    Oracle 9i (64-bit)
    HP UX 11.11
    Regards

  • Problem with JDBC results calling simple stored procedure in VC 7.0

    Hi all,
    I am building a simple VC model which calls a stored procedure on a JDBC database. I have created the system in the portal, defined the alias and user mapping, the connection test is fine and the VC "find data" lists my bespoke stored procedure.
    The stored procedure is :
    CREATE PROCEDURE dbo.dt_getBieUsers
    AS
    select * from dbo.emailuserlink
    GO
    When I test it using query analyser, it returns 3 records each with the two fields I expect - user and email address.
    I drag the model onto the workspace in VC and create an input form ( with just a submit button ). i drag the result port out to create a table. This has no fields in it.
    I build and deploy as flex and the app runs, I click the submit button and SUCCESS! I get 3 records in my table each with 2 fields. The data is all correct. The problem with this is the fields are determined at runtime it seems.
    I go back to the table and add 2 columns "email" and "address".
    i build and deploy and run the app. Again I get 3 records, but this time the contents of all of the rows is not data, but "email" and "address". The data has been replaced by the header texts in all of the rows.
    Can anyone help? Why isn't the data being put in my columns as I would expect?
    I tried to build and deploy the app as Web Dynpro rather than Flex to see if it was a bug in Flex. The application starts but when I click the submit button to run the JDBC stored procedure I get a 500 Internal Server Error
    com.sap.tc.wd4vc.intapi.info.exception.WD4VCRuntimeException: No configuration is defined for the entry JDBCFunction
        at com.sap.tc.wd4vc.xglengine.XGLEngine.createComponentInternal(XGLEngine.java:559)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstanceFromUsage(XGLEngine.java:362)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstance(XGLEngine.java:329)
        at com.sap.tc.wd4vc.xglengine.wdp.InternalXGLEngine.getCompInstance(InternalXGLEngine.java:167)
        at com.sap.tc.wd4vc.xglengine.XGLEngineInterface.getCompInstance(XGLEngineInterface.java:165)
    The JDBC connection I am using has a connection URL of jdbc:sap:sqlserver://localhost;DatabaseName=BIEUSERS
    and a driver class of com.sap.portals.jdbc.sqlserver.SQLServerDriver
    Can anyone solve my wierd problems?
    Cheers
    Richard

    Hi Richard,
    After you drag and drop the data service, right click on it and choose "Test data service". Then click on "Execute" and after you see the result on the right, click on "Add fields" button (inside the same window). Now you'll see that the fields are on the tabel. This is required only for JDBC data services, since this data (how the resultset is built) is not know in DT and it needs to be run firest - then analysed and only then you have to add the fields to the table).
    Regards,
    Natty

  • Problems with date in procedure on Oracle 11g

    Hi gurus,
    I have some problems with the date format on Oracle 11g.
    Let me explain the situation:
    When I am starting a request like
    select to_number(to_char(to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'))
    from sys.dual
    I got as result 2009 as number.
    When I do the same in a procedure of a package like this
    my_year := to_number(to_char(to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'));
    the variable my_year contains the value 9 instead of 2009.
    Can someone explain me what's going wrong?
    I have just tested with changing the environment variable nls_date_format for the session and for the complete database with no success.
    Regards,
    Björn

    Thank you all for your replies so far:
    @Alex: You are right, using your short script in sqlplus gives me also 2009 as result
    So, I am now posting the essential excerpts of the procedure because the whole one is to large:
    function insert_szrl (my_fremd_name varchar, my_elementadresse varchar,
    my_zeitstempel varchar, my_wert float,
    my_status varchar, my_zyklus varchar,
    my_offset integer,
    my_quelle varchar, my_nzm_daten integer) return integer is
    begin
    my_date := to_date (substr (my_zeitstempel, 1, 10), 'dd.mm.yyyy') + my_tageswechsel +1/24;
    if my_zyklus = 'mm' then
    my_zeitstempeldate := add_months(to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy'),-1) +1 + (my_tageswechsel+1/24);
    my_days := to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy') - add_months(to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy'),-1);
    my_year := to_number(to_char(to_date(my_date,'dd.mm.yyyy'), 'yyyy'));
    ptime.umschalttage_tuned (my_year, my_ws, my_sw);
    end if;
    While debugging the complete procedure I see since the start only a date which looks like '01.04.2009 07:00:00'
    Edited by: user10994305 on 19.05.2009 15:58
    Edited by: user10994305 on 19.05.2009 15:58

  • Problems with a Procedure

    People,
    I'm having a problem with a procedure in the moment I'm trying to execute it, could someone help.
    CREATE OR REPLACE PROCEDURE CARREGA IS
    begin
         declare
              strSQL VARCHAR2(250);
              NCham     number(9);
              cursor n_chamados is
              SELECT NumeroChamado, Planta, Instalacao, Defeito,
              DescricaoDefeito, Servico, DataChamado,Horas, Minutos
              FROM DEFEITOS_AUX;
    begin
         For reg_chamado in n_chamados
         Loop
              begin
                   NCham := reg_chamado.numerochamado;
                   strSQL := 'SELECT numerochamado FROM Defeitos';
                   strSQL := strSQL || ' WHERE numerochamado =';
                   strSQL := strSQL || NCham || ' GROUP BY numerochamado';
                   EXECUTE IMMEDIATE strSQL;
              exception
                   when no_data_found then
                   strSQL := 'INSERT INTO Defeitos (';
                   strSQL := strSQL || 'NumeroChamado, ';
    strSQL := strSQL || 'Planta, ';
                   strSQL := strSQL || 'Instalacao, ';
                   strSQL := strSQL || 'Defeito, ';
                   strSQL := strSQL || 'DescricaoDefeito, ';
                   strSQL := strSQL || 'Servico, ';
                   strSQL := strSQL || 'DataChamado, ';
                   strSQL := strSQL || 'Horas, ';
                   strSQL := strSQL || 'Minutos) ';
              strSQL := strSQL || 'VALUES ( ';
              strSQL := strSQL || reg_chamado.NumeroChamado || ', ';
              strSQL := strSQL || reg_chamado.Planta || ', ';
              strSQL := strSQL || reg_chamado.Instalacao || ', ';
              strSQL := strSQL || reg_chamado.Defeito || ', ';
              strSQL := strSQL || reg_chamado.DescricaoDefeito || ', ';
              strSQL := strSQL || reg_chamado.Servico || ', ';
              strSQL := strSQL || reg_chamado.DataChamado || ', ';
              strSQL := strSQL || reg_chamado.Horas || ', ';
              strSQL := strSQL || reg_chamado.Minutos || ')';
                   EXECUTE Immediate strSQL;
              end;
              strSQL := 'UPDATE Defeitos SET ';
              strSQL := strSQL || 'Planta = ' || reg_chamado.Planta;
              strSQL := strSQL || ', Instalacao = ' || reg_chamado.Instalacao;
              strSQL := strSQL || ', Defeito = ' || reg_chamado.Defeito;
              strSQL := strSQL || ', DescricaoDefeito = ' || reg_chamado.DescricaoDefeito;
              strSQL := strSQL || ', Servico = ' || reg_chamado.Servico;
              strSQL := strSQL || ', DataChamado = ' || reg_chamado.DataChamado;
              strSQL := strSQL || ', Horas = ' || reg_chamado.Horas;
              strSQL := strSQL || ', Minutos = ' || reg_chamado.Minutos;
              strSQL := strSQL || ' WHERE NumeroChamado = ' || NCham;
              EXECUTE Immediate strSQL;
         end loop;
    end;
    end;

    Hi Erika,
    there is no need for dynamic SQL.
    I suppose the NumeroChamado is your primary key and has an unique index on it.
    Just insert the rows and if there is already an existing row, catch the exception and update the row.
    CREATE OR REPLACE PROCEDURE CARREGA IS
      CURSOR n_chamados IS
        SELECT NumeroChamado,
               Planta,
               Instalacao,
               Defeito,
               DescricaoDefeito,
               Servico,
               DataChamado,
               Horas,
               Minutos
        FROM   DEFEITOS_AUX;
    BEGIN
      FOR reg_chamado IN n_chamados LOOP
      BEGIN
        INSERT INTO Defeitos (;
          NumeroChamado, ';
          Planta,
          Instalacao,
          Defeito,
          DescricaoDefeito,
          Servico,
          DataChamado,
          Horas,
          Minutos
        ) VALUES (
          reg_chamado.NumeroChamado,
          reg_chamado.Planta,
          reg_chamado.Instalacao,
          reg_chamado.Defeito,
          reg_chamado.DescricaoDefeito, 
          reg_chamado.Servico,
          reg_chamado.DataChamado,
          reg_chamado.Horas,
          reg_chamado.Minutos
      EXCEPTIONS
      WHEN DUP_VAL_ON_INDEX THEN
        UPDATE Defeitos SET
          Planta = reg_chamado.Planta,
          Instalacao = reg_chamado.Instalacao,
          Defeito = reg_chamado.Defeito,
          DescricaoDefeito = reg_chamado.DescricaoDefeito,
          Servico = reg_chamado.Servico,
          DataChamado = reg_chamado.DataChamado,
          Horas = reg_chamado.Horas,
          Minutos = reg_chamado.Minutos
        WHERE NumeroChamado = reg_chamado.NumeroChamado;
      END;
      END LOOP;
    END;

  • Problem with output data when calling into Oracle stored procedure

    I have a problem that I think I've seen posted by others, but I can't find it anywhere on the forum. Here's what it looks like:
    I have a application that sends a query parameter called custID in a URL to a JSP page.
    http://domain.com/decrypt.jsp?custID=ewsw
    The JSP subsequently calls into the method below to run a decryption stored procedure on an Oracle db. The custId parameter works fine from most clients. However, I have seen the decryption stored procedure return invalid information on some clients in the following case:
    http://domain.com/decrypt.jsp?custID='eirwx
    Here is how I define my call to the DCUSTID (decryption stored procedure):
    public long dCustID(String sCustID)throws SQLException {
    CallableStatement cs = null;
    try {
    long nCustID = 0;
    if(conn == null || conn.isClosed()) {getLocalConnection();}
    String sp = "BEGIN DCUSTID(?,?);END;";
    cs = conn.prepareCall(sp);
    cs.setString(1, sCustID);
    cs.registerOutParameter(2,java.sql.Types.NUMERIC);
    cs.execute();
    nCustID = cs.getLong(2);
    return nCustID;
    }finally { release(cs); }
    I have not been able to find a problem with the stored procedure (although Im not counting that out). Is there any way that the jsp or the code above is corrupting the data before it gets to the stored procedure? I'm very suspicious of the single quote at the begining of the custID query string parameter.
    Thanks

    >
    The JSP subsequently calls into the method below to
    run a decryption stored procedure on an Oracle db.
    The custId parameter works fine from most clients.
    However, I have seen the decryption stored procedure
    e return invalid information on some clients in the
    following case:
    The back tick doesn't matter.
    How do you know that the routine that you posted returns invalid information? Are you printing the value retreived before you return in the code that you posted? That is the only way to tell if that code is the problem vs some translation problem in something else.
    And what do you mean by 'invalid'? It does return a numeric value right? Is it negative? Or so large that it couldn't be a key? Or what?
    The input parameter to the stored proc is a varchar and not a char correct?

  • Problem with Oracle procedure

    Hi,
    We have a problem with a Oracle procedure call using the Sql Execute
    Procedure statement.
    The call gives us this error :
    SYSTEM ERROR: (This error was converted)
    (This error was converted)
    OpenCursor failed for SQL statement in project LFB010, class
    ClsDemarreLFB010,
    method Demarre, methodId 4, line 32, error from database is:
    ORA-01036: illegal variable name/num
    Class: qqdb_ResourceException
    Distributed method called: qqdb_SessionProxy.OpenCursor!22 (object
    name
    instance/d4745a10-c8e4-11d1-97fd-90cad1e7aa77:0x196:0x4/lfb010_cl0/lfb010_cl
    0-fonctiondbservice0x196:0x2)
    from partition "LFB010_CL0_Client", (partitionId =
    D4745A10-C8E4-11D1-97FD-90CAD1E7AA77:0x196:0x4, taskId =
    [D4745A10-C8E4-11D1-97FD-90CAD1E7AA77:0x196.3]) in application
    "FTLaunch_cl0", pid 4290975297 on node LAXOU146 in environment
    CentralEnv
    Oracle error: 1036, Server: sipre_tcp, UserName: forte
    Database Statement: begin
    :qqReturnValue := AID_CUMUL_ELTVAL;
    end;
    Class: qqdb_ResourceException ..........
    And this is the TOOL code :
    BEGIN TRANSACTION
    TmpEtat : IntegerData = new;
    TmpEtat.SetValue (( SQL EXECUTE PROCEDURE AID_CUMUL_ELTVAL ON SESSION
    FonctionDBService ));
    Etat = TmpEtat.Value;
    END TRANSACTION;
    Our procedure has no parameter and when we put a dummy parameter to the
    procedure and pass it in the TOOL SQL statement, it works fine althoug the
    Fort&eacute; help says the parameter list is optionnal !
    We tried to execute the procedure in a "SQL Select OurProdecure Into ..."
    statement, but it does'nt work because there is a SQL update in the
    procedure and it is forbidden by Oracle.
    Has anyone seen this error before ?
    Any ideas would be greatly appreciated.
    Many thanks and regards,
    Manuel DEVEAUX
    Previade, France
    e-mail : deveauxpreviade.fr

    Hi,
    We have a problem with a Oracle procedure call using the Sql Execute
    Procedure statement.
    The call gives us this error :
    SYSTEM ERROR: (This error was converted)
    (This error was converted)
    OpenCursor failed for SQL statement in project LFB010, class
    ClsDemarreLFB010,
    method Demarre, methodId 4, line 32, error from database is:
    ORA-01036: illegal variable name/num
    Class: qqdb_ResourceException
    Distributed method called: qqdb_SessionProxy.OpenCursor!22 (object
    name
    instance/d4745a10-c8e4-11d1-97fd-90cad1e7aa77:0x196:0x4/lfb010_cl0/lfb010_cl
    0-fonctiondbservice0x196:0x2)
    from partition "LFB010_CL0_Client", (partitionId =
    D4745A10-C8E4-11D1-97FD-90CAD1E7AA77:0x196:0x4, taskId =
    [D4745A10-C8E4-11D1-97FD-90CAD1E7AA77:0x196.3]) in application
    "FTLaunch_cl0", pid 4290975297 on node LAXOU146 in environment
    CentralEnv
    Oracle error: 1036, Server: sipre_tcp, UserName: forte
    Database Statement: begin
    :qqReturnValue := AID_CUMUL_ELTVAL;
    end;
    Class: qqdb_ResourceException ..........
    And this is the TOOL code :
    BEGIN TRANSACTION
    TmpEtat : IntegerData = new;
    TmpEtat.SetValue (( SQL EXECUTE PROCEDURE AID_CUMUL_ELTVAL ON SESSION
    FonctionDBService ));
    Etat = TmpEtat.Value;
    END TRANSACTION;
    Our procedure has no parameter and when we put a dummy parameter to the
    procedure and pass it in the TOOL SQL statement, it works fine althoug the
    Fort&eacute; help says the parameter list is optionnal !
    We tried to execute the procedure in a "SQL Select OurProdecure Into ..."
    statement, but it does'nt work because there is a SQL update in the
    procedure and it is forbidden by Oracle.
    Has anyone seen this error before ?
    Any ideas would be greatly appreciated.
    Many thanks and regards,
    Manuel DEVEAUX
    Previade, France
    e-mail : deveauxpreviade.fr

  • I have a problem with ( AppleSyncNotifier.exe - Entry Point Not Found ) The procedure entry point sqlite3_wal_checkpoint could not be locate in the dynamic link library SWLite3.dll.

    I have a problem with ( AppleSyncNotifier.exe - Entry Point Not Found ) The procedure entry point sqlite3_wal_checkpoint could not be locate in the dynamic link library SWLite3.dll.

    With Windows Explorer, navigate to your C:\Program Files\Common Files\Apple\Apple Application Support folder.
    Copy the SQLite3.dll that you should find there, navigate to the nearby Mobile Device Support folder, and Paste it in there also.
    Reboot and see if all is well
    In case that your OS is Windows 7 (64 bit)
    1. Open windows explorer, go to location C:\Program Files (x86)\Common Files\Apple\Apple Application Support
    2. Copy file "SQLite3.dll"
    3. Open new windows explorer, to to location C:\Program Files (x86)\Common Files\Apple\Mobile Device Support
    4. Paste file "SQLite3.dll" to the location.
    5. Reboot your computer, it should not display that message, it should be clear.
    Good Luck

  • Problem with java source procedure

    Hello everyone, I've set up a simple example that is supposed to create an fdf file on the server. I tested my program and it works fine.
    Now I'm trying to do the same thing except that I would like to have my java code in the database. Here's what I've done:
    # on database in opus schema
    create or replace and compile java source named testpdf as
    import java.io.*;
    import com.adobe.fdf.*;
    import com.adobe.fdf.exceptions.*;
    public class TestPDF
         public static void Test()
    try
         FDFDoc outputFDF = new FDFDoc();
         outputFDF.SetValue("status", "En traitement!");
         outputFDF.SetValue("Date", "01-01-2006");
         outputFDF.SetValue("Name", "Alexandre Folgueras");
         outputFDF.SetValue("Address", "12 Saratoga Ave");
         outputFDF.SetValue("City", "Saratoga");
         outputFDF.SetValue("State", "CA");
    outputFDF.SetFile("/tmp/java_pdf/GenerateFDF.pdf");
    outputFDF.Save("/tmp/java_pdf/alex.fdf");
    catch (Exception e)
    e.printStackTrace();
    create or replace procedure pdf_doc
    AS LANGUAGE JAVA
    NAME 'TestPDF.Test()';
    commit;
    Everything seems to be OK by when I run it, my file does not get created even though I don't get any errors.
    Anybody knows why?
    Thanks in advance!

    Hello,
    I'm also creating a class with static functions and putting it as a Java source in Oracle but I have problems with imports. In my case, I use MQSeries JAR files and when I put my code in Oracle, I have warnings "Java created with compilation errors". It's just about the lines where I create/use MQSeries objects, because when I comment them, I have no more errors.
    I see you also use specific imports with PDF, so I would like to know where you put the JAR files so that the Java source can be compiled correctly.
    Thanks in advance,

Maybe you are looking for

  • The N97, Ovi, and some of my hatred.

    This is what's pi$$es me most off at the moment. There's more, but I can't be arsed to mentally whip myself by reminding myself about it. But this should cover my main points of bloodraging fury.  The camera. Why is the production N97 equipped with a

  • Ipod won't sync despite restore

    Hi all.  I have an ipod classic that was purchased approx 3-4 years ago?  I've had some recent problems (i.e. won't recognize the ipod, some songs only play 1-2 sec before moving along to the next).  This most recent time, the ipod again was not reco

  • PDF Filename is entire path

    I am outputting a report to PDF and its all working fine except for one thing, and that is that the pdf's filename is the entire path to the file instead of just the filename. This is the code I am using in the cfdocument tag: <cfdocument format="pdf

  • APEX Interactive Report not shown complete on production system

    Hello, I have a problem with my Apex 4.1.1 application on customers production server. On our development system (Oracle 11.2.0.3) the Apex IR with the query down below delivers 1.500 rows and the page loading is finished after 3 seconds. On our cust

  • Catch the onClick event on Interactive Report to access columns content

    Hi, I am using Apex 4 I would like to display some rows into an interactive report. I have define a dynamic action on that report in order to catch the Mouse OnClick Event. The Goal is to display the detail of the row in a form region in the sidebar.