PLS-00103: Encountered the symbol “;” when expecting one of the following:

邮差的信 提交于 2021-01-27 13:10:44

问题


I am trying to insert the answer to a user's security question, for use in the pin reset feature.

Ellucian banner v8+ provides an API for running this and I very new to their API and from the looks of the error message below, I am far from running this correctly. Any help is appreciated.

I tried running this in Oracle SQL Developer:

execute gb_pin_answer.p_create(
    P_PIDM        =>    12345,
    P_NUM         =>    1,
    p_gobqstn_id  =>    1,
    p_qstn_desc   =>    '',
    p_ansr_desc   =>    'David',
    p_ansr_salt   =>    'A123B456',
    p_user_id     =>    'W:H12345678',
    p_data_origin =>    'WWW_USER',
    p_rowid_out         OUT gb_common.internal_record_id_type
);

This is a shot in the dark, but I thought I'd give it a shot, error message that displays when trying to execute that package's p_create function:

Error starting at line 15 in command: execute gb_pin_answer.p_create( Error report: ORA-06550: line 1, column 30: PLS-00103: Encountered the symbol ";" when expecting one of the following:

( ) - + case mod new not null table continue avg count current exists max min prior sql stddev sum variance execute multiset the both leading trailing forall merge year month day hour minute second timezone_hour timezone_minute timezone_region timezone_abbr time timestamp interval date 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:

Error starting at line 16 in command: P_PIDM => 12345, Error report: Unknown Command

Error starting at line 17 in command: P_NUM => 1, Error report: Unknown Command

Error starting at line 18 in command: p_gobqstn_id => 1, Error report: Unknown Command

Error starting at line 19 in command: p_qstn_desc => '', Error report: Unknown Command

Error starting at line 20 in command: p_ansr_desc => 'David', Error report: Unknown Command

Error starting at line 21 in command: p_ansr_salt => 'A123B456', Error report: Unknown Command

Error starting at line 22 in command: p_user_id => 'W:H12345678', Error report: Unknown Command

Error starting at line 23 in command: p_data_origin => 'WWW_USER', Error report: Unknown Command

Error starting at line 24 in command: p_rowid_out OUT gb_common.internal_record_id_type Error report: Unknown Command

Error starting at line 25 in command: ) Error report: Unknown Command

This is where I read up on using this function, p_create: http://inb1.banner.ecu.edu:9090/api_erd_index_guide/api/general/gb_pin_answer.html#p_create

UPDATE: code that is erroring out:

SET SERVEROUTPUT ON
declare
  l_rowid_out gb_common.internal_record_id_type;
BEGIN
  gb_pin_answer.p_create(P_PIDM => 36706, P_NUM => 1, P_GOBQSTN_ID => 1, P_QSTN_DESC => '', P_ANSR_DESC => 'David', P_ANSR_SALT => 'HB123456', P_USER_ID => 'H00036657', P_DATA_ORIGIN => 'WWW_USER', P_ROWID_OUT => 1_rowid_out);
  dbms_output.put_line('rowid: ' || l_rowid_out);
END;

Error msg:

Error report: ORA-06550: line 4, column 199: PLS-00363: expression '1' cannot be used as an assignment target ORA-06550: line 4, column 3: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:


回答1:


The problem is the execute. That's actually shorthand for a short anonymous PL/SQL block, and cannot be split across lines. (Except maybe with a continuation character, but I can't remember off-hand if I've ever got that to work). Only the first line is translated, so it's effectively trying to run:

begin execute gb_pin_answer.p_create(; end;
/

... and it quite reasonably then doesn't like the command ending as p_create(;. The rest of the procedure call is then treated as 10 separate commands, which generate the other errors you get, and they are also reasonable in that context.

The solution is to either put the entire procedure call on one line, which will make it harder to read; or simply to use your own block, rather than relying on execute:

begin
    gb_pin_answer.p_create(
        ...
    );
end;
/

The last parameter isn't right though; the bit from OUT ... needs to be replaced with => some_value, like you've done with the others. But it is an out parameter, so you need something to put the value in. Without seeing what else is in the script you're running I can't tell if you've already taken care of it, but with this pattern you can probably just add a variable to the anonymous block:

set serveroutput on
declare
    l_rowid_out gb_common.internal_record_id_type;
begin
    gb_pin_answer.p_create(
        ...
        p_rowid_out => l_rowid_out
    );
    -- optional
    dbms_output.put_line('rowid: ' || l_rowid_out);
end;
/



回答2:


From the last edit, I see that you misstaken 1 for l... 1_rowid_out instead of l_rowid_out.

You cannot start a variable with a number like you tried to.



来源:https://stackoverflow.com/questions/16308701/pls-00103-encountered-the-symbol-when-expecting-one-of-the-following

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!