다음 Oracle 오류가 발생합니다.
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'INSERT_CATEGORY'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
이 오류를 읽었으며 사람들은 저장 프로 시저 유형에 다른 값 유형을 전달하면이 오류가 발생할 수 있지만 저에게는 그렇지 않은 것 같습니다.
내 코딩의 대부분은 내가 가진 것과 거의 동일합니다. 이것과의 유일한 차이점은 부울을 사용하고 있으므로 문제가 발생하는지 확실하지 않습니다.
Protected Sub BtnNew_Click(sender As Object, e As EventArgs) Handles BtnNew.Click
Dim conn As OleDbConnection = New OleDbConnection("Provider=""*******"";user id=" & strUserID & ";data source=" & strDatabase & ";password=" & strPssWd)
If Page.IsValid Then
If CatText.Text <> "" Then
Dim ClassifiedStr As New OleDbCommand
ClassifiedStr.CommandType = CommandType.StoredProcedure
'name of stored procedure = 'insert_category'
ClassifiedStr.CommandText = "insert_category"
ClassifiedStr.Connection = conn
'Must be organized based on Stored Procedure
ClassifiedStr.Parameters.Add("val_category", OleDbType.VarChar, 40).Value = CatText.Text
conn.Open()
'Makes sure the Category doesn't already exist****************
Dim myParm As OleDbParameter = ClassifiedStr.Parameters.Add("val_newcat", OleDbType.Boolean)
myParm.Direction = ParameterDirection.Output
ClassifiedStr.ExecuteNonQuery()
'myParm needs Execute
Dim standardid As Integer = myParm.Value
'***********************************************
If standardid = False Then
conn.Close()
Response.Write("<script language=""javascript"">alert('Thanks! Record Has Been Added.');</script>")
Response.Redirect("DisplayCategories.aspx")
Else
Response.Write("<script language=""javascript"">alert('Sorry! Record Already Exist.');</script>")
Exit Sub
End If
Else
Response.Write("<script language=""javascript"">alert('You must insert a record.');</script>")
Exit Sub
End If
End If
End Sub
저장 프로 시저
CREATE OR REPLACE PROCEDURE insert_category
(val_category TABLENAME.Category%type,
val_newcat out boolean)
as num_catid number;
begin
select category_seq.nextval into num_catid from dual;
INSERT INTO TABLENAME
(select num_catid, val_category from TABLENAME WHERE Category != val_Category);
commit;
val_newcat := SQL%FOUND;
end;
문제를 해결 한 업데이트 :
Dim ClassifiedStr As New OleDbCommand
ClassifiedStr.CommandType = CommandType.StoredProcedure
'name of stored procedure = 'insert_category'
ClassifiedStr.CommandText = "insert_category"
ClassifiedStr.Connection = conn
'Must be organized based on Stored Procedure
ClassifiedStr.Parameters.Add("val_category", OleDbType.VarChar, 40).Value = CatText.Text
conn.Open()
'Makes sure the Category doesn't already exist
Dim myParm As OleDbParameter = ClassifiedStr.Parameters.Add("val_newcat", OleDbType.VarChar, 10)
myParm.Direction = ParameterDirection.Output
ClassifiedStr.ExecuteNonQuery()
'myParm needs Execute before declared
Dim standardid As String = myParm.Value
'***********************************************
If standardid = "TRUE" Then
conn.Close()
etc....
저장 프로 시저 :
(val_category t_category.Category%type,
val_newcat out varchar2)
as num_catid number;
begin
select newCategory_seq.nextval into num_catid from dual;
INSERT INTO TABLENAME
select num_catid, val_category from dual WHERE not exists (select * from TABLENAME where Category = val_Category);
val_newcat := case SQL%FOUND when TRUE then 'TRUE' else 'FALSE' end;
commit;
end;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다