To get started let's do the following: DECLARE @name VARCHAR(50) -- database name DECLARE @path VARCHAR(256) -- path for backup files DECLARE @file Name VARCHAR(256) -- filename for backup DECLARE @file Date VARCHAR(20) -- used for file name SET @path = 'C:\Backup\' SELECT @file Date = CONVERT(VARCHAR(20), GETDATE(),112) DECLARE db_cursor CURSOR FOR SELECT name FROM sysdatabases WHERE name NOT IN ('master','model','msdb','tempdb') OPEN db_cursor FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0 BEGIN SET @file Name = @path @name '_' @file Date '.It is beyond the scope of this book to provide complete reference information about the features of DML statements in the Oracle SQL language.The Closing a cursor instructs Oracle to release allocated memory at an appropriate time.If you declare a cursor in an anonymous block procedure, or function block, the cursor will automatically close when the block terminates.I know cursors exist but I am not sure how to use them. In some circles cursors are never used, in others they are a last resort and in other groups they are used regularly.
The following illustration shows the execution cycle of an explicit cursor: Let’s examine each step in detail.
However, you must explicitly close package-based cursors.
PL/SQL and SQL both are incredibly powerful languages that allow us to do some pretty amazing things with data.
The results are rather interesting: The PL/SQL block out-performed both of the updates and was nearly on par with the MERGE statement, even in an ideal world. I think it is a reminder that we should be both aware of and willing to explore all of our options as developers.
PL/SQL has the ability to work very efficiently for you if you understand what is available within the language.