0

I am trying to set the version of SDE by using following code :

SET SERVEROUTPUT ON;
declare q varchar2(100);
ver varchar(10);
BEGIN
    DBMS_OUTPUT.PUT_LINE('HI');
    ver := 'PQ_358';
    DBMS_OUTPUT.PUT_LINE(ver);
    q := 'EXEC sde.version_util.set_current_version('''||ver||''')';
    DBMS_OUTPUT.PUT_LINE(q);
    EXECUTE IMMEDIATE q;   
END;

It gives me output as :

HI
PQ_358
EXEC sde.version_util.set_current_version('PQ_358')


Error starting at line : 2 in command -
declare q varchar2(100);
ver varchar(10);
BEGIN
    DBMS_OUTPUT.PUT_LINE('HI');
    ver := 'PQ_358';
    DBMS_OUTPUT.PUT_LINE(ver);
    q := 'EXEC sde.version_util.set_current_version('''||ver||''')';
    DBMS_OUTPUT.PUT_LINE(q);
    EXECUTE IMMEDIATE q;   
END;
Error report -
ORA-00900: invalid SQL statement
ORA-06512: at line 9
00900. 00000 -  "invalid SQL statement"
*Cause:    
*Action:

Any solution on this. Database: Oracle.

My objective is to run this code using C#.

Note: Cannot use StoredProcedure or function. Need to stick with c# code.

1
  • Connections handle version management without explicit PL/SQL -- are you over-thinking this?
    – Vince
    Dec 8, 2021 at 14:43

1 Answer 1

0

EXEC is not a SQL statement. It is a shortcut specific to SQLPLUS that allows you to invoke a stored procedure. To invoke it from PL/SQL just do like this:

BEGIN
  sde.version_util.set_current_version('PQ_358');
END;

There is no need for dynamic SQL here. What is not clear is how you intend to invoke this from C#.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.