Skip to content

Commit 178687b

Browse files
committed
Removed extra spaces.
1 parent 85b02a3 commit 178687b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@ Method4 is a PL/SQL application to run dynamic SQL in SQL.
77

88
The simplest way to call Method4 is to pass in a literal query to evaluate:
99

10-
select * from table(method4.query('select * from dual'));
11-
12-
D
13-
-
14-
X
10+
select * from table(method4.query('select * from dual'));
11+
12+
D
13+
-
14+
X
1515

1616
At first that query seems pointless - why not just directly query `select * from dual`? Method4 provides two benefits - it silently converts LONGs to CLOBs and it allows custom code to control exactly what query is run and returned.
1717

1818
Method4 includes a dynamic mode that runs queries generated by queries and concatenated with UNION ALLs. This can solve challenging problems such as "count the rows for every table", all within a single SQL statement.
1919

20-
select * from table(method4.dynamic_query(
21-
q'[
22-
select replace(
23-
q'!
24-
select '#TABLE_NAME#' table_name, count(*) a from #TABLE_NAME#
25-
!', '#TABLE_NAME#', table_name) sql_statement
26-
from user_tables
27-
where table_name like 'TEST%'
28-
]'
29-
));
30-
31-
TABLE_NAME A
32-
------------------------- ----------
33-
TEST 19765
34-
TEST1 1
35-
TEST2 1
36-
TEST3 1
37-
...
20+
select * from table(method4.dynamic_query(
21+
q'[
22+
select replace(
23+
q'!
24+
select '#TABLE_NAME#' table_name, count(*) a from #TABLE_NAME#
25+
!', '#TABLE_NAME#', table_name) sql_statement
26+
from user_tables
27+
where table_name like 'TEST%'
28+
]'
29+
));
30+
31+
TABLE_NAME A
32+
------------------------- ----------
33+
TEST 19765
34+
TEST1 1
35+
TEST2 1
36+
TEST3 1
37+
...
3838

3939
These queries are powerful but they can also be confusing because of all the quotation marks required to build strings inside strings. Simplify your queries with the alternative quoting syntax (the "q" strings) and templating (use REPLACE instead of concatenating strings).
4040

0 commit comments

Comments
 (0)