New extension support for PL/SQL language (#2735)
* Add additional PL/SQL file extensions * Add PL/SQL samples for .ddl and .prc * Fix sort order of PL/SQL extensions * Restore vendor/grammars/assembly. * Restore `pls` as primary PL/SQL extension * Add tpb to go with tps
This commit is contained in:
Родитель
db15d0f5d2
Коммит
f146b4afbd
|
@ -3049,12 +3049,21 @@ PLSQL:
|
|||
color: "#dad8d8"
|
||||
extensions:
|
||||
- ".pls"
|
||||
- ".bdy"
|
||||
- ".ddl"
|
||||
- ".fnc"
|
||||
- ".pck"
|
||||
- ".pkb"
|
||||
- ".pks"
|
||||
- ".plb"
|
||||
- ".plsql"
|
||||
- ".prc"
|
||||
- ".spc"
|
||||
- ".sql"
|
||||
- ".tpb"
|
||||
- ".tps"
|
||||
- ".trg"
|
||||
- ".vw"
|
||||
language_id: 273
|
||||
PLpgSQL:
|
||||
type: programming
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
create or replace procedure print_bool(
|
||||
p_bool in BOOLEAN,
|
||||
p_true_value in varchar2 default 'TRUE',
|
||||
p_false_value in varchar2 := 'FALSE'
|
||||
)
|
||||
as
|
||||
begin
|
||||
|
||||
dbms_output.put_line(case when p_bool then p_true_value else p_false_value end);
|
||||
|
||||
end print_bool;
|
||||
/
|
|
@ -0,0 +1,48 @@
|
|||
CREATE TABLE users (
|
||||
user_name varchar2(40),
|
||||
first_name varchar2(40),
|
||||
last_name varchar2(40),
|
||||
email varchar2(40),
|
||||
password varchar2(40),
|
||||
created_date DATE,
|
||||
total_credits NUMBER,
|
||||
credit_change_date DATE,
|
||||
PRIMARY KEY (user_name)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE users_videos (
|
||||
video_id NUMBER,
|
||||
video_name varchar2(40),
|
||||
user_name varchar2(40),
|
||||
description varchar2(512),
|
||||
upload_date DATE,
|
||||
PRIMARY KEY (video_id),
|
||||
CONSTRAINT "USERS_VIDEOS_FK1" FOREIGN KEY ("USER_NAME") REFERENCES "USERS"("USER_NAME")
|
||||
);
|
||||
/
|
||||
|
||||
create or replace procedure print_user_videos(
|
||||
p_user_name in users.user_name%type
|
||||
)
|
||||
AUTHID DEFINER
|
||||
as
|
||||
type t_user_videos is table of users_videos%rowtype
|
||||
index by pls_integer;
|
||||
l_videos t_user_videos;
|
||||
begin
|
||||
|
||||
select *
|
||||
bulk collect into l_videos
|
||||
from users_videos
|
||||
where user_name = p_user_name;
|
||||
|
||||
for i in 1..l_videos.COUNT
|
||||
loop
|
||||
|
||||
dbms_output.put_line(l_videos(i).video_name);
|
||||
|
||||
end loop;
|
||||
|
||||
end print_user_videos;
|
||||
/
|
Загрузка…
Ссылка в новой задаче