A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.
Global temporary tables (created with a double “##”) are visible to all sessions. You should always check for existence of the global temporary table before creating it… if it already exists, then you will get a duplicate object error.
Global temporary tables are dropped when the session that created it ends, and all other sessions have stopped referencing it.
Asked In: Many Interviews |