File: plsql_RTbug_57971.t

package info (click to toggle)
libsql-splitstatement-perl 1.00023-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 484 kB
  • sloc: perl: 3,384; sql: 1,478; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 630 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env perl

use strict;
use warnings;

use SQL::SplitStatement;

use Test::More tests => 1;

# Bug report (by Dan Horne):
# https://rt.cpan.org/Public/Bug/Display.html?id=57971

my $sql_code = <<'SQL';
create or replace procedure test (num1 number) is
v_test varchar2 is
begin
select col1
into v_test
from my_tab;
end;
/

create table my_tab(
col1 varchar2(30),
col2 number
);

insert into my_tab(col1, col2) values ('hello', 3);
SQL

my $splitter;
my @statements;

$splitter = SQL::SplitStatement->new;
@statements = $splitter->split( $sql_code );

cmp_ok(
    @statements, '==', 3,
    'Statements correctly split'
);