Relative Content

Tag Archive for oracle

SQL create table from Oracle all_tab_cols

SELECT ‘CREATE TABLE ‘ || table_name || ‘ (‘ ||
LISTAGG(column_name || ‘ ‘ || data_type ||
CASE
WHEN data_type IN (‘VARCHAR2’, ‘CHAR’) THEN ‘(‘ || data_length || ‘)’
WHEN data_type = ‘NUMBER’ AND data_precision IS NOT NULL AND data_scale IS NOT NULL THEN ‘(‘ || data_precision || ‘,’ || data_scale || ‘)’
WHEN data_type = ‘NUMBER’ AND data_precision IS NOT NULL THEN ‘(‘ || data_precision || ‘)’
ELSE ”
END, ‘, ‘) WITHIN GROUP (ORDER BY column_id) || ‘);’ AS create_table_statement
FROM all_tab_cols
WHERE table_name = ‘MY_TABLE_NAME’
GROUP BY table_name;

Queries consuming high Sharable Memory in AWR

I have faced some performance issue at the database and while investigating I’v noticed the below dynamic sampling queries. Note that the dynamic sampling parameter is 2, and the table statistics is up to date.
Taking on consideration the queries doesn’t include a dynamic sampling hint and I have searched in the AWR for such hint which I couldn’t find.

Oracle: How to capture forall save exceptions using while loop method

In oracle,Usually when we use forall save exceptions to capture error occurring records through bulk load, we will use for loop to iterate the SQL%bulk exceptions and capture the error records..there is a requirement to use while loop instead of for loop in exception block to capture SQL%bulk exceptions. Please could someone post working code on how to use while loop for capturing SQL%bulk exceptions?