First of all, I'm new to the club and must say I find it a very interesting site, and it has really helped me a lot with my coding experiences in C#. Thanks for that.
On a total different note, I'm getting the follow error at one of our customers (we resell document management software). And I'm trying to determine if this error message as stated below can cause performance issues.
Google'ing this error message has already informed me that it can be caused when using Reserved Words as Column Names.
24-4-2012 11:16:49 [ERROR] :There was an error parsing the query. [
Token line number = 1,Token line offset = 77,Token in error = 66667 ]
UPDATE WS_LOCATION SET Frequency = #FreqParams, LUTime =
#LUTimeParams, Client = '', Matter = '' WHERE WSLoc_ID = '22' occured
on InsertIntoLocationTables.
I'm not very familiar with all of the Reserved Words in SQL, perhaps any of you can help me out with determining what is the cause of this error?
It's a local SQL Compact database bytheway (.sdf).
Enclosing your names with brackets will prevent the error of using T-SQL reserved words.
UPDATE [WS_LOCATION] SET
[Frequency] = #FreqParams,
[LUTime] = #LUTimeParams,
[Client] = '',
[Matter] = ''
WHERE [WSLoc_ID] = '22';
If you have a problem with reserved words, prefix your column names with the table name :
UPDATE WS_LOCATION
SET WS_LOCATION.Frequency = #FreqParams, WS_LOCATION.LUTime = #LUTimeParams, WS_LOCATION.Client = '', WS_LOCATION.Matter = ''
WHERE WS_LOCATION.WSLoc_ID = '22'
Related
I use the function module SAP_CONVERT_TO_CSV_FORMAT but I have the following runtime error UC_OBJECTS_NOT_CHARLIKE.
The field that causes the error is a type I.
What should I do avoid the short dump?
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
i_line_header = 'X'
TABLES
i_tab_sap_data = p_csv1
CHANGING
i_tab_converted_data = gt_row
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
I have a problem with BIRT when I try to pass multiple values from report parameter.
I'm using BIRT 2.6.2 and eclipse.
I'm trying to put multiple values from cascading parameter group last parameter "JDSuser". The parameter is allowed to have multiple values and I'm using list box.
In order to be able to do that I'm writing my sql query with where-in statement where I replace text with javascript. Otherwise BIRT sql can't get multiple values from report parameter.
My sql query is
select jamacomment.createdDate, jamacomment.scopeId,
jamacomment.commentText, jamacomment.documentId,
jamacomment.highlightQuote, jamacomment.organizationId,
jamacomment.userId,
organization.id, organization.name,
userbase.id, userbase.firstName, userbase.lastName,
userbase.organization, userbase.userName,
document.id, document.name, document.description,
user_role.userId, user_role.roleId,
role.id, role.name
from jamacomment jamacomment left join
userbase on userbase.id=jamacomment.userId
left join organization on
organization.id=jamacomment.organizationId
left join document on
document.id=jamacomment.documentId
left join user_role on
user_role.userId=userbase.id
right join role on
role.id=user_role.roleId
where jamacomment.scopeId=11
and role.name in ( 'sample grupa' )
and userbase.userName in ( 'sample' )
and my javascript code for that dataset on beforeOpen state is:
if( params["JDSuser"].value[0] != "(All Users)" ){
this.queryText=this.queryText.replaceAll('sample grupa', params["JDSgroup"]);
var users = params["JDSuser"];
//var userquery = "'";
var userquery = userquery + users.join("', '");
//userquery = userquery + "'";
this.queryText=this.queryText.replaceAll('sample', userquery);
}
I tryed many different quote variations, with this one I get no error messages, but if I choose 1 value, I get no data from database, but if I choose at least 2 values, I get the last chosen value data.
If I uncomment one of those additional quote script lines, then I get syntax error like this:
The following items have errors:
Table (id = 597):
+ An exception occurred during processing. Please see the following message for details: Failed to prepare the query execution for the
data set: Organization Cannot get the result set metadata.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object. SQL error #1:You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'rudolfs.sviklis',
'sample' )' at line 25 ;
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near
'rudolfs.sviklis', 'sample' )' at line 25
Also, I should tell you that i'm doing this by looking from working example. Everything is the same, the previous code resulted to the same syntax error, I changed it to this script which does the same.
The example is available here:
http://developer.actuate.com/community/forum/index.php?/files/file/593-default-value-all-with-multi-select-parsmeter/
If someone could give me at least a clue to what I should do that would be great.
You should always use the value property of a parameter, i.e.:
var users = params["JDSuser"].value;
It is not necessary to surround "userquery" with quotes because these quotes are already put in the SQL query arround 'sample'. Furthermore there is a mistake because userquery is not yet defined at line:
var userquery = userquery + users.join("', '");
This might introduce a string such "null" in your query. Therefore remove all references to userquery variable, just use this expression at the end:
this.queryText=this.queryText.replaceAll('sample', users.join("','"));
Notice i removed the blank space in the join expression. Finally once it works finely, you probably need to make your report input more robust by testing if the value is null:
if( params["JDSuser"].value!=null && params["JDSuser"].value[0] != "(All Users)" ){
//Do stuff...
}
To start, I had this error:
Error parsing data org.json.JSONException: Value You of type java.lang.String cannot be converted to JSONObject
After some searching, I found a potential solution using substring to see if there were just some phantom characters causing an issue: 'json.substring(3)'
After trying different substring amounts, I got to json.substring(36) and it finally showed me more than 5 letters at a time:
Error parsing data org.json.JSONException: Expected literal value at character 0 of ; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND from_user = 277976949048048 AND (status = 'pending' OR status = 'accepted'))' at line 2
Maybe this new 'expected literal' thing is caused by doing the substring 36, but either way, it seems like there is an issue with my SQL syntax even though I tested it directly with the server and it works perfectly. here is my sql query.
$result = mysql_query("SELECT status FROM users join requests on users.facebook_id=requests.from_user
WHERE (to_user = $id AND from_user = $fbid AND (status = 'pending' OR status = 'accepted'))
OR (from_user = $id AND to_user = $fbid AND (status = 'pending' OR status = 'accepted'))
LIMIT 1") or die(mysql_error());
Any help much appreciated because now I'm officially stumped.
I had some issues in the past with parsing JSON files including huge integer numbers.
The number 277976949048048 seems too large to be treated as an integer, I would suggest treating it as a string.
I am trying to self educate myself in SQL in order to better use databases at work. I am currently trying to code an SQL query in Oracle Application Express that will provide me with a report for management, however I am receiving the following error message:
ORA-01747: invalid user.table.column, table.column, or column specification
I have spent countless hours searching for the bug and doing research and I am getting nowhere, which is quite frustrating as I feel its probably something rather easy. My research has shown me that the probable cause of my error is that I have tried to reference a column name, but the column name used is a reserved word in Oracle. Unfortunately, I am having trouble pinpointing what exactly... Please see below for the code:
SELECT Channel.Channel_Number, Supplier.Supplier_Name, package.Package_Name, Program.Program_name, Rating.Rating_Code, Weekly_Guide.ShowTime
FROM Channel, Supplier, package, Program, Rating, weekly_guide, channel_package
Where weekly_guide.date = ''
AND channel.channel_number = weekly_guide.channel_number
AND weekly_guide.Program_ID = Program.Program_ID
AND channel.channel_number = channel_package.channel_number
AND channel_package.package_ID = package.package_ID
AND Program.rating_code = rating.rating_code
AND Program_list.Program_ID = Program.Program_ID
AND Program_list.list_ID = list.list_id
AND list.supplier_ID = Supplier.supplier_ID
It's most likely date from your Where clause. You'll need to wrap the reserved word in quotes. The name will then be case sensitive, so make sure you have the correct case for date in your query
SELECT Channel.Channel_Number, Supplier.Supplier_Name, package.Package_Name, Program.Program_name, Rating.Rating_Code, Weekly_Guide.ShowTime
FROM Channel, Supplier, package, Program, Rating, weekly_guide, channel_package
Where weekly_guide."date" = ''
AND channel.channel_number = weekly_guide.channel_number
AND weekly_guide.Program_ID = Program.Program_ID
AND channel.channel_number = channel_package.channel_number
AND channel_package.package_ID = package.package_ID
AND Program.rating_code = rating.rating_code
AND Program_list.Program_ID = Program.Program_ID
AND Program_list.list_ID = list.list_id
AND list.supplier_ID = Supplier.supplier_ID
I want to update two columns of a table with reference of other tables. While executing the script its showing error.
Error: Error starting at line 1 in command:
UPDATE wb_costing_work_items,
sa_sales_documents,
sa_sales_document_items
SET cwi_price_per_hour = sdi_price,
cwi_amount = sdi_price * cwi_hours
WHERE cwi_lo_id = sad_lo_id
AND sdi_sad_id = sad_id
AND sdi_wit_id = cwi_wit_id
AND cwi_id = 1650833
Error at Command Line:1 Column:28 Error report: SQL Error: ORA-00971:
missing SET keyword
00971. 00000 - "missing SET keyword"
SQL STATEMENT
UPDATE wb_costing_work_items cwi,
sa_sales_documents sad,
sa_sales_document_items sdi
SET cwi.cwi_price_per_hour = sdi.sdi_price,
cwi.cwi_amount = sdi.sdi_price * cwi.cwi_hours
WHERE cwi.cwi_lo_id = sad.sad_lo_id
AND sdi.sdi_sad_id = sad.sad_id
AND sdi.sdi_wit_id = cwi.cwi_wit_id
AND cwi.cwi_id = 1650855
This should definitely work.
UPDATE (SELECT cwi_price_per_hour,
sdi_price,
cwi_amount,
sdi_price,
cwi_hours
FROM wb_costing_work_items,
sa_sales_documents,
sa_sales_document_items
WHERE cwi_lo_id = sad_lo_id
AND sdi_sad_id = sad_id
AND sdi_wit_id = cwi_wit_id
AND cwi_id = 1650833)
SET cwi_price_per_hour = sdi_price, cwi_amount = sdi_price * cwi_hours
Please alias the tables used and prefix columns so one can easily read your query.
Something like this maybe.
Note that I had to use some wild guesses about which column belongs to which table as you have not included any information about how your tables are define.
So most probably I didn't get it right and you will need to adjust the query to your actual table structure.
merge into wb_costing_work_items
using
(
select cwi.pk_column, -- don't know what the PK of the wb_costing_work_items is due to lack of information
sdi.sdi_price, -- don't know if this column really belong to this table
sdi.sdi_price * cwi.cwi_hours as total-- again unsure about column names due to lack of information
FROM wb_costing_work_items cwi
JOIN sa_sales_documents sad ON sad.sad_lo_id = cwi.cwi_lo_id -- not sure about these, due to lack of information
JOIN sa_sales_document_items sdi
ON sdi.sad_id = sad.sdi_sad_id -- not sure about these, due to lack of information
AND sdi.sdi_wit_id = cwi.cwi_wit_id -- not sure about these, due to lack of information
) t ON (t.pk_column = w.pk_column) -- not sure about this, due to lack of information
when matched then
update
set cwi_price_per_hour = t.sdi_price,
cwi_amount = t.total;