Syntax error, insert ";" to complete LocalVariableDeclarationStatement
I'm fairly new at JSP, and am trying to convert an ASP site to JSP.
On most of my pages I get an error:
An error occurred at line: 1 in the jsp file: /sheep.jsp
Generated servlet error:
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
An error occurred at line: 1 in the jsp file: /sheep.jsp
Generated servlet error:
Syntax error, insert ")" to complete MethodInvocation
But the only thing on line 1 is <%
Check the block of code between <% and %>
Look for any semicolons you missed.
Look for any brackets you missed closing.
It might not be on line 1, but it will probably be in that area.
Similar Messages
-
Syntax error, insert "}" to complete Class body.
Hello everyone,
I am trying to create simple Adobe form with WebDynpro for java. Java error in autogenerated class appears "Syntax error, insert "}" to complete Class body". As I see, java class really corrupted - there are no "}" at the class end.
Really appreciate any help.
KirillIt dissappeared.
-
<%
String USERNAME = (String)session.getAttribute("USERNAME");
String myBlogUrl;
if (USERNAME==null){
session.setAttribute("loginStatus","Not Logged In");//status: user NOT logged in
myBlogUrl = "loginFail.jsp";
esle {
myBlogUrl = "blog.jsp?username="+USERNAME;
%>
<ul>
<li><a href="<%=myBlogUrl%>">My Blog</a></li>
...(navbar.jsp)
1. I include masthead.jsp and navbar.jsp in a few other .jsp files using:
<%@ include file="include/navbar.jsp" %>2. USERNAME is also declared in masthead.jsp:
String USERNAME = (String)session.getAttribute("USERNAME");
Tomcat gives an exception message as follows:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 11 in the jsp file: /include/navbar.jsp
Generated servlet error:
Syntax error, insert ";" to complete Statement
An error occurred at line: 11 in the jsp file: /include/navbar.jsp
Generated servlet error:
Syntax error, insert[b] "AssignmentOperator ArrayInitializer" to complete ArrayInitializerAssignement
3. I guesses there might be the problem with String USERNAME = (String)session.getAttribute("USERNAME");, so I deleted from navbar.jsp, but the problem still exists.
So, this means there is some syntax problem with the statements in navbar.jsp? how can I solve the problem?Can't see anything wrong in the code you have posted.
Error: AssignmentOperator ArrayInitializer
The error message would lead me to look for any arrays you are declaring in your code. Are you declaring an array? Are you trying to initialize it? Have you closed all quotes/brackets etc etc? -
Syntax error, insert "AssignmentOperator Expression" to complete Expression
Hi experts,
I am very new in Java. Currently, I get stuck in the exception of program. Please help me figure out what is the issue. The eclipse raises the error "Syntax error, insert "AssignmentOperator Expression" to complete Expression" at the command "exception;" as below code.
Thanks,
Hieu
Edited by: user122479 on Apr 5, 2013 4:23 PMuser122479 wrote:
I put { code } as your advice, but it is still error.You put the tage in your *.java file?
Oh dear!
I think you should take a few days to go trough the Java tutorials
http://docs.oracle.com/javase/tutorial/ starting at "Trails Covering the Basics"
Then you should find a tutorial on your IDE to learn how to import a project.
Programming is a craft.
And as with any craft you need some knowledge on your matter and training on your tools.
A forum is not the right place to gather either one.
bye
TPD -
"Syntax error, insert "AssignmentOperator Expression" to complete ForInit"?
I am getting this unknown error and do not know how to solve it.
here is my code:
it gives me the error for the first part of both for loops.
int THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHEFIRSTLOOP = 3;
int THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHESECONDLOOP = 3;
int THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP = 0;
int THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP = 0;
int THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP = 3;
for(THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP;
THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP <= THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHEFIRSTLOOP;
THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP++)
for(THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP;
THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP <= THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHESECONDLOOP;
THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP++)
THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP *= THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP;
}JacobsB wrote:
it has to be like this
int THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHEFIRSTLOOP = 3;
int THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHESECONDLOOP = 3;
int THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP;
int THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP;
int THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP = 3;
for(THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP = 0;
THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP <= THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHEFIRSTLOOP;
THISHOLDSTHECOUNTERVALUEFORTHEFIRSTLOOP++)
for(THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP = 0;
THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP <= THISHOLDSTHEVALUEOFTHENUMBEROFTIMESTOLOOPINTHESECONDLOOP;
THISHOLDSTHECOUNTERVALUEFORTHESECONDLOOP++)
THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP *= THISHOLDSTHEVALUECALCULATEDTHOUGHTHEFIRSTANDSECONDLOOP;
Thanks JacobsB. -
OLEDB Syntax error INSERT INTO in DAL
hi guys im having problems with my DAL in my school project
before im starting new one maybe you can help me
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Data;
using
System.Data.OleDb;
public
class
DAL
private
string dbPath;
private
OleDbConnection conn;
private
OleDbCommand command;
private
OleDbDataAdapter adpter;
private
string strQuery;
public DAL(string
dbPath)
this.dbPath = dbPath;
string ConnectionString =
string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source={0}", dbPath);
conn =
new
OleDbConnection(ConnectionString);
command =
new
OleDbCommand(strQuery, conn);
adpter =
new
OleDbDataAdapter(command);
public
DataSet GetDataSet(string
strSql)
DataSet ds =
new
DataSet();
command.CommandText = strSql;
adpter.SelectCommand = command;
adpter.Fill(ds);
return (ds);
public
void SetDataSet(DataSet
ds)
OleDbCommandBuilder builder =
new
OleDbCommandBuilder(adpter);
adpter.InsertCommand = builder.GetInsertCommand();
conn.Open();
adpter.Update(ds);
conn.Close();
public
bool InsertRow(string
sqlInsert)
int rowsEffected;
command.CommandText = sqlInsert;
conn.Open();
rowsEffected = command.ExecuteNonQuery(); // -------> the problem is here <--------
conn.Close();
return (rowsEffected > 0);Hi
tzaxcu,
Did you get some error information? Could you please post more information here?
Best wishes!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Syntax Error - AssignmentOperator ArrayInitializer
Hi All,
For the following statement -
(m_querySection.isExpanded()?(m_sashWeights[0] = 15) : (m_sashWeights[0] = 20));I am getting the error - Syntax error, insert "AssignmentOperator ArrayInitializer" to complete Expression
The return type for the method isExpanded() is boolean.
Please suggest me where am I going wrong?
Thanks in advance.
Regards,
Ashish A.That construct is supposed to be an expression, not a statement. Perhaps you meant(m_querySection.isExpanded()?(m_sashWeights[0] == 15) : (m_sashWeights[0] == 20));but I suspect not as you aren't assigning the result to anything. If you are really in love with that ternary operator then you could save it by doing this:m_sashWeights[0] = (m_querySection.isExpanded() ? 15 : 20);
-
Where is the syntax error in my Insert statement?
It says that there is a syntax error in my insert statement, pointing to the .ExecuteNonQuery() at the end:
'Defining the activity ID from the datatable
Dim ActivityID As Integer = DataTableActivities.Rows(0).Item(0)
'Defining the calories from the datatable
Dim calories As Decimal = (DataTableActivities.Rows(0).Item(3)) * (DurationNum.Value / 60)
'Insert statement to add new training events
Dim SqlQueryActivityInsert As String = "INSERT INTO tblTraining (RunnerID, ActivityID, Full_Name, Time, Calories_Burnt, Date) VALUES (@RunnerID, @ActivityID, @Full_Name, @Time, @Calories, @Date)"
Dim SqlCommandActivity As New OleDbCommand
With SqlCommandActivity
.CommandText = SqlQueryActivityInsert
.Parameters.AddWithValue("@RunnerID", LoginForm.UserIDlbl.Text)
.Parameters.AddWithValue("@ActivityID", ActivityID)
.Parameters.AddWithValue("@Full_Name", LoginForm.Full_Namelbl.Text)
.Parameters.AddWithValue("@Time", DurationNum.Value)
.Parameters.AddWithValue("@Calories", calories)
.Parameters.AddWithValue("@Date", WeekPicker.Value)
.Connection = conn
.ExecuteNonQuery()Viorel is right. The 'Date' field is probably throwing it off. Date is a reserved word.
https://www.drupal.org/node/141051
Putting square brackets [] around the field name should get it working for you.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
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. -
Syntax error in INSERT STATEMENT
A problem on the date part of the query but why I don´t
know, Thanks for any pointers,
TIA
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, date)
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
The error occurred in uploadmember.cfm: line 28
26 : INSERT INTO imagesproducts
27 : (title, info, date)
28 : VALUES ( '#form.title#', '#form.info#',
'#DateFormat(Now())#' )
29 : </cfquery>
30 :
SQL INSERT INTO imagesproducts (title, info, date) VALUES (
'News test', 'Testing news info', '12-Jul-07' )
DATASOURCE trevor_SecurityDB
VENDORERRORCODE -3502
SQLSTATE 42000Perhaps it is a reserved word issue with the date column,
since
date is an ODBC Reserved Keyword. You might try enclosing it
within brackets [ ].
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, [date])
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Or, if that doesn't help, you might try using a cfqueryparam
tag for the '#DateFormat(Now())#' value using a cfsqltype =
"CF_SQL_TIMESTAMP" (assuming a date/time datatype on the column).
Also, you might look into using one of the CreateODBCDateTime() or
CreateODBCDate() functions.
Phil -
Date/Time Field in Access 2000 - INSERT INTO ... syntax error
I am using Labview 6.1 Professional with the Database Connectivity Toolkit. When I execute this SQL Command "INSERT INTO PRODUCTION (Part, Passed, Date) VALUES ('Part#1', 2, '10/10/2003 10:10:10 AM')" I get a Run-Time Syntax Error. If I remove the Date Label and Date Value it works. What is the proper Format of the Date/Time Type Field in ACCESS 2000 for Labview 6.1 SQL? I have seen and tried all of the solutions already posted like MSG 1ZNAJHJ6.
Well, if it's any consolation handling dates is a pain regardless of which database you use. In any case, I created a table with the following definition:
CREATE TABLE testing
(item1 INTEGER,
item2 DATE)
I them did the following insert:
INSERT INTO testing
VALUES (1, '18/11/1953 04:20:00');
And everything worked fine. Note that in the date (my Bday, BTW) the format is DD/MM/YYYY followed by the time.
What exactly is the error you're getting? Can you post the exact text of the error message. Also, I ran my test using the examples that come with LabSQL--not the toolkit.
Mike...
Oops, just noticed something. You have a column name that is probibly a reserved word "Date". Try your insert as:
INSERT INTO PRODUCTION
VALUES
('Part#1', 2, '10/10/2003 10:10:10 AM')
If there is only those three columns and they the order the data appears is the same as the column order, you don't need the column list. If this works (and it should--I just tried it) I would only view it as a temporary patch. The column name should be changed.
This is also a good reason to not use the Access GUI to create tables. If you tried creating a table like that in SQL you would have gotten an error message. Learning to build tables in SQL code isn't hard and it adds an extra layer of error checking that the GUI apparently doesn't think is important.
If you're interested let me know and I can send you the info on a really good book on SQL...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Getting syntax error when i using INSERT command
Hi,
i am using MS Access DB. Table name is "Timesheet". the table has the following Fields,
uname - Text
date - Text
intime - Text
outtime - Text
duration - Text
desc - Text
i am using preparedStatment,
String accessDBURLPrefix = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
String accessDBURLSuffix = ";DriverID=22;READONLY=false}";
String filename="D:\\TimeSheet\\TimeDB.mdb"
String databaseURL = accessDBURLPrefix + filename + accessDBURLSuffix;
Connection con = DriverManager.getConnection(databaseURL);
PreparedStatment st = con.prepareStatement("INSERT INTO (uname, date, intime) TimeSheet VALUES (?,?,?)");
st.setString(1,user);
st.setString(2,date);
st.setString(3,intime);
st.executeUpdate();
}if i am going to compile this code i will get SQLException
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
at TimeSheetDemo.writeToDB(TimeSheetDemo.java:84)
at TimeSheetDemo.main(TimeSheetDemo.java:37)
Really i have tired to figure out this problem. please help me anyone.
thank youThank you. it was my careless mistake. i changed that mistake. but still it is not working, get same exception.
st = con.prepareStatement("INSERT INTO TimeSheet (uname, date, intime) VALUES (?,?,?)");suppose, if i will give values for all fields, it will work fine, example
st = con.prepareStatement("INSERT INTO TimeSheet VALUES (?,?,?,?,?,?)");
st.setString(1,user);
st.setString(2,date);
st.setString(3,intime);
st.setString(4,outtime);
st.setString(5,duration);
st.setString(6,descrip);
st.executeUpdate();But my problem is i want to insert the values for only 3 fields.
give me the solution for inserting values for specified fields -
Inserting Flash Video - Syntax Error
Hello,
I used the Insert menu to add a flash video file to my page. There is some kinf of syntax error on this line:
swfobject.registerObject("FLVPlayer");
I am validating for HTML4.
The video plays in preview, but not when uplaoded. Any ideas?
MikeI am so embarassed. The problem? my extension was .FLV, not .flv. I changed the case and everythng works now. I had no idea that extensions are case-sensitive.
Thanks so much for all your help. Like I said, I am embarassed and apologize that I wasted your time.
But I do wonder why case didn't matter when previewing. Could that be a domain server setting?
Mike -
URGENT! Having problem with while statement and other syntax errors
I am trying to teach myself JSP for a school project due very soon. But I keep receiving errors surrounding my while statement. The errors are:
Syntax: ";" inserted to complete BlockStatements
Syntax: "}" inserted to complete Block
I have checked it over and over again, comparing against other examples found in this forum and against servlet examples and I can see no difference. This is my file for your information. It is supposed to list all the users in the user table. Is there a simpler way to do this?
regards
rach
<%@ page language="java" import="java.sql.*, java.util.*"%>
<html>
<head>
<title></title>
</head>
<body>
<%! String selected = null; %>
<%
try{
// Connect to the database
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:odbc:dbtest");
catch(ClassNotFoundException e) {
System.out.println("Database driver could not be found.");
System.out.println(e.toString());
throw new UnavailableException(this, "Database driver class not found");
try{
//create SQL statement
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * from USER ORDER BY User_lastname, User_firstname");
catch(SQLException e){
System.out.println("Error connecting to the database.");
System.out.println(e.toString());
throw new UnavailableException(this, "Cannot connect to the database");
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"> </td>
<td width="200" valign="top" align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td><form method="post" action="userupdatedelete.jsp" target="content" name="userlist">
<h2>Users</h2>
</td>
</tr>
<tr>
<td width="10"> </td>
</tr>
<tr>
<td valign="top"><select size="15" name="rec">
<!-- if the resultset is not null -->
<% try {
//if (rs.next()) {
While (rs.next()){
//retrieve data from User table
String userid = rs.getString("User_ID");
String firstname = rs.getString("User_firstname");
String lastname = rs.getString("User_lastname");
out.println("<option value='userid'>lastname + ', ' + firstname</option>");
//<option value="<%=userid%>"><%=lastname + ", " + firstname%></option>
//else {
// out.println("<option> - No Users Entered - </option>");
//<option> - No Users Entered - </option>
stmt.close();
con.close();
catch (SQLException ex){
System.err.print("SQL Exception :");
System.err.println(ex.getMessage());
%>
</select>
</td>
</tr>
<tr>
<td align="center"><input type="submit" value="Update/Delete"></td>
</tr></form>
<tr>
<td><br></td>
</tr>
<tr>
<td align="center">
<form method="post" action="useraddform.jsp" name="addbuttonform">
<input type="submit" value=" Add New " name="addnew">
</tr></form>
</table>
</td>
<td width="10"> </td>
</tr>
</table>
</body>
</html>There is a problem here with the "scope" of variables namely your variables "rs" and "stmt". Variables declared within a try block are available only within that try block. Also, the type for stmt is not even given.
Change:
try{
//create SQL statement
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * from USER ORDER BY User_lastname, User_firstname");
catch(SQLException e){
System.out.println("Error connecting to the database.");
System.out.println(e.toString());
throw new UnavailableException(this, "Cannot connect to the database");
}to:
Statement stmt = null;
ResultSet rs = null;
try
//create SQL statement
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * from USER ORDER BY User_lastname, User_firstname");
catch(SQLException e)
System.out.println("Error connecting to the database.");
System.out.println(e.toString());
throw new UnavailableException(this, "Cannot connect to the database"); -
Using PARTITION FOR/SUBPARTITION FOR syntax to insert
We are trying to use PARTITION FOR syntax (or, better, SUBPARTITION FOR syntax) to insert into a subpartitioned table.
http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements009.htm#i165979
08:26:46 GM_CS_CDR@oradev02> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
5 rows selected.This table is has interval partitions on DATA_ORIGIN_ID and list subpartitions on TABLE_NAME.
First, a basic insert without specifying partitions:
08:10:05 GM_CS_CDR@oradev02> insert into key_ids2 (
08:11:51 2 DATA_ORIGIN_ID ,
08:11:51 3 TABLE_NAME ,
08:11:51 4 DUR_UK ,
08:11:51 5 DUR_UK_ID )
08:11:51 6 select
08:11:51 7 12 ,
08:11:51 8 TABLE_NAME ,
08:11:51 9 DUR_UK ,
08:11:51 10 DUR_UK_ID
08:11:51 11 from key_ids where table_name = 'PART'
08:11:51 12 and rownum <= 10;
10 rows created.Verifying SUBPARTITION FOR syntax on a SELECT:
08:19:43 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02> select count(*) from key_ids2
08:26:45 2 subpartition for(12,'PART');
COUNT(*)
10
1 row selected.But when we add a subpartition specification (to limit the lock to a single subpartition), we get a syntax error:
08:14:57 GM_CS_CDR@oradev02> insert into key_ids2 subpartition for(12,'PART') (
08:14:57 2 DATA_ORIGIN_ID ,
08:14:57 3 TABLE_NAME ,
08:14:57 4 DUR_UK ,
08:14:57 5 DUR_UK_ID )
08:14:57 6 select
08:14:57 7 14 ,
08:14:57 8 TABLE_NAME ,
08:14:57 9 DUR_UK||'!' ,
08:14:57 10 DUR_UK_ID
08:14:57 11 from key_ids
08:14:57 12 where table_name = 'PART'
08:14:57 13 and rownum <= 10;
insert into key_ids2 subpartition for(12,'PART') (
ERROR at line 1:
ORA-14173: illegal subpartition-extended table name syntaxSpecifying at the partition level did not work either:
08:14:58 GM_CS_CDR@oradev02> insert into key_ids2 partition for(14) (
08:15:23 2 DATA_ORIGIN_ID ,
08:15:23 3 TABLE_NAME ,
08:15:23 4 DUR_UK ,
08:15:23 5 DUR_UK_ID )
08:15:23 6 select
08:15:23 7 14 ,
08:15:23 8 TABLE_NAME ,
08:15:23 9 DUR_UK||'!' ,
08:15:23 10 DUR_UK_ID
08:15:23 11 from key_ids
08:15:23 12 where table_name = 'PART'
08:15:23 13 and rownum <= 10;
insert into key_ids2 partition for(14) (
ERROR at line 1:
ORA-14108: illegal partition-extended table name syntaxBut specifying explicit partition and subpartition does work:
08:17:45 GM_CS_CDR@oradev02> insert into key_ids2 partition (SYS_P15127) (
08:18:23 2 DATA_ORIGIN_ID ,
08:18:23 3 TABLE_NAME ,
08:18:23 4 DUR_UK ,
08:18:23 5 DUR_UK_ID )
08:18:23 6 select
08:18:23 7 12 ,
08:18:23 8 TABLE_NAME ,
08:18:23 9 DUR_UK||'!' ,
08:18:23 10 DUR_UK_ID
08:18:23 11 from key_ids
08:18:23 12 where table_name = 'PART'
08:18:23 13 and rownum <= 10;
10 rows created.
08:18:24 GM_CS_CDR@oradev02> insert into key_ids2 subpartition (SYS_SUBP15126) (
08:19:42 2 DATA_ORIGIN_ID ,
08:19:42 3 TABLE_NAME ,
08:19:42 4 DUR_UK ,
08:19:42 5 DUR_UK_ID )
08:19:42 6 select
08:19:42 7 12 ,
08:19:42 8 TABLE_NAME ,
08:19:42 9 DUR_UK||'!#' ,
08:19:42 10 DUR_UK_ID
08:19:42 11 from key_ids
08:19:42 12 where table_name = 'PART'
08:19:42 13 and rownum <= 10;
10 rows created.We have been successful in using the PARTITION FOR syntax for tables that were partitioned but not subpartitioned.
Any ideas?
Thanks,
MikeI've created a simplified script to reproduce our issue. The use of the syntax on an INSERT INTO using VALUES still produces the same error.
Thanks,
Andy
select * from v$version;
create table part_test_tbl
data_origin_id NUMBER not null,
table_name VARCHAR2(30) not null,
dur_uk VARCHAR2(250) not null,
dur_uk_id NUMBER
partition by range (data_origin_id) INTERVAL (1)
subpartition by list (TABLE_NAME)
SUBPARTITION TEMPLATE(
subpartition BLUE values ('BLUE'),
subpartition RED values ('RED'),
subpartition YELLOW values ('YELLOW'),
subpartition GREEN values ('GREEN'),
subpartition ORANGE values ('ORANGE')
(PARTITION DFLT_INTRVL VALUES LESS THAN (0)
subpartition BLUE values ('BLUE'),
subpartition RED values ('RED'),
subpartition YELLOW values ('YELLOW'),
subpartition GREEN values ('GREEN'),
subpartition ORANGE values ('ORANGE')
-- Create/Recreate indexes
create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
compress 2 local;
create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
compress 1;
-- Create/Recreate primary, unique and foreign key constraints
alter table PART_TEST_TBL
add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
alter table PART_TEST_TBL
add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
--Add test data
BEGIN
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'BLUE', '1', 1);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'BLUE', '2', 2);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'YELLOW', '3', 3);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'GREEN', '4', 4);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'ORANGE', '5', 5);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'BLUE', '6', 6);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'BLUE', '7', 7);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'YELLOW', '8', 8);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'GREEN', '9', 9);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'ORANGE', '10', 10);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'BLUE', '11', 11);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'BLUE', '12', 12);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'YELLOW', '13', 13);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'GREEN', '14', 14);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'ORANGE', '15', 15);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'BLUE', '16', 16);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'BLUE', '17', 17);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'YELLOW', '18', 18);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'GREEN', '19', 19);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'ORANGE', '20', 20);
COMMIT;
END;
--Validate the subpartition_extended syntax
select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
--Show subpartition_extended syntax does not work on INSERT INTO
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
VALUES
(10
,'BLUE'
,'16!'
,1016);
--Show subpartition_extended syntax does not work on INSERT INTO
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
SELECT ptt.data_origin_id
,ptt.table_name
,ptt.dur_uk || '!' dur_uk
,ptt.dur_uk_id + 1000 dur_uk_id
FROM PART_TEST_TBL ptt
WHERE ptt.table_name = 'BLUE'
AND ptt.data_origin_id = 10;
DROP TABLE part_test_tbl PURGE;-----
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> create table part_test_tbl
2 (
3 data_origin_id NUMBER not null,
4 table_name VARCHAR2(30) not null,
5 dur_uk VARCHAR2(250) not null,
6 dur_uk_id NUMBER
7 )
8 partition by range (data_origin_id) INTERVAL (1)
9 subpartition by list (TABLE_NAME)
10 SUBPARTITION TEMPLATE(
11 subpartition BLUE values ('BLUE'),
12 subpartition RED values ('RED'),
13 subpartition YELLOW values ('YELLOW'),
14 subpartition GREEN values ('GREEN'),
15 subpartition ORANGE values ('ORANGE')
16 )
17 (PARTITION DFLT_INTRVL VALUES LESS THAN (0)
18 (
19 subpartition BLUE values ('BLUE'),
20 subpartition RED values ('RED'),
21 subpartition YELLOW values ('YELLOW'),
22 subpartition GREEN values ('GREEN'),
23 subpartition ORANGE values ('ORANGE')
24 )
25 );
Table created
SQL> -- Create/Recreate indexes
SQL> create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
2 compress 2 local;
Index created
SQL> create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
2 compress 1;
Index created
SQL> -- Create/Recreate primary, unique and foreign key constraints
SQL> alter table PART_TEST_TBL
2 add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
Table altered
SQL> alter table PART_TEST_TBL
2 add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
Table altered
SQL> --Add test data
SQL> BEGIN
2
3 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
4 values (0, 'BLUE', '1', 1);
5
6 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
7 values (0, 'BLUE', '2', 2);
8
9 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
10 values (0, 'YELLOW', '3', 3);
11
12 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
13 values (0, 'GREEN', '4', 4);
14
15 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
16 values (0, 'ORANGE', '5', 5);
17
18 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
19 values (1, 'BLUE', '6', 6);
20
21 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
22 values (1, 'BLUE', '7', 7);
23
24 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
25 values (1, 'YELLOW', '8', 8);
26
27 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
28 values (1, 'GREEN', '9', 9);
29
30 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
31 values (1, 'ORANGE', '10', 10);
32
33 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
34 values (2, 'BLUE', '11', 11);
35
36 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
37 values (2, 'BLUE', '12', 12);
38
39 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
40 values (2, 'YELLOW', '13', 13);
41
42 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
43 values (2, 'GREEN', '14', 14);
44
45 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
46 values (2, 'ORANGE', '15', 15);
47
48 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
49 values (10, 'BLUE', '16', 16);
50
51 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
52 values (10, 'BLUE', '17', 17);
53
54 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
55 values (10, 'YELLOW', '18', 18);
56
57 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
58 values (10, 'GREEN', '19', 19);
59
60 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
61 values (10, 'ORANGE', '20', 20);
62
63 COMMIT;
64 END;
65 /
PL/SQL procedure successfully completed
SQL> --Validate the subpartition_extended syntax
SQL> select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
COUNT(*)
2
SQL> --Show subpartition_extended syntax does not work on INSERT INTO
SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
2 (data_origin_id
3 ,table_name
4 ,dur_uk
5 ,dur_uk_id)
6 VALUES
7 (10
8 ,'BLUE'
9 ,'16!'
10 ,1016);
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
VALUES
(10
,'BLUE'
,'16!'
,1016)
ORA-14173: illegal subpartition-extended table name syntax
SQL> --Show subpartition_extended syntax does not work on INSERT INTO
SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
2 (data_origin_id
3 ,table_name
4 ,dur_uk
5 ,dur_uk_id)
6 SELECT ptt.data_origin_id
7 ,ptt.table_name
8 ,ptt.dur_uk || '!' dur_uk
9 ,ptt.dur_uk_id + 1000 dur_uk_id
10 FROM PART_TEST_TBL ptt
11 WHERE ptt.table_name = 'BLUE'
12 AND ptt.data_origin_id = 10;
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
SELECT ptt.data_origin_id
,ptt.table_name
,ptt.dur_uk || '!' dur_uk
,ptt.dur_uk_id + 1000 dur_uk_id
FROM PART_TEST_TBL ptt
WHERE ptt.table_name = 'BLUE'
AND ptt.data_origin_id = 10
ORA-14173: illegal subpartition-extended table name syntax
SQL> DROP TABLE part_test_tbl PURGE;
Table dropped
SQL>
Maybe you are looking for
-
How to reduce size or compress PDF files?
Hi guys, Does someone knows if there is a way to reduce the size of the PDF file with good quality even on Pictures and Scanned documents? I know the option 'export', 'quartz filter' 'reduce size', but the compression is so extrem. Many files can't
-
My e-mail software will not receive e-mails. I am only able to send. I have had this program for a few years and am just now having problems with it.
-
Hi! I am hoping someone out there has an idea of what I can do to end this recurring problem! It happened before, when I first did the latest upgrade...but, it seemed to resolve itself...now, it happened again! This time, it has not resolved...now,
-
Edit link not working in IE 10 browser after fetching 5000+ rows
Hi, OBIEE 11g 11.1.1.7.150120 IE 10 We have an issue where IE browser misbehaves after fetching 5000+ rows. By misbehaves, I mean the browser responds extremely slow while scrolling up, down, left, right. Worst behavior is the "Edit" link on the re
-
I have a problem with Black Point Compensation in the print dialog when printing my book pages. It almost seems that the on/off toggle is reversed. I usually have BPC on when printing in Photoshop and I can preview its effect there. I use Relative Co