0

I am trying to get a JAVA program (Pega to be exact) to call the procedure to load XML data by calling a stored procedure, but it is not working, what am i doing wrong? I know it has something to do with my variable definitions but i am not sure how i would be able to specify that they will be provided parameters by the java file. below is my stored procedure. Thanks in advance

The error messages I'm getting are:

Error(2,16): PLS-00103: Encountered the symbol ";" when expecting one of the following: := . ) , @ % default character

and

Error(16,1): PLS-00103: Encountered the symbol ")" when expecting one of the following: begin function pragma procedure subtype type current cursor delete exists prior

Create or Replace Procedure Cascade_Load (
    Value_ID Number,
    pValue_ID Number,
    pCalculation_ID Number,
    Calculation_ID Number,
    Calculation_Value_ID Number,   
    p_Entity_Address_ID Varchar2(50),
    New_Value_ID Number,
    New_Calculation_ID Number,
    New_Calculation_Value_ID Number
) AS
    BEGIN
        IF code is not null
        THEN
            INSERT INTO Value (Value_ID, energy_product_id, data_source_id, unit_cd, 
                value_tx, padd_cd, supply_type_id, country_cd, state_cd, county_cd, 
                entity_address_id,  series_id, energy_process_cd, result_type_cd, 
                geo_area_cd, create_dt, create_user_id)
            VALUES ( 
                Value_ID, 
                Get_energy_product_id(:NEW.Product_Name_Cd),
                Get_Data_Source_Id(:NEW.Data_Source_Tx),
                :NEW.UNIT_CD ,
                :NEW.Value_Tx,
                :NEW.PADD_CD,
                Get_Supply_Type_Id(:NEW.Supply_Type_Tx),
                :NEW.COUNTRY_CD,
                Get_State_CD(Get_entity_Id(p_Entity_Address_ID)),
                'NA',
                Get_Entity_Address_ID(Get_Entity_ID(p_Entity_Address_ID)),
                0,
                :NEW.Energy_Process_CD,
                :NEW.Result_Type_CD,
                :NEW.Geo_Area_Cd,
                Sysdate,
                '15'
            );
            Commit;
            END IF;
            END;
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
icerabbit
  • 79
  • 3
  • 13

3 Answers3

0

@icerabbit

Am not sure if it is a syntax error for having semicolons to separate parameters instead of comas. If this was the case You would've got an error message while compiling itself. What is that code in the body of the SP, is that a variable which is not defined? If Value is a table name, try enclosing it in the braces. If you are seeing an error message, please post that too, it'll give some idea for debugging further.

Thank you

  • I fixed what you suggested, now i am getting bad bind variable errors. I assumed if NEW is a pre-existing function/class in the system how can i import in at the beginning of the code? (if that makes any sense) – icerabbit Feb 14 '18 at 19:33
  • If your intending to just make an insert into the table with values you receiving as parameter plus values you generate from different stored procedures it is always good to follow few standards. First define all parameters with p_ as prefixes just to remove ambiguity between parameters and column names. Secondly declare variables - number of variables should be equal to the number of columns you are trying to insert in this SP. Thirdly define all these variables with values you wanting to insert them with like v_col1 = p_col1 and v_col2 = getCol2(p_col2) and then use these just defined variab – Gururaj Bachu Feb 14 '18 at 19:44
  • ➕ Just defined variables in your insert statement in the SP – Gururaj Bachu Feb 14 '18 at 19:45
  • if java / pega is calling my stored procedure do i just leave the variables declared but not defined? (I.e. Value_ID Number) Not quite sure how this works or if there are any guides out there. – icerabbit Feb 14 '18 at 21:27
0

Replace the semicolon with comma in your stored procedure's parameters

pandi
  • 15
  • 1
  • 7
0

:NEW and :OLD variables are used just in TRIGGERS.

You can't BIND then inside a stored procedure.