You start a session and execute these commands successfully:
Which two are true? (Choose two.)
You start a session and execute these commands successfully:
Which two are true? (Choose two.)
When working with Global Temporary Tables (GTTs) in Oracle, several behaviors are specific to the session and transaction handling. One key aspect is that you cannot directly drop a GTT while it is in use; you must first truncate it to ensure no active sessions or transactions are using it, thus making option A correct. Additionally, the 'ON COMMIT PRESERVE ROWS' setting ensures that the rows are only deleted at the end of the session, not upon commit. Thus, when the session terminates, the rows will be deleted, making option E correct.
1. CREATE GLOBAL TEMPORARY TABLE my_temp_table ( id NUMBER, description VARCHAR2(20) ) ON COMMIT PRESERVE ROWS 2. INSERT INTO my_temp_table VALUES (1, 'ONE'); 3. Commit; 4. ALTER TABLE my_temp_table ADD ID_1 VARCHAR(20); --> ORA-14450: attempt to access a transactional temp table already in use 5. drop table my_temp_table; --> ORA-14452: attempt to create, alter or drop an index on temporary table already in use 6. truncate table my_temp_table; 7. drop table my_temp_table;
thats correct
Based on your explanation, A is a valid answer?
Here is an example of the differences between session-specific and transaction-specific GTT with comments: drop table temp1 purge; CREATE GLOBAL TEMPORARY TABLE temp1( id INT, description VARCHAR2(100) ) ON COMMIT DELETE ROWS; INSERT INTO temp1(id,description) VALUES(1,'Transaction specific global temp table'); SELECT id, description FROM temp1; -- 1 row is there commit; SELECT id, description FROM temp1; -- row is gone after the transaction ALTER TABLE temp1 Add ID_1 char(20); -- will add column after commit because it is transaction specific drop table temp1; CREATE GLOBAL TEMPORARY TABLE temp2( id INT, description VARCHAR2(100) ) ON COMMIT PRESERVE ROWS; INSERT INTO temp2(id,description) VALUES(1,'Session specific global temp table'); SELECT id, description FROM temp2; --1 row is there commit; SELECT id, description FROM temp2; -- 1 row is still there ALTER TABLE temp2 Add ID_1 char(20); --will not work with or without commit after INSERT. It's in session drop table temp2; -- won't work. session specific truncate table temp2; drop table temp2; -- now it works
You cant add an fk to a temporary table. Can't refer to it and cannot refer to another table from the temporary table. Tried it out!
DDL operation on global temporary tables It is not possible to perform a DDL operation (except TRUNCATE) on an existing global temporary table if one or more sessions are currently bound to that table.
for me , correct are A. To drop the table in this session, you must first truncate it. E. When you terminate your session, the row will be deleted.
The answers are AB. C- false. You CAN'T add a column, and the rows are preserved. D-false. You CAN"T add a foreign key to a temp table. E-false. Rows are preserved.
At least in 23c C and E are correct. I haven't faced any error when adding a column, so C correct I could drop the table without truncating it first -- A incorrect
A and E, test in 19c. C in the session error ORA 14450 attempt to access a transactional temp table already in use, FIRST end session and add column, but no in the same session
You get the following error if you don't truncate table invoices_gtt drop table invoices_gtt Error report: SQL Error: ORA-14452: attempt to create, alter or drop an index on temporary table already in use 14452. 00000 - "attempt to create, alter or drop an index on temporary table already in use" *Cause: An attempt was made to create, alter or drop an index on temporary table which is already in use. *Action: All the sessions using the session-specific temporary table have to truncate table and all the transactions using transaction specific temporary table have to end their transactions.
Should be A and E tried it out
why is C wrong? google tells me its possible 'A temporary table can be altered in the same way as a permanent base table although there is no official support to toggle the behavior of the ON COMMIT clause.' -some article
AE is the answer
A is correct ,you can try execute the sql ,and you would get the err msg:ORA-03290 E is correct,when you terminate your session,the row will be deleted,you can try it.
I think A and E are correct. You have a row inserted, so first you have to truncate the table in order to drop it. When you end the session, the table will be dropped, what it means that the row will be also deleted. Please correct me if I am wrong.