mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
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:
committed by
Colin Seymour
parent
db15d0f5d2
commit
f146b4afbd
@@ -3049,12 +3049,21 @@ PLSQL:
|
|||||||
color: "#dad8d8"
|
color: "#dad8d8"
|
||||||
extensions:
|
extensions:
|
||||||
- ".pls"
|
- ".pls"
|
||||||
|
- ".bdy"
|
||||||
|
- ".ddl"
|
||||||
|
- ".fnc"
|
||||||
- ".pck"
|
- ".pck"
|
||||||
- ".pkb"
|
- ".pkb"
|
||||||
- ".pks"
|
- ".pks"
|
||||||
- ".plb"
|
- ".plb"
|
||||||
- ".plsql"
|
- ".plsql"
|
||||||
|
- ".prc"
|
||||||
|
- ".spc"
|
||||||
- ".sql"
|
- ".sql"
|
||||||
|
- ".tpb"
|
||||||
|
- ".tps"
|
||||||
|
- ".trg"
|
||||||
|
- ".vw"
|
||||||
language_id: 273
|
language_id: 273
|
||||||
PLpgSQL:
|
PLpgSQL:
|
||||||
type: programming
|
type: programming
|
||||||
|
|||||||
12
samples/PLSQL/print_bool.prc
Normal file
12
samples/PLSQL/print_bool.prc
Normal file
@@ -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;
|
||||||
|
/
|
||||||
48
samples/PLSQL/videodb.ddl
Normal file
48
samples/PLSQL/videodb.ddl
Normal file
@@ -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;
|
||||||
|
/
|
||||||
Reference in New Issue
Block a user