Results 1 to 6 of 6

Thread: Delete from TABLE using Comma Separted Values + ORACLE

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Delete from TABLE using Comma Separted Values + ORACLE

    I have three records in table with roll numbers 1,2,3.

    I want to delete the records from the table using C#.
    Code:
    protected void Button1_Click(object sender, EventArgs e)
        {
            string sRollNos="";
            for (int i = 1; i <= 3; i++)
            {
                if (sRollNos == "")
                {
                    sRollNos = i.ToString ();
                }
                else
                    sRollNos = sRollNos + "," + i;
            }
    
            OracleCommand cmd = new OracleCommand("USP_DEL_TBL_STUDENT_DATA", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@p_ROLL",sRollNos );
    
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.ExecuteNonQuery();
        }
    I am getting the error-
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 1.

    Roll column datatype is Number.

    Stored Procedure-
    Code:
    create or replace
    PROCEDURE           "USP_DEL_TBL_STUDENT_DATA"
    (
    p_ROLL IN TBL_STUDENT.ROLL%TYPE
    ) AS
    BEGIN
      DELETE FROM TBL_STUDENT where roll in (p_roll);
      end;
    Can somebody help me out!!!
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width