我是SQL新手。我已经编写了在db中保存数据的程序。从SQL我试图调用此过程来保存数据。但是获取sql错误> ORA-00900: invalid SQL statement
。任何人都可以帮我解决这个错误吗?这是我的尝试:
我的程序>>>
PROCEDURE NEW_USER
(
IN_CREATED_BY IN VARCHAR2,
IN_MODIFIED_BY IN VARCHAR2,
IN_USERNAME IN VARCHAR2
)
AS
L_USER_ID INTEGER;
N_USER_ID INTEGER := hibernate_sequence.NEXTVAL;
BEGIN
SELECT case
when exists( SELECT USER_ID FROM T_MT_USER WHERE USERNAME = IN_USERNAME )
then
(SELECT USER_ID FROM T_MT_USER WHERE USERNAME = IN_USERNAME)
else 0
end into L_USER_ID
FROM dual;
IF (L_USER_ID = 0) THEN
INSERT INTO T_MT_USER
(USER_ID, ACCOUNT_EXPIRED_FLG, ACCOUNT_LOCKED_FLG, created_by, CREATED_TS, ACTIVE_FLG, end_effective_dt, modified_by, MODIFIED_TS, "password", password_expired, start_effective_dt, username)
VALUES
(N_USER_ID, 0, 0, IN_CREATED_BY, SYSTIMESTAMP, 1, NULL, IN_MODIFIED_BY, SYSTIMESTAMP, '$2a$10$3hoAeeVJ0AG.CQS2xX8rT.wUlt1rjoiYsHW0YflZEiQ5QYzG4HpYi', 0, SYSTIMESTAMP, IN_USERNAME);
END IF;
EXCEPTION
WHEN OTHERS THEN
log_api.fatal(log_ctx,'Exception in NEW_USER');
RAISE;
END NEW_USER;
我在sql>>
中的电话USER_DEMO.NEW_USER('sbappi','sbappi','sumon5');
答案 0 :(得分:0)
正如上面评论中a_horse_with_no_name所建议的那样,以下代码对我来说运行正常>>>
execute USER_DEMO.NEW_USER('sbappi','sbappi','sumon5');