Untitled

mail@pastecode.io avatar
unknown
html
7 months ago
7.2 kB
2
Indexable
Never
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>cursor for shraavniii</title>
</head>

<body>
    <h1>cursors</h1>
    <p>
        oi mndaduuu aik cursors in plsql mnje basically aapn cursor vaprun aplya output la change kru shkto indivisually
        mnje cursor vaprun normal query cha tuza output yeil multiple rows mg nantr tu prtek row mdhe jau shakshil ani
        khi change kraycha asel tr to kru shkshil mnje output yeil mg tu prtek ek ek row access kru shkashil mnje tuza
        cursor tithe jat jail
        <br><br>
        ata smj tu ekhada form bhrteys tr first name bharun zal ki tu enter dabls ki tuza cursor middle name kde jail
        (cursor mnje access) tuza 2nd row mdhe jail mg tithe middle name bharls ki last name mnje prtek row mdhe tuza
        access jatoy by using cursor tu indivisualy row update kru shakshil
        <br><br>
        ata smj aapli ji normal query aste for ex (select ename, salary from emp;) yacha output mdhe ename ani tyanchi
        salary eksath tablular form mdhe yeil na ata smj tula asa task dila ki sglyanchi salary 10% ne increase kraychi
        ahe tr tu ti karu shakshil normal query ne pn jr asa task dila ki 1kachi salary 10% ne 2ryachi 40% ne 3ryachi
        34% ne
        <br><br>
        asa tu normal query ne nhi na kru shkt karn prtekachi salary increment cha % vegla ahe
        <br><br>
        pn tu cursor vaprun kru shakshil cursor vaprlas ki output show hoil tya normal query cha pn to final nsel output
        show zalyavr tuza cursor prtek row vr jail mg tula update kraych tr kru shktes prtek row mnje tula prtek row cha
        access milel normal query ne tu eksath change kru shkshil pn 1ch condition lavta yeil
        <br><br>
        pn cursor vaprun tuza semi final output alyavr tu each row la vegli condition lavu shkshil mg sglyanvr
        operations perform krun zalyavr tu to semifinal output save krun final output mdhe display kru shakshil
        <br><br>
        ata real life example detoy te try kr smjaych mndade ata smj ekhadi brick chi wall ahe(whole table) 100 rows
        ahet bricks chya tya wall mdhe (mnje rows)
        <br>
        tula sglyana white paint kraych ahe tr tu to roller asto to white paint mdhe dip krun sglya wall la paint krshil
        mnje sglya 100 rows paint hotil pn fkt white colour ne colour (mnje condition) he relate kr normal query la mnje
        update colour by white
        <br>
        pn tula asa kraychy ki prtek row veg veglya colour ne paint kraychi ahe tr tu te roller vaprun nhi na kru shkt
        tula brush vaprava lagel (mnje cursor) ani veg vegle colours lagtil (mnje conditions) tu brush vaprun prtek row
        la veg vegla manasrakha paint deu shktes mnje by using cursor uh can manipulate each row with different
        conditions
        <br><br><br>
        ata khali aplya tya pdf mdhl anser ahe 1le red line vach mg prt ithe vach ha tr cursor is a pointer that points
        that points to the results set of the SQL query mnje cursor ek asa pointer ahe jo output mdhlya result kde point
        krto
        <br>
        Cursor is a work area in PL/SQL which is used by sql server used to store the result of a query. mnje cursor
        vaprla ki tu prtek row vr khi operation kru shkshil na mnje work kru shkshil mhnun cursor la workspace mthl ahe
        space where you can work/modify/operate
        <br><br>
        ata khalchi blue line vach mnd 1le mg prt ithe vach ha tr
        <br>
        Each column value is pointed using pointer. You can immediately manipulate cursor values mnje cursor ne each
        value of colum is pointed ani tu ti each value lgech manipulate mnje modify kru shkshil
        <br>
        At first a cursor consisting of query result is created in server….now the cursor is transferred to the client
        where again cursor is created and hence the result is displayed. mnje jeva tu konti query run krshil tr server
        tyacha output eka cursor mdhe store krel ani mg te client side kde display krel (At first a cursor consisting of
        query result is created in server….now the cursor is transferred to the client where again cursor is created and
        hence the result is displayed.~chatgpt)
        <br><br>
        ata khalchi green line vach 1le mg prt ithe vach ha tr
        <br>
        A cursor is a mechanism by which we can assign a name to a “SELECT statements” and manipulate the information within that SQL statements. mnje cursor ne tu select statement la ek nav assign kru shktes he asa nhi smjnar he code example bgh 
        <br><br>
        CURSOR emp_cursor IS<br>
        SELECT employee_id, salary, performance_rating FROM employees 
        <br><br>
        ithe select statement la emp_cursor IS he nav dila ahes ha syntax ahe creating a cursor cha purn code ahe sglyat last la mndade 
        <br><br>
        ata last point black mdhla implicit ani explicit mnje evd nit mla pn nhi mhiti ahe pn jevd mhitiy tevd sangto mndadu implicit mnje jo defaultly bnto ani explicit mnje jo aapn bnvto asa chat gpt vr vachl mi mnd tyach khi jast explaination nhi lihil tri chalel mndadu 
        <br><br>
        3.What is Cursor? How to create it?Explain with example

    <p style="color:red;"> 1) PL/SQL cursor is a pointer that points that points to the results set
        of the SQL query against database table. Cursor is a work area in
        PL/SQL which is used by sql server used to store the result of a
        query.
    </p>
    <p style="color:blue;">2) Each column value is pointed using pointer. You can immediately manipulate cursor values.
        A bit about each its working, suppose you ask for a query stored in the server. At first a cursor consisting of
        query result is created in server….now the cursor is transferred to the client where again cursor is created and
        hence the result is displayed.
    </p>
    <p style="color:green;">3) A cursor is a mechanism by which we can assign a name to a “SELECT statements” and
        manipulate the information within that SQL statements.
    </p>
    4) There are two kinds of cursors :
    <br>
    Implicit
    <br>
    Explicit
    <br><br>
    ha ghe cursor cha basic code mndade
    <br><br>
    DECLARE<br>
    CURSOR emp_cursor IS<br>
      SELECT employee_id, salary, performance_rating FROM employees;<br>
    v_employee_id employees.employee_id%TYPE;<br>
    v_salary employees.salary%TYPE;<br>
    v_performance_rating employees.performance_rating%TYPE;<br>
BEGIN<br>
    OPEN emp_cursor;<br>
    LOOP<br>
        FETCH emp_cursor INTO v_employee_id, v_salary, v_performance_rating;<br>
        EXIT WHEN emp_cursor%NOTFOUND;<br>
<br>
        IF v_performance_rating = 'Excellent' THEN<br>
            v_salary := v_salary * 1.10;<br>
        ELSIF v_performance_rating = 'Good' THEN<br>
            v_salary := v_salary * 1.05;<br>
        END IF;<br>
<br>
        -- Update the salary in the database<br>
        UPDATE employees<br>
        SET salary = v_salary<br>
        WHERE employee_id = v_employee_id;<br>
    END LOOP;<br>
    CLOSE emp_cursor;<br>
END;<br>
<br>
    </p>
</body>
Leave a Comment