Error in insert values query.
String query = "INSERT INTO Students(STUDENTID,FIRSTNAME,LASTNAME,PARENTSNAMES,ADDRESS,CITY,STATE,POSTALCODE,PHONENUMBER,EMAILNAME,MAJOR,STUDENTNUMBER,NOTES) "+"VALUES (1,'john','David','Mr.David livingstone','1/369gandhi street','chennai','tn',600037,56690397,'[email protected]','ECE',3,'GOOD')";
I want to insert a row in the table students in MS Access.
Iam able to access the table using update and select queries but unable to insert rows.
I get a error as follows:
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6908)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3065)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
can anyone help me?
Regards.
Use system.out.println(query) to print out your sql String. Then copy/paste your sql into Microsoft Access and execute the SQL there and see if you get an error. If you do, it won't be a general error, it will probably be a more specific error. I would worry about the / in your query String, and no space between before VALUES, but I'm not a human parser so it's better to let a machine handle it. Better still, you might want to try a using a PreparedStatement which handles escape syntax for you.
Similar Messages
-
Error while inserting value Qualified field in the main table
Hello,
I am trying to populate Qualified field in the main table when a new record is inserted in the Products Repository.
The field is Reference Price and its a qualified lookup field. I am using the below code to create qualified lookup value and create qualified link values.
QualifiedLookupValue qlvRefPrice = new QualifiedLookupValue();
TableId qltabid = repSchema.getTableId("ReferencePrices");
FieldId qlfieldid = repSchema.getFieldId("ReferencePrices","RP_ReferncePrices");
RecordId rdRefPrice = getRecordId(connPool,session,"RP",qlfieldid,qltabid);
HashMap map = new HashMap();
map.put(repSchema.getFieldId("ReferencePrices","StartDate_ReferencePrice"),new DateTimeValue(cal));
map.put(repSchema.getFieldId("ReferencePrices","EndDate_ReferencePrice"),new DateTimeValue(cal));
map.put(repSchema.getFieldId("ReferencePrices","ListPrice"),new FloatValue(Float.parseFloat("123.3")));
map.put(repSchema.getFieldId("ReferencePrices","Currency"),new LookupValue(getLookupRecordId(connPool,session,"Currencies","Currency_Currencies","EUR")));
QualifiedLinkValue qlvLinkValue = MdmValueFactory.createQualifiedLinkValue(rdRefPrice,map);
qlvRefPrice.addValue(qlvLinkValue);
emptyRecord.setFieldValue(fieldIdRefPriceHistory,qlvRefPrice);
However when the createrecord command is executed I get the following error.
java.lang.RuntimeException: No matching validation Id 97. at com.sap.mdm.internal.validation.ValidationInfoHelper.retrieveValidations(ValidationInfoHelper.java:71) at com.sap.mdm.data.commands.CreateRecordCommand.execute(CreateRecordCommand.java:246) at com.alcatel_lucent.productdetail.ProductItemDetail_Comp.createProduct(ProductItemDetail_Comp.java:2927) at com.alcatel_lucent.productdetail.wdp.InternalProductItemDetail_Comp.createProduct(InternalProductItemDetail_Comp.java:656) at com.alcatel_lucent.productdetail.ProductItemAddView.onActionSave(ProductItemAddView.java:971) at com.alcatel_lucent.productdetail.wdp.InternalProductItemAddView.wdInvokeEventHandler(InternalProductItemAddView.java:662) at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87) at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132) at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335) at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143) at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:332) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:761) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:696) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253) at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149) at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73) at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:869) at com.sap.tc.webdynpro.portal.pb.impl.localwd.LocalApplicationProxy.sendDataAndProcessAction(LocalApplicationProxy.java:77) at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1356) at com.sap.portal.pb.PageBuilder.SendDataAndProcessAction(PageBuilder.java:327) at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:869) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136) at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335) at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143) at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:332) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:741) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:694) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253) at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149) at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62) at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039) at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:219) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
I spoke to my MDM team and they say there is no validation which they have put for Reference Price field. I have tried inserting values in another field of type qualified lookup in the same main table and that works without any issue.
The code is as below:
QualifiedLookupValue qlvRating = new QualifiedLookupValue();
TableId qlvtable = repSchema.getTableId("ProductRatings");
FieldId qlvratinglink = repSchema.getFieldId("ProductRatings","RatingLink");
RecordId rdidPR = getRecordId(connPool,session,"CI",qlvratinglink,qlvtable);
wdComponentAPI.getMessageManager().reportSuccess("rdidPR "+rdidPR);
HashMap mapPR = new HashMap();
mapPR.put(repSchema.getFieldId("ProductRatings","AvailRating"),new LookupValue(getLookupRecordId(connPool,session,"AvailabilityRatings","AvailabilityRating_AvailabilityRatings","CI")));
mapPR.put(repSchema.getFieldId("ProductRatings","EffectiveDate"),new DateTimeValue(cal));
mapPR.put(repSchema.getFieldId("ProductRatings","FERAIndic"),new LookupValue(getLookupRecordId(connPool,session,"ReplacementIndicators","Code","FE")));
mapPR.put(repSchema.getFieldId("ProductRatings","FERAOrdItem"),new LookupValue(getLookupRecordId(connPool,session,"ReplProducts","ProdID","100008200")));
QualifiedLinkValue qlvLink = MdmValueFactory.createQualifiedLinkValue(rdidPR,mapPR);
qlvRating.addValue(qlvLink);
emptyRecord.setFieldValue(fieldIdRatingHistory,qlvRating);
I would really appreciate if someone can help in solving the issue.
Thanks in advance,
AamodHi Aamod,
Sees that some validation/assignments are getting triggered as soon as you make changes to the record in MDM. Please check once after removing validations/workflow that you may have. This way you may debug the issue.
Hope this helps!!
Cheers,
Arafat -
Error When inserting Content Query Web part onto the page
i am using share point 2010 and when i am trying to insert content query web part onto the page i am getting the following error
i checked the correlation id in the logs file but could not find anything useful in it.
please suggest why this problem occuring everytime when i try to insert content query webpart onto the pageHi,
Check the correlation id in your logging files are the best way to investigate.
Did you check these files with "SharePoint ULS Log viewer". Maybe, that will be more easy for you to get the correlation Id.
Moreover, check the account's permissions with which you try to insert your webpart.
Regards.
Gilles Martinez
Twitter
Blog
Please mark as helpful/answer if this resolved your post -
ORA-20001:Error fetching column value:Query must begin with SELECT or WITH
Hi all,
I have implemented an application with a master-detail form using Apex 3.1.2 and I imported that to Apex 3.2 on different server. Everything else seems to be fine except when I add detail record (clicking on Add Rows), I am getting following error.
=================
report error:
ORA-20001: Error fetching column value: ORA-20001: Query must begin with SELECT or WITH
====================
Both the databases have same version 10gR2. I didn't make any change after importing it as well. Can someone let me know what could be the issue? Thanks in advance.
SHYMay we know your first name?
Can you put the application in your workspace on apex.oracle.com so we can take a look?
Scott -
ERROR in inserting values in table PL/SQL code
Hello Friends,
I am facing a peculiar logical error in my PL/SQL code. PFB the code for your reference -
for k in (select account_no from mirror_lookup_accnt_hierarchy where mdate = sys_date) LOOP
dbms_output.put_line(' SYSDATE :!! '||sys_date||' '||k.account_no);
insert into sfdc_account select * from mirror_sfdc_account where sap_account_id__c=k.account_no;
commit;
end loop;
Just to elaborate on the code functionality......
The outer FOR loop on the table has the records in the order i want to populate in the final sfdc_account table.
Now, i compare the account_no of the table mirror_sfdc_account table with the account_no of the FOR LOOP and INSERT that record in the final sfdc_account table. So, it is entered according to the order i want to have.
The problem is, this code runs fine for the first time, but then on it does not popuate the values in the right order according to the FOR LOOP values.
I have tried deleting data and running again, but the error persists. It enters the records but NOT IN ORDER according to the condition i have given!!
Kindly Help.....what can be the problem!!
Thanks and Regards,Hi friend,
The thing is that we need to populate the final
table based on a hierarchy,the relation between
parent and child fieldNo. The thing is.... that Oracle is a relational database. That means that the data is stored in a relational manner, not in an ordered manner, such as you get with COBOL and it's flat file format.
You CANNOT rely on the database to store data in an ordered manner.
If you require the data in some sort of order when you retrieve it then you MUST store information against the data which can be used to determine that order and you MUST specify an ORDER BY clause on your query that retrieves the data.
Internally Oracle will not maintain the order of the data for you automatically.
This is a simple truth. -
Hai all,
Am writing a validation for my salary attribute in my entity object this is my
Valiation code while am running my cod am getting a error as follows
(oracle.job.SQLStmtException) JBO-27121:SQL error during statement execution
Statement: BEGIN :1=JOB_VALIDATION(:2,:3); END;
(java.sql.SQLExcepation) Invalid column Type
My Function is as Follows:
FUNCTION JOB_VALIDATION(p_job_id VARCHAR2,p_sal NUmBER) RETURN BOOLEAN
IS
ln_cnt NUMBER;
BEGIN
SELECT 1
INTO ln_cnt
FROM JOBS
WHERE job_id=p_job_id
and p_sal between min_salary and max_salary;
RETURN(TRUE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN(FALSE);
END;
Method For Validation
public boolean validateSalary(Number data)
//double sal= data.doubleValue();
String job=getJobId();
boolean result=false;
CallableStatement plsqlBlock = null;
String statement="BEGIN :1 = JOB_VALIDATION(:2,:3); END;";
plsqlBlock=getDBTransaction().createCallableStatement(statement,0);
try{
plsqlBlock.registerOutParameter(1,OracleTypes.BOOLEAN);
plsqlBlock.setString(2,job);
plsqlBlock.setObject(3,data);
plsqlBlock.execute();
result=plsqlBlock.getBoolean(1);
catch(SQLException sqlException)
throw new SQLStmtException(CSMessageBundle.class,CSMessageBundle.EXC_SQL_EXECUTE_COMMAND,statement,sqlException);
finally
try{
plsqlBlock.close();
catch(SQLException e)
e.printStackTrace();
return result;
}Hi Nitin,
Thanks again for the response.
I've checked KA02 Transaction, and the cost element still exist. Maybe the problem is in the file. Anyway, it has been addressed by now. Formatting error I guess.
Thanks Nitin for the time.
Regards to you
April -
Inserted value too large for column error while scheduling a job
Hi Everyone,
I am trying to schedule a PL SQL script as a job in my Oracle 10g installed and running on Windows XP.
While trying to Submit the job I get the error as "Inserted value too large for column:" followed by my entire code. The code is correct - complies and runs in Oracle ApEx's SQL Workshop.
The size of my code is 4136 character, 4348 bytes and 107 lines long. It is a code that sends an e-mail and has a +utl_smtp.write_data([Lots of HTML])+
There is no insert statement in the code whatsoever, the code only queries the database for data...
Any idea as to why I might be getting this error??
Thanks in advance
SidThe size of my code is 4136 character, 4348 bytes and 107 lines long. It is a code that sends an e-mail and has a utl_smtp.write_data(Lots of HTML)SQL variable has maximum size of 4000
-
Inserted value too long ...
Hi,
I tried to migrate a VARCHAR2 (2000) column into an other VARCHAR2 (2000) column in an other database.
I get the error message "Inserted value too long ..."
length (source) = 1998
The target database has a Unicode character set.
Could you help me?Hi,
If your initial database is non-unicode and your target in unicode, your length 1998 cannot insert into varchar2(2000). If I well remember, there is a ratio for size from non-unicode to unicode : x3. That's why Oracle cannot insert 1998 from non-unicode to varchar2(2000) into unicode.
There is good metalink article
119119.1 : UTF8 Database Character Set Implications
144808.1 : Examples and limits of BYTE and CHAR semantics usage
Nicolas. -
I have a flash form that is used to inserts a record into an
Access database table. In the for there are 4 datefields, several
text input fields, and several select fields. When I submit the
form, I get a syntax error that reads:
Executing Database Query. [Macromedia][SequeLink JDBC
Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]
Syntax error in INSERT INTO statement.
The error occurred on line 184. Complex object types cannot
be converted to simple values.
Line 184 is the last line of the Values in the insert query.
The query looks like this:
<CFQUERY DATASOURCE="#REQUEST.DataSource#">
INSERT INTO EstimateNumber(
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
Updated,
ReviewDate,
ReviewedBy,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
#FORM.SafetyChecklistDate#,
#FORM.QCChecklist#,
'#FORM.QCChecklistDate#',
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
#FORM.Updated#,
#FORM.ReviewDate#,
#FORM.ReviewedBy#,
#FORM.Discipline#,
#FORM.BidDate#,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
</CFQUERY>
Any recomendations?Date/Time in Access provide some pretty strage hurdles. In
many occassions I have simply changed the field to a Text field and
ran with that and never seemed to have problems with the result. I
didn't like doing it but I never received errors. I have been
receiving some parameter errors with <cfqueryparam> like the
database doesn't recognized the preceding declared field in the
update or insert query. Here is an example of a wierd error with
Access. I have 2 tables. One is for estimate numbers and the other
is for sub estimate numbers that can be assigned to specific
estimate numbers. If is actually a complicated explanation about
what is taking place behind the doors on this. The concept is
simple on the surface. Both tables have the same fields except the
subestimate table has 1 extra for a user defined subestimate
number. The only relation between the two will be the estimate
number. This insert works fine.
INSERT INTO EstimateNumber(
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
ReviewDate,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
<cfqueryparam
value="#FORM.SafetyChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.QCChecklist#,
<cfqueryparam
value="#FORM.QCChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
<cfqueryparam
value="#FORM.ReviewDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.Discipline#,
<cfqueryparam
value="#FORM.BidDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
This next one is the same exact query with the same table
setup with one added field but kicks back a parmeter error
expecting 4. I can't explain it.
INSERT INTO SubEstimate(SubBidNumber,
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
ReviewDate,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(#FORM.SubBidNumber#,
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
<cfqueryparam
value="#FORM.SafetyChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.QCChecklist#,
<cfqueryparam
value="#FORM.QCChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
<cfqueryparam
value="#FORM.ReviewDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.Discipline#,
<cfqueryparam
value="#FORM.BidDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
IF I get rid of the cfqueryparam fields it works. If I simply
remove the param, I get a Syntax error. Needless to say I commented
this query for the sake of sanity for the time being. -
Error: ORA-01722: invalid number performing List of Values query.
when i created a cascading select list, For the first time it worked properly then little later
it is giving this error.
Error: ORA-01722: invalid number performing List of Values query: "select distinct cl_name d, cl_no r from Kclient where gr_no = :P1_GRNO order by 1
could any one please solve the problem?
2. when i run the application. in all the items edit button is automatically seen
including in the login screen.
could any one identify what is the error and give me a solution.Is this better?
select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
, ROW_ID return_value
from "PSA_RESOURCE_MANAGER"
where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
AND :P117_REPORTING_MANAGER <> -1 order by 1or
select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
, ROW_ID return_value
from "PSA_RESOURCE_MANAGER"
where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
AND :P117_REPORTING_MANAGER != '-1' order by 1Is ROW_ID a column in your table by the way? If not, you should use ROWID (without the underscore) -
Error while inserting record in Key-Flex Values Set interface
Guys
on 11.5.10.2
Actually the problem is being occurred while inserting value in Job Flex Field Value set, we have created two segment for job key flex filed, No and name, it was working fine, but since we have uploaded bulk data via api "fnd_flex_values_pkg.INSERT_ROW" which was around 100 off record, but after completion this task system is not taking new value by Values set interface, and show message "APPS-FND-01206: You entered duplicate values or sequence of value that must be unique for every record",
However, we insert the job number through api, it is inserting without error while
Interface is not taking value and raise duplicate message error,
which is APPS-FND-01206
Please Advice.Thanks for supporting dunacan
I have mentioned both of segment detail . please advice,
1.One is Job No segment
Segment1 number 10
Required Check Yes
Value set Info JOB_NO
List Type : List of Values
Security Type : No Security
Format Validation : select number 7,0 and check on number only (0-9)
Validation Type Independent
2.One is Job Name segment
Segment2 number 20
Required Check Yes
Value set Info JOB_NAME
List Type : List of Values
Security Type : No Security
Format Validation : select CHAR 60 Validation Type Independent
It was strange that how could it possible duplication value without having database,i am unable to find this issued,
Edited by: oracle0282 on Jan 17, 2011 3:32 AM -
Insert values from more than one select query
Hi all, I've a simple question:
I need to insert values into a table from two select statements.
There's what I need to accomplish:
I need to monitor the cursors opened on a database, so:
I created the following table:
O_CURSORS
Cols: TOTAL (Number 5), USER (VARCHAR2 20), DATE (TIMESTAMP)
I think some query like the following should work, but unfortunately, it doesn't.
insert into O_CURSORS (total,user,date)
values (
(select a.value, s.username from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic# and s.sid=a.sid and b.name = 'session cursor cache count'),
(select sysdate from dual)
)This statement is not working, the message is
"Not enough values"
If I modify the statement as follows, it works fine
insert into O_CURSORS (total,user)
(select a.value, s.username from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic# and s.sid=a.sid and b.name = 'session cursor cache count'),
)Any advice would be very appreciated!
Thanks in advance.You don't have to select sysdate from dual; it can be a part of any select statement. Just include sysdate in your first query:
INSERT INTO O_CURSORS (total,user,date)
SELECT a.value, s.username, SYSDATE
FROM v$sesstat a, v$statname b, v$session s
WHERE a.statistic# = b.statistic#
AND s.sid=a.sid and b.name = 'session cursor cache count'You'll note also that I elimiated the VALUES keyword, and just used a SQL statement to satisfy the INSERT statement.
Edited by: user13640471 on Feb 21, 2011 1:17 PM
Edited by: user13640471 on Feb 21, 2011 1:18 PM -
Input Value long enough for date format ,Error in executing parallel query
Hi,
My Table: ANML( ID, STATUS,B_DATE,B_MONTH,B_YEAR, DEATH_DATE)
status 1 for alive and 2 for dead.
i wrote a view to get age.
as
create or relace view view1 as
select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
CASE
WHEN anml_age < 1
THEN 'D'
ELSE 'M'
END age_unit,
CASE
WHEN anml_age < 1
THEN TO_CHAR (daysdiff || ' Day(s)')
WHEN anml_age < 12
THEN TO_CHAR (anml_age || ' Month(s)')
WHEN MOD (anml_age, 12) = 0
THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
|| ' Year(s) '
|| MOD (anml_age, 12)
|| ' Month(s)'
END age_string
from
(SELECT a.*,
CASE WHEN status IN ( 1)
THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
END anml_age,
CASE WHEN status IN (1)
THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
END daysdiff
from (
SELECTanml.id, status,
TO_DATE ( DECODE (b_date,
NULL, 1,
b_date
|| '-'
|| DECODE (b_month,
NULL, 1,
b_month
|| '-'
|| b_year,
'dd-mm-yyyy'
) DOB,
death_date
FROM anml
WHERE b_year IS NOT NULL
) a) top
when i tried to fetch all values from view its working fine.
But when i tried to fetch values based on condition like as follows,
select * from view1 where anml_age > 20 and anml_age<30
I am getting error like:
Input Value long enough for date format and Error in executing parallel query
Please tell me wht is wrong.Here is your formatted code
create or relace view view1 as
select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
CASE
WHEN anml_age < 1
THEN 'D'
ELSE 'M'
END age_unit,
CASE
WHEN anml_age < 1
THEN TO_CHAR (daysdiff || ' Day(s)')
WHEN anml_age < 12
THEN TO_CHAR (anml_age || ' Month(s)')
WHEN MOD (anml_age, 12) = 0
THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
|| ' Year(s) '
|| MOD (anml_age, 12)
|| ' Month(s)'
END age_string
from
(SELECT a.*,
CASE WHEN status IN ( 1)
THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
END anml_age,
CASE WHEN status IN (1)
THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
END daysdiff
from (
SELECTanml.id, status,
TO_DATE ( DECODE (b_date,
NULL, 1,
b_date
|| '-'
|| DECODE (b_month,
NULL, 1,
b_month
|| '-'
|| b_year,
'dd-mm-yyyy'
) DOB,
death_date
FROM anml
WHERE b_year IS NOT NULL
) a) top -
EXEC SQL Error: ORA-01401: Inserted value too large for column
Getting this SQL Error: ORA-01401: Inserted value too large for column..on an EXEC SQL Insert statement when writing to an
external Oracle DB from SAP.
On further analysis..it appears that this happens to the fields..when the string length matches the field length.
Example: Plant field is defined as char(4) on the SAP side and it is a Varchar2(4) on the Oracle side.
When a value like '1015' is passed thru a variable in the insert statement then this ORA-01401 error pops up.
No error:
- if the value '1015' is passed directly in the insert statement to the external table (or)
- when a value with 3 chars or less(like the first three chars..101) is passed thru a variable defined as 'Plant(4) type c'.
- when using EXEC sql within SAP
- when reading from the external db table
This was working ok until the Oracle Patch P9147110 was installed recently.
Any suggestions !Hello Dvas,
what's the characterset of your external database?
What's the column definition in your external database (byte or character based)?
If you use a characeterset like UTF8 it is possible, that one character needs more than one byte and then you will run into such kind of issues if the definition is too small.
Regards
Stefan -
Snapshot refresh error: ora-01401 inserted value too large for column
I have an error ora-01401 "Inserted value too large for column" when I try to do a refresh on a group at the materialized view site.
My model is 1 master replicating to a readonly materialized view site. I have 2 refresh groups for separate sets of tables. 1 refresh group work fine...the other I got the above error.
I have doubled the rbs and system tablespace without any help thinking that I must be running out of default rollback segment space.
Anyone has this before?The error is related to a field, not to any tablespace. This normaly happens to me when I change the lenght or resolution of a field in the base tables. The structure changes don't "flow" to the materialized view! I must "regenerate" them. Normally droping and creating it again to make them receive the new lenght of that field.
Sometimes, when the field changed is not part of any primary key I have changes directly the field in the materialized view as if it was a normal table.
Hope this helps
Luis
Maybe you are looking for
-
Yosemite and Multiple Displays
I just upgraded a late '12 Mac Mini to Yosemite and am now having some considerable difficulty utilizing TWO Video Output options simultaneously. With 10.8.5 I have been using my Thunderbolt port to adapt to VGA, which goes to a Star-Tech KVM and the
-
I have a Macbook Pro Laptop. I click on mail and it says it must import my messages. Then I click continue and it says import failed.
-
Hey all, Simple question: can one copy of Logic Pro 8 be installed on multiple PC's?
-
Hello, Does anybody knows what is command field into v$session? In my installation my sessions are 0 and some are 3. thanks nikpat
-
I've written my own call log in JTAPI with certain advantages over Cisco's own. Last Friday I discovered a little snag: If I park a call, then pick it up again, I have an outgoing call to the park number in my list of calls, and the person on the oth