Home > database >  Consult query ORACLE statement in c #,
Consult query ORACLE statement in c #,

Time:10-04

The select FTEMP FPRECP, FWS10 FWD10, FRH, FVAPOR the from name of the table where (FSTATIONNUM='odr. GetOracleString (0). The ToString ()' and (FOBSTIME=to_date (' strdate ', '- dd yyyy - mm hh24: mi: ss')))
Prompt error: ORA - 01841: (complete) year value must be between 4713 and 9999, and not to 0
For the following so that you can
Select FTEMP FPRECP, FWS10 FWD10, FRH, FVAPOR the from name of the table where (FSTATIONNUM='11111' and FOBSTIME=to_date (' 11:00:00 2016-11-29 ', '- dd yyyy - mm hh24: mi: ss'))
Why couldn't I use a variable?
And variables and single quotes I tip: ORA - 01841: (complete) year value must be between 4713 and 9999, and not to 0
Tip: without single identifier is invalid

CodePudding user response:

According to your this kind of variable name directly spliced into SQL, he will think that this is your computing (or more) value,

It is recommended to use bind variables in the form of!

CodePudding user response:

SQL=
 String String. Format (" select FTEMP, FPRECP, FWS10, FWD10, FRH, FVAPOR from table name "+ 
"Where (FSTATIONNUM='{0}'" +
"And (FOBSTIME=to_date (' {1} ', '- dd yyyy - mm hh24: mi: ss')))",
The odr. GetOracleString (0). The ToString (),
Strdate);

CodePudding user response:

The odr. GetOracleString (0). The ToString () such a variable in c #, oracle SQL incognizant,
After add single quotes, belongs to the constant, time is not a valid format
Adopt the method of the second floor can!

CodePudding user response:

Learn!!!!