annotate docs/source/capabilities.rst @ 282:4eef08cfaf25

copied documentation from blog
author catherine@dellzilla
date Thu, 19 Mar 2009 16:56:36 -0400
parents 701f0aae837a
children 80484bc60bdd
rev   line source
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
1 ==============================
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
2 SQLPython's extra capabilities
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
3 ==============================
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
4
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
5 For the most part, SQLPython simply duplicates SQL\*Plus's capabilites.
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
6
279
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
7 Neatened output
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
8 ===============
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
9
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
10 When printing query results, sqlpython economizes on screen space by allocating
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
11 only the width each column actually needs.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
12
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
13 Smart prompt
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
14 ============
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
15
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
16 sqlpython automatically uses `username`@`instance`> as its prompt, helping
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
17 avoid wrong-instance and wrong-user errors.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
18
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
19 Tab completion
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
20 ==============
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
21
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
22 When typing SQL commands, hitting `<TAB>` after entering part of an object
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
23 or column name brings up a list of appropriate possibilities or, if there
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
24 is only one possibility, fills in the rest of the name. This feature is
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
25 not yet very reliable, but can save typing.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
26
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
27 Scripting
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
28 =========
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
29
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
30 Like SQL\*Plus, sqlpython can run scripts (text files with series of SQL and
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
31 sqlpython commands) with `@/path/to/script.sql` or (for online scripts)
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
32 `@http://scripthost/scriptlibrary/script.sql`.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
33
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
34 History
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
35 =======
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
36
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
37 The up- and down-arrow keys allow you to scroll through the lines entered so far
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
38 in your sqlpython session.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
39
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
40 Commands are also entered into a command history.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
41
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
42 `history` or `hi`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
43 List entire command history
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
44
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
45 `list` or `li`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
46 List only last command
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
47
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
48 `hi <N>`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
49 List command number <N> from history.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
50
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
51 `hi <N>-`, `hi -<N>`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
52 List commands from <N> onward, or up to <N>
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
53
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
54 `hi <str>`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
55 Lists commands that include the string <str>
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
56
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
57 `hi /<regex>/`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
58 Lists commands that match the regular expression <regex>
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
59
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
60 `run`, `r`, or `\\g`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
61 Run the most recent command again
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
62
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
63 `run <N>`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
64 Run command <N>
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
65
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
66 `run <str>`, `run /<regex>/`
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
67 Run command matching <str> or <regex> (as for `history`) -
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
68 if multiple items would match, run most recent
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
69
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
70 Special I/O destinations
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
71 ========================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
72
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
73 Much as in a UNIX shell, you can follow a command with a special output destination.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
74
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
75 `> {filename}` sends the output to a file. This is more convenient than SQL\*Plus's
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
76 SPOOL {filename}... SPOOL OFF (though you can use those as well).
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
77
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
78 `>` alone (no filename) sends the output to the paste buffer.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
79
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
80 `|` pipes the output to an operating-system command.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
81
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
82 When `< {filename}` is included in your command, it is replaced with the contents of
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
83 {filename} before the command is run.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
84
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
85 Examples::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
86
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
87 Special output formats
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
88 ======================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
89
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
90 By replacing the `;` that terminates a SELECT statement with a backslash-character
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
91 sequence, you can get output in a number of useful formats. The `terminators`
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
92 command lists them, for your convenience::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
93
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
94 === ======================== ================================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
95 Especially useful for
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
96 === ======================== ================================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
97 ; standard Oracle format
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
98 \c CSV (with headings) sending to spreadsheets
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
99 \C CSV (no headings)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
100 \g list wide output with linewraps
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
101 \G aligned list
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
102 \h HTML table web reports
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
103 \i INSERT statements copying to other instances
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
104 \j JSON
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
105 \s CSV (with headings)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
106 \S CSV (no headings)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
107 \t transposed "narrow" tables like v$database
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
108 \x XML
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
109 \l line plot, with markers
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
110 \L scatter plot (no lines)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
111 \b bar graph
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
112 \p pie chart
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
113 === ======================== ================================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
114
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
115 Most of these output formats are even more useful when combined with special output
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
116 destinations. For example, `SELECT * FROM party\h > /var/www/party_report.html`
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
117 could create an HTML report in the webserver's documents directory, ready to serve.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
118
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
119 UNIX-like commands
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
120 ==================
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
121
279
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
122 Many sqlpython commands allow you to act as though the database objects
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
123 were files in a UNIX filesystem. Many of the commands also accept flags
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
124 to modify their behavior.
3c5fa8ed4f8b improving help
catherine@Elli.myhome.westell.com
parents: 247
diff changeset
125
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
126 ls {object type/object name, with wildcards}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
127 Lists objects from the data dictionaries, as though they were in a
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
128 *object_type*/*object_name* directory structure. Thus, `ls view/\*`
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
129 lists all the user's views. Calling with no argument is equivalent
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
130 to `ls *`.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
131
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
132 Options::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
133
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
134 -l, --long long descriptions
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
135 -a, --all all schemas' objects (otherwise, you only get your own)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
136 -t, --timesort Sort by last_ddl_time
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
137 -r, --reverse Reverse order while sorting
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
138
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
139 `ls -lt *;10` lists the ten items with the most recent last_ddl_time;
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
140 this can be a good way to answer the question, "What was I working on?"
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
141
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
142 cat {remainder of query}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
143 Shorthand for "SELECT * FROM". Can be combined with anything else
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
144 that fits into a SELECT statement (WHERE, ORDER BY, etc.)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
145
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
146 grep {grep {target} {table} [{table2,...}]
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
147 Equivalent to SELECT * FROM {table} WHERE *any column* LIKE '%{target}%'
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
148 Useful when you don't know, don't remember, or don't care which column
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
149 a value may be found in.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
150
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
151 Options::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
152
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
153 -i, --ignore-case Case-insensitive search
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
154
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
155 find -c {target}, find -t {column}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
156 Lists all tables or columns whose names contain {target}. More convenient than
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
157 querying user_tab_columns/all_tab_columns or user_tables/all_tables.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
158 Options::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
159 -a Find all objects (not just my own)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
160
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
161 PostgreSQL-like shortcuts
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
162 =========================
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
163
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
164 ----- ------------------
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
165 z y
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
166 ----- ------------------
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
167 \\c connect
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
168 \\d desc
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
169 \\e edit
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
170 \\g run
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
171 \\h help
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
172 \\i load
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
173 \\o spool
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
174 \\p list
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
175 \\q quit
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
176 \\w save
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
177 \\db _dir_tablespaces
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
178 \\dd comments
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
179 \\dn _dir_schemas
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
180 \\dt _dir_tables
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
181 \\dv _dir_views
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
182 \\di _dir_indexes
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
183 \\? help psql
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
184 ----- ------------------
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
185
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
186 PL/SQL source code
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
187 ==================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
188
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
189 pull {object_name}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
190 Displays the PL/SQL source code for {object_name}.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
191
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
192 Options:
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
193 -d, --dump dump results to files (object_type/object_name.sql)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
194 -f, --full get dependent objects as well
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
195 -a, --all all schemas' objects
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
196
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
197 bzr, git, hg {object_name}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
198 Dump source code to files, as `pull -f`, but also creates or commits to a
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
199 repository of the appropriate distributed version control system
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
200 (Bazaar, Git, or Mercurial, respectively).
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
201
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
202 find {target}
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
203 Lists all PL/SQL objects whose source code contains the {target} string.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
204 Always case-insensitive.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
205 Options::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
206 -a Search all PL/SQL objects (not just my own)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
207
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
208
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
209 Bind variables
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
210 ==============
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
211
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
212 Bind variables work in sqlpython as they do in SQL\*Plus, but they are set dynamically; there
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
213 is no need to declare them before use. The syntax for setting them is more permissive than
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
214 in SQL\*Plus; all these are recognized::
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
215
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
216 exec :mybind := 'value'
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
217 exec :mybind = 'value'
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
218 :mybind := 'value'
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
219 :mybind = 'value'
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
220
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
221 The current values of all bind variables can be viewed with the `print` command.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
222
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
223 The `bind` command creates and populates bind variables for the final row of the most recent
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
224 SELECT statement executed; each column name is used as a bind variable, which is filled with
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
225 the value. `bind -r {rownumber}` does the same, but fills from row {rownumber} instead of
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
226 from the final row (row numbers begin at 0 for this command).
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
227
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
228 When the `autobind` sqlpython parameter is True, a `bind` statement is issued automatically
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
229 after every query that returns exactly one row.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
230
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
231 Bind variables are available from within Python as a dictionary named `binds` (see Python).
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
232
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
233 Substitution variables
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
234 ======================
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
235
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
236 Substitution variables ("&" variables) work much as they do in SQL\*Plus. As in SQL\*Plus,
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
237 the `scan` parameter determines whether queries are scanned to replace substitution
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
238 variables. Unlike SQL\*Plus, sqlpython knows how annoying it is to hit a substitution
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
239 variable you didn't expect, so entering "SET SCAN OFF" when prompted for a substitution
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
240 variable actually aborts the substitution process.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
241
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
242 Wild SQL
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
243 ========
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
244
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
245 Wild SQL is a nonstandard SQL feature that must be enabled with `set wildsql on`. When it is
282
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
246 enabled, column names in a SELECT statement do not need to be explicitly typed; they can be
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
247 specified with special Wild SQL symbols: wildcards (`*`, `%`, `_`); column numbers (`#{N}`);
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
248 and NOT-style exclusion (`!`). The symbols can even be combined.
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
249
282
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
250 ::
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
251
282
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
252 jrrt@orcl> cat party
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
253
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
254 NAME STR INT WIS DEX CON CHA
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
255 ------- --- --- --- --- --- ---
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
256 Frodo 8 14 16 15 14 16
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
257 Gimli 17 12 10 11 17 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
258 Legolas 13 15 14 18 15 17
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
259 Sam 11 9 14 11 16 13
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
260
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
261 4 rows selected.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
262
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
263 jrrt@orcl> set wild on
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
264 wildsql - was: False
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
265 now: True
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
266 jrrt@orcl> select *i* from party;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
267
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
268 INT WIS
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
269 --- ---
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
270 14 16
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
271 12 10
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
272 15 14
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
273 9 14
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
274
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
275 4 rows selected.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
276
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
277 jrrt@orcl> select #1, #5 from party;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
278
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
279 NAME DEX
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
280 ------- ---
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
281 Frodo 15
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
282 Gimli 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
283 Legolas 18
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
284 Sam 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
285
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
286 4 rows selected.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
287
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
288 jrrt@orcl> select !str from party;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
289
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
290 NAME INT WIS DEX CON CHA
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
291 ------- --- --- --- --- ---
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
292 Frodo 14 16 15 14 16
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
293 Gimli 12 10 11 17 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
294 Legolas 15 14 18 15 17
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
295 Sam 9 14 11 16 13
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
296
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
297 4 rows selected.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
298
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
299 jrrt@orcl> select n*, !#3, !c* from party;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
300
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
301 NAME STR WIS DEX
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
302 ------- --- --- ---
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
303 Frodo 8 16 15
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
304 Gimli 17 10 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
305 Legolas 13 14 18
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
306 Sam 11 14 11
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
307
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
308 4 rows selected.
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
309
282
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
310 Wild SQL symbols only work in the first SELECT statement in a query; they do not work in
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
311 subqueries, subsequent UNIONed queries, etc.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
312
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
313 Python
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
314 ======
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
315
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
316 The `py` command allows the user to execute Python commands, either one-at-a-time (with
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
317 `py {command}`) or in an interactive environment (beginning with a bare `py` statement,
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
318 and continuing until `end py` is entered).
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
319
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
320 A history of result sets from each query is exposed to the python session as the list `r`;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
321 the most recent result set is `r[-1]`. Bind variables are exposed as the dictionary `binds`.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
322 All variables are retained each time the python environment is entered (whether interactively,
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
323 or with one-line `py` statements).
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
324
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
325 Resultsets in `r` are read-only, but `binds` can be written as well as read, and will
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
326 be working bind variables in the SQL environment.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
327
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
328 ::
247
f0f293d83337 begin docs
catherine@dellzilla
parents:
diff changeset
329
282
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
330 0:testschema@eqtest> select title, author from play;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
331
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
332 TITLE AUTHOR
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
333 --------------- -----------
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
334 Timon of Athens Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
335 Twelfth Night Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
336 The Tempest Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
337 Agamemnon Aeschylus
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
338
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
339 4 rows selected.
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
340
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
341 0:testschema@eqtest> py import urllib
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
342 0:testschema@eqtest> py current_season = urllib.urlopen('http://cincyshakes.com/').read()
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
343 0:testschema@eqtest> py
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
344 Now accepting python commands; end with `end py`
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
345 >>> r[-1]
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
346 [('Timon of Athens', 'Shakespeare'), ('Twelfth Night', 'Shakespeare'), ('The Tempest', 'Shakespeare'), ('Agamemnon', 'Aeschylus')]
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
347 >>> for row in r[-1]:
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
348 ... print '%s by %s' % (row.title, row.author)
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
349 Timon of Athens by Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
350 Twelfth Night by Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
351 The Tempest by Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
352 Agamemnon by Aeschylus
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
353 >>> [row.title for row in r[-1] if row.title in current_season]
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
354 ['Timon of Athens', 'Twelfth Night']
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
355 >>> binds['nowplaying'] = [row.title for row in r[-1] if row.title in current_season][0]
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
356 >>> end py
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
357 0:testschema@eqtest> print
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
358 :nowplaying = Timon of Athens
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
359 0:testschema@eqtest> select title, author from play where title = :nowplaying;
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
360
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
361 TITLE AUTHOR
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
362 --------------- -----------
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
363 Timon of Athens Shakespeare
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
364
4eef08cfaf25 copied documentation from blog
catherine@dellzilla
parents: 281
diff changeset
365 1 row selected.
281
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
366
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
367 Parameters
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
368 ==========
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
369
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
370 Several parameters control the behavior of sqlpython itself.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
371
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
372 ===================== ================================================== ===============
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
373 default
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
374 ===================== ================================================== ===============
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
375 autobind When True, single-row queries automatically `bind` False
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
376 commit_on_exit Automatically commits work at end of session True
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
377 continuation_prompt Prompt for second line and onward of long statement >
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
378 default_file_name The file opened by `edit`, if not specified afiedt.buf
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
379 echo Echo command entered before executing False
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
380 editor Text editor invoked by `edit`. varies
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
381 heading Print column names True
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
382 maxfetch Maximum number of rows to return from any query 1000
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
383 maxtselctrows Maximum # of rows from a tselect or \\n query 10
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
384 prompt Probably unwise to change user@instance>
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
385 scan Interpret & as indicating substitution variables True
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
386 serveroutput Print DBMS_OUTPUT.PUT_LINE results True
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
387 sql_echo Print text of "behind-the-scenes" queries False
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
388 timeout In seconds 30
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
389 timing Print time for each command to execute False
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
390 wildsql Accept *, %, #, and ! in column names False
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
391 ===================== ================================================== ===============
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
392
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
393 The user can change these with the `set {paramname} {new-value}` statement.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
394 The True/False parameters accept new
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
395 values permissively, recognizing "True", "False", "T", "F", "yes", "no", "on", "off"...
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
396
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
397 `set` and `show` both list the current values of the sqlpython parameters.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
398 `show parameter {param}` shows current Oracle parameters (from v$parameter), as it does
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
399 in SQL\*Plus.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
400
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
401 Tuning
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
402 ======
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
403
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
404 In sqlpython, `explain {SQL ID}` shows the execution plan for the SQL statement with the
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
405 given ID. If SQL ID is omitted, it defaults to the most recent SQL executed.
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
406 (This is not necessarily the last statement `EXPLAIN PLAN` was issued against.)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
407
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
408 Other specialized sqlpython tuning commands include:
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
409
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
410 load
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
411 Displays OS load on cluster nodes (10gRAC)
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
412
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
413 longops
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
414 Displays long-running operations
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
415
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
416 sessinfo
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
417 Reports session info for the given sid, extended to RAC with gv$
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
418
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
419 top, top9i
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
420 Displays active sessions
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
421
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
422
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
423
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
424
701f0aae837a got maxtselctrows working again
catherine@dellzilla
parents: 280
diff changeset
425