• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Oracle stored proc simple problem

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Oracle stored proc simple problem

    Why won't the following compile?

    Code:
    CREATE OR REPLACE PROCEDURE sp_AddTestData
    (sTEST_DATA IN NVARCHAR2, iTEST_ID OUT INTEGER) AS
    BEGIN
      iTEST_ID := seqTestData.nextval;
      INSERT INTO TEST_DATA VALUES (iTEST_ID,sTEST_DATA);
    END
    PROCEDURE sp_AddTestData compiled
    Warning: execution completed with warning
    I'm tired and not an Oracle guy but need this simple stored proc working so I can run some tests from the BPM framework to troubleshoot some issues we are facing with calling Oracle stored procs.

    TIA

    Suity
    Last edited by suityou01; 8 December 2011, 18:50.
    Knock first as I might be balancing my chakras.

    #2
    Originally posted by suityou01 View Post
    Why won't the following compile?

    Code:
    CREATE OR REPLACE PROCEDURE sp_AddTestData
    (sTEST_DATA IN NVARCHAR2, iTEST_ID OUT INTEGER) AS
    BEGIN
      iTEST_ID := seqTestData.nextval;
      INSERT INTO TEST_DATA VALUES (iTEST_ID,sTEST_DATA);
    END


    I'm tired and not an Oracle guy but need this simple stored proc working so I can run some tests from the BPM framework to troubleshoot some issues we are facing with calling Oracle stored procs.

    TIA

    Suity
    It says compiled.

    Did you commit.
    What happens in General, stays in General.
    You know what they say about assumptions!

    Comment


      #3
      Originally posted by MarillionFan View Post
      It says compiled.

      Did you commit.
      It's compiled but with a warning. And there is a big red cross next to the stored proc. Something ain't right. I did issue a commit now you mentioned it. Still no different.

      Really all I want this this sp compiled and some code to execute it. Even this is giving me gip.

      DECLARE NewID integer;
      CALL sp_AddTestData('This is a test',NewID);
      Gives

      ORA-06550: line 2, column 44:
      PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

      begin function pragma procedure subtype type <an identifier>
      <a double-quoted delimited-identifier> current cursor delete
      exists prior
      06550. 00000 - "line %s, column %s:\n%s"
      *Cause: Usually a PL/SQL compilation error.
      *Action:
      Knock first as I might be balancing my chakras.

      Comment


        #4
        What's the warning? TOAD, SQL Developer should provide a list of the warnings.

        Your script should be like

        DECLARE
        NewID integer;
        begin
        CALL sp_AddTestData('This is a test',NewID);
        end;
        McCoy: "Medical men are trained in logic."
        Spock: "Trained? Judging from you, I would have guessed it was trial and error."

        Comment


          #5
          Originally posted by lilelvis2000 View Post
          What's the warning? TOAD, SQL Developer should provide a list of the warnings.

          Your script should be like

          DECLARE
          NewID integer;
          begin
          CALL sp_AddTestData('This is a test',NewID);
          end;
          Thanks LE will try that

          I'm using SQL Developer, and there are no warnings in the message window
          I wondered if there was another immediate window under the view menu, but not that I can see

          Warnings would give a good clue I agree
          Knock first as I might be balancing my chakras.

          Comment


            #6
            aha! sql developer I use that too.

            Okay so on the tree, right mouse on the procedure and edit...
            Then click on the compile button (the gears)
            You should then get a compiler log window open at the bottom.
            That lists the errors in your PL/SQL

            In your case I suspect something with the sequence..its the only obvious things I can see.
            Last edited by lilelvis2000; 8 December 2011, 20:02.
            McCoy: "Medical men are trained in logic."
            Spock: "Trained? Judging from you, I would have guessed it was trial and error."

            Comment


              #7
              Oracle Database Online Documentation 11g Release 2 (11.2)

              perhaps start here:

              Developing Stored Subprograms and Packages

              then move on to:

              Contents
              While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'

              Comment


                #8
                So having confirmed that the Bobs are treating you with the respect you seem to deserve here is the noddy code you need.

                Code:
                CREATE OR REPLACE PROCEDURE ADD_LOCATION (
                (sTEST_DATA IN NVARCHAR2, iTEST_ID OUT INTEGER) 
                AS
                BEGIN
                INSERT INTO TEST_DATA VALUES (seqTestData.nextval, sTEST_DATA );  
                
                 SELECT seqTestData.CURRVAL INTO iTEST_ID FROM DUAL;
                
                END
                Last edited by eek; 8 December 2011, 20:39.
                merely at clientco for the entertainment

                Comment


                  #9
                  Originally posted by eek View Post
                  Some times I do wonder who some people on here can breath and do anything else at the same time.
                  Insults in English please
                  Coffee's for closers

                  Comment


                    #10
                    Originally posted by Spacecadet View Post
                    Insults in English please
                    Sorry I was running late for brownies (read into that anything you want because I know your minds).
                    merely at clientco for the entertainment

                    Comment

                    Working...
                    X