Some problems occurred when using ORACLE in the actual project. The problem is avoided through the work und. I wrote this article to make it easy to use!
1. ORA-01403: no data found-NO DATA FOUND
A. Add an exception to handle the exception.
Exception when NO_DATA_FOUND THEN...
B. Use count to calculate whether the value is greater than 0, that is, whether there is a value. If there is no value, 0 is returned instead of NULL.
Select count (*) into field from table where...
2. ORA-01704: string literal too long-text STRING is TOO LONG
This error message is displayed when you INSERT a long-byte field CONTEXT to ORACLE using a statement similar to insert into table (ID, CONTEXT) VALUES ('1 ','... ').
A. parameters can be used in the program.
C # code
1 OracleConnection ocon = new OracleConnection ();
2 OracleCommand ocom = new OracleCommand (SQL, ocon );
3 ocom. Connection. Open ();
4 ocom. Parameters. Add (": Value", OracleType. Blob );
5 ocom. Parameters [": Value"]. Value = longvalue;
6 ocom. ExecuteNonQuery ();
B. It is relatively simple to use stored procedures, as long as the parameters are passed in.
DECLARE
V_context CLOB: = 'long context ';
BEGIN
Insert into table (ID, CONTEXT) VALUES ('1',: v_context );
END;
Agoni 2010-04-10