Menu

Showing posts with label SQL Tutorial. Show all posts
Showing posts with label SQL Tutorial. Show all posts

Cursor in PLSQL

 The cursor is a private work area for an SQL statement, when the SQL statement is executed in PL/SQL block, the Oracle engine assigns a private work area for that statement. The cursor stores the statement and result after execution.

There are two types of Cursor implicit cursor and explicit cursor.

Example of Implicit Cursor

DECLARE

    var datatype

BEGIN

    select * from table; // Your SQL statement

END;


Example of Explicit Cursor

DECLARE

             CURSOR cursor_name is

                select * from table;    // Your SQL statement 

BEGIN

    OPEN cursor_name; 

        FETCH cursor_name  // Your SQL statement

            CLOSE cursor_name; 

END;


Reference

 Cursor overview | Oracle Doc

SQL queries to perform CURD operations

Standard Query Language is frequently referred to as SQL queries are the statement to create, update and delete the records from the database table in SQL and NoSQL database.

Let's understand the different types of queries that we use to perform operations in the database table. 


SELECT * FROM "user"
WHERE enabled = 'false'


SELECT * FROM "user"
WHERE email IN ('yumfawa48@gmail.com','rashid.jorvee@gmail.com')


UPDATE "user"
SET enabled='true'
WHERE id='sql-tutorial'