Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m getting the following error in my application

VB
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'DELETE_SUPPLIERDETAILS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


I understand like this is happening due to the datetime field that is being use.. can anyone let me know how can format the field in this format passing it in a string format.

Here is my code below

C#
protected void gdvData_RowCommand(object sender, GridViewCommandEventArgs e)
       {
       InBoundDataBO obj = new InBoundDataBO();
       if (e.CommandName == "Delete")
       {

           int index = int.Parse(e.CommandArgument.ToString());
           GridViewRow row = gdvData.Rows[index];
           string SOURCE_ENTITY = (row.Cells[2].Text.ToString());
           string PLANT_CODE = (row.Cells[3].Text.ToString());
           string SUPPLIER_NUMBER = (row.Cells[4].Text.ToString());
           int SUPPLIER_GROUP_NUMBER = Convert.ToInt32(row.Cells[5].Text.ToString());
           DateTime LOAD_DATE = Convert.ToDateTime(row.Cells[6].Text.ToString());
           DateTime LAST_UPDATED_DATETIME = Convert.ToDateTime(row.Cells[7].Text.ToString());
           string message = string.Empty;
           int x = obj.DeleteSupplierDetails(SOURCE_ENTITY, PLANT_CODE, SUPPLIER_NUMBER, SUPPLIER_GROUP_NUMBER, LOAD_DATE, LAST_UPDATED_DATETIME, out message);


LOAD_DATE and LAST_UPDATED_DATETIME are the Date time fields in this case

OR any other idea to get rid of this error is welcome
Posted
Updated 18-Aug-13 22:01pm
v2
Comments
Garth J Lancaster 19-Aug-13 4:10am    
dude - you'd have to show us the code for DeleteSupplierDetails AND the schema for the table for us to be able to figure this out - we're not magiciains, we cant see what's on your machine
Rock_Dead 19-Aug-13 7:11am    
public int DeleteSupplierDetails(string SourceEntity, string PlantCode, string SupplierNumber, int SupplierGroupNumber, String LoadDate, String LastUpdatedDateTime, out string message)
{
message = string.Empty;
Database db = Helper.CreateDatabase();

DbCommand cmd = db.GetStoredProcCommand("PDSS_STAGING_DEV.Delete_SupplierDetails");
cmd.CommandType = CommandType.StoredProcedure;


db.AddInParameter(cmd, "P_SOURCE_ENTITY", DbType.AnsiString, SourceEntity);
db.AddInParameter(cmd, "P_PLANT_CODE", DbType.AnsiString, PlantCode);
db.AddInParameter(cmd, "P_SUPPLIER_NUMBER", DbType.AnsiString, SupplierNumber);
db.AddInParameter(cmd, "P_SUPPLIER_GROUP_NUMBER", DbType.Int32, SupplierGroupNumber);
db.AddInParameter(cmd, "P_LOAD_DATE", DbType.AnsiString, Convert.ToDateTime(LoadDate));
db.AddInParameter(cmd, "P_LAST_UPDATED_DATE_TIME", DbType.AnsiString, Convert.ToDateTime(LastUpdatedDateTime));
db.AddOutParameter(cmd, "P_RETURN_MSG", DbType.String, 100);
int rows=db.ExecuteNonQuery(cmd);
message = cmd.Parameters["P_RETURN_MSG"].Value.ToString().Trim();
return rows;
}

STORED PROCEDURE

CREATE OR REPLACE PROCEDURE PDSS_STAGING_DEV.Delete_SupplierDetails (
P_SOURCE_ENTITY IN varchar2,
P_PLANT_CODE IN varchar2,
P_SUPPLIER_NUMBER IN varchar2,
P_SUPPLIER_GROUP_NUMBER IN varchar2,
P_LOAD_DATE IN Date,
P_LAST_UPDATED_DATETIME IN Date,
P_RETURN_MSG OUT varchar2
)
IS
BEGIN
DELETE FROM SUPPLIER_ERROR_LOG
WHERE SOURCE_ENTITY = P_SOURCE_ENTITY
AND PLANT_CODE = P_PLANT_CODE
AND SUPPLIER_NUMBER = P_SUPPLIER_NUMBER
AND SUPPLIER_GROUP_NUMBER = P_SUPPLIER_GROUP_NUMBER
AND to_char(LOAD_DATE,'DD/MON/YYYY') = to_char(P_LOAD_DATE,'DD-MON-YYYY HH:MN:SS')
AND to_char(LAST_UPDATED_DATETIME,'DD/MON/YYYY HH:MN:SS') = to_char(P_LAST_UPDATED_DATETIME,'DD-MON-YYYY');

COMMIT;
P_RETURN_MSG := 'SUCCESSFULLY DELETED';
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
P_RETURN_MSG := 'UNEXPECTED EXPECTION FOUND';
raise_application_error (-20185, SUBSTR (SQLERRM, 1, 250));
END Delete_SupplierDetails;


1 solution

ok, lets start with the obvious

here

DateTime LOAD_DATE = Convert.ToDateTime(row.Cells[6].Text.ToString());
            DateTime LAST_UPDATED_DATETIME = Convert.ToDateTime(row.Cells[7].Text.ToString());
            string message = string.Empty;
            int x = obj.DeleteSupplierDetails(SOURCE_ENTITY, PLANT_CODE, SUPPLIER_NUMBER, SUPPLIER_GROUP_NUMBER, LOAD_DATE, LAST_UPDATED_DATETIME, out message);


LOAD_DATE
LAST_UPDATED_DATETIME

Are DateTime

Whereas here

public int DeleteSupplierDetails(string SourceEntity, string PlantCode, string SupplierNumber, int SupplierGroupNumber, String LoadDate, String LastUpdatedDateTime, out string message)


LoadDate and LastUpdatedDateTime are String
 
Share this answer
 
Comments
Rock_Dead 20-Aug-13 3:37am    
I am passing it as a string and then converting it to Date Time
Garth J Lancaster 20-Aug-13 6:26am    
but thats not what your code says your doing - it may be what you think you're doing ..

ok, let me put it a different way .. if what you say is correct, then in gdvData_RowCommand

this

DateTime LOAD_DATE = Convert.ToDateTime(row.Cells[6].Text.ToString());
DateTime LAST_UPDATED_DATETIME = Convert.ToDateTime(row.Cells[7].Text.ToString());

should be

String LOAD_DATE = row.Cells[6].Text.ToString();
String LAST_UPDATED_DATETIME = row.Cells[7].Text.ToString();

shouldnt it ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900