Tagged: sql


Run SQL Code Block with Variables in Oracle SQL Developer

DECLARE p_cart_id NUMBER:= 125330; p_cart_item_id NUMBER; BEGIN FOR i IN 1..200 LOOP — get next sequence p_cart_item_id := tbl_cart_item.NEXTVAL;   –insert new line from select INSERT INTO TBL_CART_ITEM(cart_item_id,cart_id,item,qty, line_no) SELECT t.* FROM ( SELECT...



INSTEAD OF DELETE triggers can be defined on a view or table to replace the standard action of the DELETE statement. Usually, the INSTEAD OF DELETE trigger is defined on a view to modify data in one or more base tables.


Shrink log size in sql database

To shrink the file size I use the following script: Use DBName Go exec sp_dboption DBName, ‘trunc. log on chkpt.’, true checkpoint DBCC SHRINKFILE (N’DBNameFileName, 0); exec sp_dboption DBName, ‘trunc. log on chkpt.’, false