Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile_list
More file actions
Latest commit
executable file
·39 lines (33 loc) · 1.09 KB
/
Copy pathfile_list
File metadata and controls
executable file
·39 lines (33 loc) · 1.09 KB
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
#!/bin/bash
set -e
# All parameters are required. This way, users can't pass empty string as parameter.
invalidArgs=0
[ -z"$1" ] && invalidArgs=1
[ -z"$2" ] && invalidArgs=1
[ -z"$3" ] && invalidArgs=1
if [ $invalidArgs-eq 1 ];then
echo Usage: ut_run.sh "project_path""sql_param_name""output_file""scan_path"
exit 1
fi
# Remove trailing slashes.
projectPath=${1%/}
sqlParamName=$2
outputFile=$3
scanPath=$4
fullScanPath="$projectPath/$scanPath"
if [ !-d"$fullScanPath" ] || [ -z"$4" ];then
echo"begin">$outputFile
echo" open :$sqlParamName for select null from dual where 1= 0;">>$outputFile
echo"end;">>$outputFile
echo"/">>$outputFile
exit 0
fi
echo"declare">$outputFile
echo" l_list ut_varchar2_list := ut_varchar2_list();">>$outputFile
echo"begin">>$outputFile
forfin$(find $fullScanPath/* -type f | sed "s|$projectPath/||");do
echo" l_list.extend; l_list(l_list.last) := '$f';">>$outputFile
done
echo" open :$sqlParamName for select * from table(l_list);">>$outputFile
echo"end;">>$outputFile
echo"/">>$outputFile