Urgent............Plzzzzzz help me in dis

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jenipriya
    New Member
    • Jul 2007
    • 14

    Urgent............Plzzzzzz help me in dis

    Hw to insert a row using %RowType attributes and how to display the noof leaves taken by an employee for a given month?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    TRY THE SAMPLE CODE
    =============== =========
    [CODE=ORACLE]
    declare
    var1 dept%rowtype;
    begin
    var1.deptno:=90 ;
    var1.dname:='DE BASIS';
    var1.loc:='HYD' ;
    INSERT INTO DEPT VALUES VAR1;
    COMMIT;
    END;[/CODE]

    Hope that helps you

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      With version 8.1 and lower you must reference every column by name in the
      insert statement value clause:
      values (vrow.col1, vrow.col2, ....)

      With version 9 you can insert a rowtype as a single statement as with
      "values rowtype". Notice no parenthesis around the rowtype variable.

      This is a 9.2 feature
      The correct syntax is: INSERT INTO MYTABLE VALUES vRow;

      Comment

      • jenipriya
        New Member
        • Jul 2007
        • 14

        #4
        Originally posted by debasisdas
        TRY THE SAMPLE CODE
        =============== =========
        [CODE=ORACLE]
        declare
        var1 dept%rowtype;
        begin
        var1.deptno:=90 ;
        var1.dname:='DE BASIS';
        var1.loc:='HYD' ;
        INSERT INTO DEPT VALUES VAR1;
        COMMIT;
        END;[/CODE]

        Hope that helps you
        Thanks for the code... I got it

        Comment

        • jenipriya
          New Member
          • Jul 2007
          • 14

          #5
          Originally posted by debasisdas
          With version 8.1 and lower you must reference every column by name in the
          insert statement value clause:
          values (vrow.col1, vrow.col2, ....)

          With version 9 you can insert a rowtype as a single statement as with
          "values rowtype". Notice no parenthesis around the rowtype variable.

          This is a 9.2 feature
          The correct syntax is: INSERT INTO MYTABLE VALUES vRow;
          could u please explain this bcoz i m a fresher and i don get u

          Comment

          • jenipriya
            New Member
            • Jul 2007
            • 14

            #6
            Could u help me in dis? To display the no of leaves taken by an employee for a given month how to write a query?
            can v giv sysdate-date of leave?

            Comment

            Working...