|
1 | 1 | <!-- |
2 | | -$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.28 2001/05/08 02:26:09 momjian Exp $ |
| 2 | +$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.29 2001/05/08 02:53:24 tgl Exp $ |
3 | 3 | --> |
4 | 4 |
|
5 | 5 | <chapter id="plpgsql"> |
@@ -1309,28 +1309,37 @@ END LOOP; |
1309 | 1309 | RAISE <replaceable class="parameter">level</replaceable> '<replaceable class="parameter">format</replaceable>' <optional>, <replaceable class="parameter">variable</replaceable> <optional>...</optional></optional>; |
1310 | 1310 | </synopsis> |
1311 | 1311 |
|
1312 | | - Inside the format, <literal>%</literal> is replaced by the next argument's |
1313 | | - external representation. Double <literal>%</literal>'s are output as <literal>%</literal>. |
1314 | | - Possible levels are DEBUG (silently suppressed in production |
1315 | | - running databases), NOTICE (written into the database log and forwarded to |
1316 | | - the client application) and EXCEPTION (written into the database log and |
| 1312 | + Possible levels are DEBUG (write the message into the postmaster log), |
| 1313 | + NOTICE (write the message into the postmaster log and forward it to |
| 1314 | + the client application) and EXCEPTION (raise an error, |
1317 | 1315 | aborting the transaction). |
| 1316 | + Inside the format string, <literal>%</literal> is replaced by the next |
| 1317 | + optional argument's external representation. |
| 1318 | + Write <literal>%%</literal> to emit a literal <literal>%</literal>. |
| 1319 | + Note that the optional arguments must presently |
| 1320 | + be simple variables, not expressions, and the format must be a simple |
| 1321 | + string literal. |
1318 | 1322 | </para> |
1319 | 1323 |
|
| 1324 | + <!-- |
| 1325 | + This example should work, but does not: |
| 1326 | + RAISE NOTICE ''Id number '' || key || '' not found!''; |
| 1327 | + Put it back when we allow non-string-literal formats. |
| 1328 | + --> |
| 1329 | + |
1320 | 1330 | <para> |
1321 | 1331 | <programlisting> |
1322 | | -RAISE NOTICE ''Id number '' || key || '' not found!''; |
1323 | 1332 | RAISE NOTICE ''Calling cs_create_job(%)'',v_job_id; |
1324 | 1333 | </programlisting> |
1325 | | - In thislastexample, v_job_id will replace the % in the |
| 1334 | + In this example, the value of v_job_id will replace the % in the |
1326 | 1335 | string. |
1327 | 1336 | </para> |
1328 | 1337 |
|
1329 | 1338 | <para> |
1330 | 1339 | <programlisting> |
1331 | 1340 | RAISE EXCEPTION ''Inexistent ID --> %'',user_id; |
1332 | 1341 | </programlisting> |
1333 | | - This will abort the transactionand write tothedatabase log. |
| 1342 | + This will abort the transactionwiththegiven error message. |
1334 | 1343 | </para> |
1335 | 1344 | </sect2> |
1336 | 1345 |
|
|