Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
-- #%L
-- JSQLParser library
-- %%
-- Copyright (C) 2004 - 2022 JSQLParser
-- %%
-- Dual licensed under GNU LGPL 2.1 or Apache License 2.0
-- #L%
---
DECLARE
PK_NAME VARCHAR(200);

BEGIN
EXECUTE IMMEDIATE ('CREATE SEQUENCE "untitled_table3_seq"');

SELECT
cols.column_name INTO PK_NAME
FROM
all_constraints cons,
all_cons_columns cols
WHERE
cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner
AND cols.table_name = 'untitled_table3';

execute immediate (
'create or replace trigger "untitled_table3_autoinc_trg" BEFORE INSERT on "untitled_table3" for each row declare checking number := 1; begin if (:new."' || PK_NAME || '" is null) then while checking >= 1 loop select "untitled_table3_seq".nextval into :new."' || PK_NAME || '" from dual; select count("' || PK_NAME || '") into checking from "untitled_table3" where "' || PK_NAME || '" = :new."' || PK_NAME || '"; end loop; end if; end;'
);
END

--@FAILURE: Encountered unexpected token: "PK_NAME" <S_IDENTIFIER> recorded first on May 27, 2022, 10:27:41 PM
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
-- #%L
-- JSQLParser library
-- %%
-- Copyright (C) 2004 - 2022 JSQLParser
-- %%
-- Dual licensed under GNU LGPL 2.1 or Apache License 2.0
-- #L%
---
DECLARE
n_emp_id EMPLOYEES.EMPLOYEE_ID%TYPE := &emp_id1;
BEGIN
DECLARE
n_emp_id employees.employee_id%TYPE := &emp_id2;
v_name employees.first_name%TYPE;
BEGIN
SELECT first_name, CASE foo WHEN 'a' THEN 1 ELSE 2 END CASE as other
INTO v_name
FROM employees
WHERE employee_id = n_emp_id;

DBMS_OUTPUT.PUT_LINE('First name of employee ' || n_emp_id ||
' is ' || v_name);
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE('Employee ' || n_emp_id || ' not found');
END;
END

--@FAILURE: Encountered unexpected token: "n_emp_id" <S_IDENTIFIER> recorded first on May 27, 2022, 10:29:48 PM
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
-- #%L
-- JSQLParser library
-- %%
-- Copyright (C) 2004 - 2022 JSQLParser
-- %%
-- Dual licensed under GNU LGPL 2.1 or Apache License 2.0
-- #L%
---
BEGIN
SELECT
cols.column_name INTO :variable
FROM
example_table;
END

--@FAILURE: Encountered unexpected token: "BEGIN" "BEGIN" recorded first on May 27, 2022, 10:29:48 PM