3

i have this code :

procedure :

CREATE OR REPLACE PACKAGE BODY PKG_ARRAY AS   PROCEDURE PARAAJA_BULK(P_INPUTS IN PARAAJAARRAY) 
IS   BEGIN
        FOR I IN 1 .. P_INPUTS.COUNT LOOP

          INSERT INTO PARA_AJA
            (FIELD1, FIELD2)
          VALUES
            (P_INPUTS(I).FIELD1, P_INPUTS(I).FIELD2);
        END LOOP;   END;

    END;

and scala code :

def spArray(name: List[person2],con:Connection) = Future[Boolean] { //supaya output jadi Future

    DriverManager.registerDriver(new OracleDriver())
    val conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx)(PORT=xxxx))(CONNECT_DATA=(SERVER=dedicated)(SERVICE_NAME=xxxx)))", "tesschema", "1234")
    var callableStatement: CallableStatement = conn.prepareCall("call PKG_ARRAY.PARAAJA_BULK(?)")

    val des = ArrayDescriptor.createDescriptor("PKG_ARRAY.PARAAJAARRAY", conn)
    val array_to_pass = new ARRAY(des, conn, name)

    callableStatement.setArray(1, array_to_pass)
    callableStatement.execute()

  }

but ,i have problem !!

invalid name pattern: PKG_ARRAY.PARAAJAARRAY

...

2 Answers 2

1

in java i used oracle procedure like:

CallableStatement cstmt = Connection.prepareCall("{CALL CmdtyStndrd.CmdtyStndrdProc(?)}");
cstmt.registerOutParameter(1, array_to_pass);
cstmt.execute();

and it works.

Sign up to request clarification or add additional context in comments.

1 Comment

Can also be done (more easily?) in Scala using Anorm
0

PARAAJAARRAY should be a schema-level defined type, not a type defined at package level. Try to create the type with CREATE OR REPLACE TYPE PARAAJAARRAY as TABLE OF (your record object type).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.