Muti sql statements execution issue with DB2 - iSeries
Hello,
I am encountering "[SQL0104] Token ; was not valid. Valid tokens: ). " error , when I execute below statement.
Using ; (semi colon) for sql statements separation.
Please let me know , how to fix it.
Thanks in advance.
<cfquery name="qInsertTo" datasource="dsn">
<cfloop from="1" to="25" index="i">
insert into test1(userId,firstname) values('xx#i#','fname#i#') ;
</cfloop>
</cfquery>
PS: I don't want to keep cfloop outside cfquery.
Hi,
trhat would be possible for an Unix System ... but I'm on a Windows OS system and I already assign everybody with full modification rights ...
Thanks anyway for ur help I'll recheck it anyway sometimes its strange ...
greetings Lars
Similar Messages
-
How can I convert SQL Server 2008 Timestamp to DB2/iSeries Timestamp?
In DB2/iSeries I have a column that accepts Timestamp value. When I try to insert a timestamp value from the SQL 2008 table and into DB2/iSeries table I recieve the following error message:
OLE DB provider "IBMDA400" for linked server "XXX" returned message "SQL0180: Syntax of date, time, or timestamp value not valid.
Cause . . . . . : The string representation of a date, time, or timestamp value does not conform to the syntax for the specified or implied data type and format. *N is either the character string constant that is not valid or the column or host
variable that contained the string. If the name is *N, then the value is an expression specified in the statement. If the string was found in a host variable, the host variable number is 1. Recovery . . . : Ensure that the date, time, or
timestamp value conforms to the syntax for the data type it represents. Try the request again.".
Msg 7343, Level 16, State 2, Line 1
The OLE DB provider "IBMDA400" for linked server "XXX" could not INSERT INTO table "[IBMDA400]".
The SQL timestamp column contains the result in the following format:
2014-04-24 07:39:09.000
And my insert TSQL command is:
INSERT INTO OPENQUERY(XXX, 'Select "TimeOfDeal" from ABCD.TICKETS')
SELECT TimeOfDeal
FROM dbo.Tickets
WHERE DealId = 'ABC123'
I appreciate any help on this issue.You are right it is a datetime data type in MS SQL, and a Timestamp in DB2.
I cast it to datetime2 and it worked.
Interesting. I would guess that somewhere under the covers, the date value gets converted to a string, and the different default string formats for datetime and datetime2 is illustrated with this statement:
SELECT convert(varchar, getdate()), convert(varchar, sysdatetime())
When I ran it, I got these values:
Feb 23 2015 12:31PM 2015-02-23 12:31:18.3708899
Now, why there is a conversion to string in the first place, I'm afraid I don't have any good answer to.
Erland Sommarskog, SQL Server MVP, [email protected] -
New sessions every time an sql statement is issued
Hi, I have a problem with using oraoledb (v 10.1.0) with VB6 accessing an Oracle database 9i (v 9.2.0.6). Every time an sql statement is issued in the client side, a new session is started in the server side (seen in Enterprise Manager). I don´'t know why. Is an oraoledb parameter or a database parameter? How can I avoid this? The big problem behind this behaviour is controling row locking. If I issue a "select field from table where conditions for update nowait(or wait n)", this creates a lock that belongs to a session. If a few sentences after I issue an "update the-same-table set the-same-field = value where the-same-condition" as this one creates a new session, an ORA-00054 is raised telling the row(s) is blocked.
any idea?
thanksI'm a DBA and I encountered the same problem with a system developed for our company. We reported that to the company that developed the application and they sey then close the conections, but they remain in the database.
Could anyone find a solution for this? I believe is a problem in the VB code, but I do not know anything from VB.
thanks,
Lisandro -
SQL Developer connection issue with JDBC
Hi skutz & friends,
I have problem with Oracle SQL Developer I can not connect to any oracle db
because Status : Failure -Error loading native JDBC driver library.
However, I download SQL developer [ Oracle SQL Developer for Windows (JDK1.5.0_06 is bundled in this zip) ]
After it is not working. Also I download JDK 5.0 Update 14
The Java SE Development Kit (JDK) to install it on my PC again.
But it does not work. My install path information:
install path as C:\Program Files\SQLDEVELOPER_INSTAL\sqldeveloper
local oracle as !0g 10201
SQL version as sqldeveloper-1.2.1.3213 which download last versionfrom OTN on 2/18/2008.
for connection, taken basic.
port as default 1521
hostname and saver name are same.
I created a environment variable in window xp.
SQLDEVELOPER_USER_DIR AS C:\Program Files\SQLDEVELOPER_INSTAL\sqldeveloper
can anybody help me with this connection?
thanks
JimmyDuplicate thread: Please enter all responses on other thread: SQL seveloper connection issue with JDBC
-
Bulk Loading using remote sql statement execution
Well, i have a different scenario. I want to bulk load the tables like we do in MySQL with LOAD LOCAL DATA sql command.
I have a file populated with data, what sql statement would bulk load the data into specified table using that file?
Adnan MemonIn Oracle, you would either use the SQL*Loader utility to load data from a flat file or you would create an external table (9i and later) that loads the flat file.
A quick example of the external table approach
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
SQL statement performance issues
Hi: A sql statement I have is taking too long to complete. But if I break the statement into two separate statements, it runs fine.
SQL 1 runs fine and returns 163.
SELECT /*+ FIRST_ROWS */ entity_group.entity FROM auth, entity_group, user_group WHERE entity_group.auth_group = user_group.groupid and user_group.userid = auth.id and auth.username = 'ing';
SQL 2 runs fine, prints about 20 records
select /*+ FIRST_ROWS */ EVENT_DATA.info from EVENT_DATA, AGENTS where EVENT_DATA.agent_id = agents.id AND agents.entity IN (163);
SQL 3 takes a long time to run. The field AGENT_ID is indexed in EVENT_DATA.
select /*+ FIRST_ROWS */ EVENT_DATA.info from EVENT_DATA, AGENTS where EVENT_DATA.agent_id = agents.id AND agents.entity IN (SELECT /*+ FIRST_ROWS */ entity_group.entity FROM auth, entity_group, user_group WHERE entity_group.auth_group = user_group.groupid and user_group.userid = auth.id and auth.username = 'ing');
Any suggestions on improving the SQL statement or finding out if anything is wrong with the database.
Thanks
RaviFirst, lose the hints, analyse your tables and let the CBO do its job. If it is not fast enough. then Nicolas' solution may be faster.
Another possible construct would be:
SELECT event_data.info
FROM event_data, agents,
(SELECT DISTINCT entity_group.entity
FROM auth, entity_group, user_group
WHERE entity_group.auth_group = user_group.groupid and
user_group.userid = auth.id and
auth.username = 'ing') eg
WHERE event_data.agent_id = agents.id and
agents.entity = eg.entityTTFN
John -
SQL statement - Get records with single customerid
Hi,
I have this SQL statement as follows:
SELECT debit_balance,credit_balance,customer_id
FROM table_balance
WHERE customer_id IN (SELECT customer_id
FROM table_balance
GROUP BY customer_id HAVING COUNT (customer_id)= 1)
{code}_Data:_
{code:java}
debit_balance: credit_balance: customer_id:
50 40 1
10 0 1
20 1 2
0 2 3
121 234 3
{code}_Expected results:_
{code:java}
debit_balance: credit_balance: customer_id:
20 1 2
{code}From my SQL statement, I think my code is not that efficient. How do I make it even more efficient?Use analytics
SQL> with t as
2 (
3 select 50 a, 40 b,1 c from dual
4 union all
5 select 10, 0, 1 from dual
6 union all
7 select 20, 1, 2 from dual
8 union all
9 select 0, 2, 3 from dual
10 union all
11 select 121,234,3 from dual
12 )
13 select a,b,c
14 from (
15 select count(c) over(partition by c order by c) cnt, t.*
16 from t)
17 where cnt = 1
18 /
A B C
20 1 2 -
Sql statement not working with for update
Hi, iam facing an error fetch out of sequence
when iam trying to execute a sql statement
Statement st=con.createStatement();
st.executeQuery(select mycolumn from table where jobno=1 for update);
the statement works well without " for update ".
any solutions????Hi,
The fetch out of sequence error occurs usually when you are trying to read from a cursor that has no data left(like EOF).
After executing the sql statement move the pointer to the first row (or the beginning of the resultset)
This is actually an oracle error bearing number :ORA:01002
Hope this helps.
Thanks,
Creator Team. -
Hi,
Can anyone explain my below doubt as i get confused each time when i refer any online documents.
when we hit a SQL statement to execute in oracle, how SQL engine process the statement and which memory structure in oracle instance is used in the process?
Many Thanks,
Vipin Kumar RaiAnarGodjaev wrote:
Hi,
Below link:
SQL Limitations For Oracle Database Lite
http://awads.net/wp/2010/02/15/oracle-database-limits-you-may-not-know-about/
More Information: PL/SQL Program Limits
Thank you
Why are you posting all these odd links?
First you post a link to ancient and out of date oracle 7 documentation.
Now you're posting a link to Oracle Database Lite.
And a link to someone's blog about the database limits that is just a duplication of what's in the documentation.
None of these were specifically mentioned by the OP as a requirement for the question.
The forum does not need things sharing just because you feel like it, as that can amount to spamming. If you have specific information relevant to the question then please post it, but otherwise don't just post loads of links for no good reason; and any links you do post, make sure they relate to currently supported versions of the database unless the OP specifies otherwise.
Aside from that, if you're just googling for links to post, in the hope of giving an quick answer and getting points on the forum... please don't bother. This sort of behaviour is noticed and will be reported to the admin who may terminate your account for such things. -
Hi,
Facing Database performance issue while runing overnight batches.
Generate tfprof output for that batch and found some sql query which is having high elapsed time. Could any one please let me know what is the issue for this. It will also be great help if anyone suggest what need to be done as per tuning of this sql queries so as to get better responce time.
Waiting for your reply.
Effected SQL List:
INSERT INTO INVTRNEE (TRANS_SESSION, TRANS_SEQUENCE, TRANS_ORG_CHILD,
TRANS_PRD_CHILD, TRANS_TRN_CODE, TRANS_TYPE_CODE, TRANS_DATE, INV_MRPT_CODE,
INV_DRPT_CODE, TRANS_CURR_CODE, PROC_SOURCE, TRANS_REF, TRANS_REF2,
TRANS_QTY, TRANS_RETL, TRANS_COST, TRANS_VAT, TRANS_POS_EXT_TOTAL,
INNER_PK_TECH_KEY, TRANS_INNERS, TRANS_EACHES, TRANS_UOM, TRANS_WEIGHT,
TRANS_WEIGHT_UOM )
VALUES
(:B22 , :B1 , :B2 , :B3 , :B4 , :B5 , :B21 , :B6 , :B7 , :B8 , :B20 , :B19 ,
NULL, :B9 , :B10 , :B11 , 0.0, :B12 , :B13 , :B14 , :B15 , :B16 , :B17 ,
:B18 )
call count cpu elapsed disk query current rows
Parse 722 0.09 0.04 0 0 0 0
Execute 1060 7.96 83.01 11442 21598 88401 149973
Fetch 0 0.00 0.00 0 0 0 0
total 1782 8.05 83.06 11442 21598 88401 149973
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
UPDATE /*+ ROWID(TRFDTLEE) */TRFDTLEE SET TRF_STATUS = :B2
WHERE
ROWID = :B1
call count cpu elapsed disk query current rows
Parse 635 0.03 0.01 0 0 0 0
Execute 49902 14.48 271.25 41803 80704 355837 49902
Fetch 0 0.00 0.00 0 0 0 0
total 50537 14.51 271.27 41803 80704 355837 49902
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
DECLARE
var_trans_session invtrnee.trans_session%TYPE;
BEGIN
-- ADDED BY SHANKAR ON 08/29/97
-- GET THE NEXT AVAILABLE TRANS_SESSION
bastkey('trans_session',0,var_trans_session,'T');
-- MAS001
uk_trfbapuo_auto(var_trans_session,'UPLOAD','T',300);
-- MAS001 end
END;
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 24191.23 24028.57 8172196 10533885 187888 1
Fetch 0 0.00 0.00 0 0 0 0
total 1 24191.23 24028.57 8172196 10533885 187888 1
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer goal: CHOOSE
SELECT INNER_PK_TECH_KEY
FROM
PRDPCDEE WHERE PRD_LVL_CHILD = :B1 AND LOOSE_PACK_FLAG = 'T'
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 56081 1.90 2.03 0 0 0 0
Fetch 56081 11.07 458.58 53792 246017 0 56081
total 112163 12.98 460.61 53792 246017 0 56081
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
******************First off, be aware of the assumptions I'm making. The SQL you presented above strongly suggests (to me at least) that you have cursor for loops. If that's the case, you need to review what their purpose is and look to convert them into single statement DML commands. For example if you have something like this
DECLARE
ln_Count NUMBER;
ln_SomeValue NUMBER;
BEGIN
FOR lcr_Row IN ( SELECT pk_id,col1,col2 FROM some_table)
LOOP
SELECT
COUNT(*)
INTO
ln_COunt
FROM
target_table
WHERE
pk_id = lcr_Row.pk_id;
IF ln_Count = 0 THEN
SELECT
some_value
INTO
ln_SomeValue
FROM
some_other_table
WHERE
pk_id = lcr_Row.col1
INSERT
INTO
target_table
( pk_id,
some_other_value,
col2
VALUES
( lcr_Row.col1,
ln_SomeValue,
lcr_Row.col2
ELSE
UPDATE
target_table
SET
some_other_value = ln_SomeValue
WHERE
pk_id = lcr_Row.col1;
END IF;
END LOOP;
END; it could be rewritten as
DECLARE
BEGIN
MERGE INTO target_table b
USING ( SELECT
a.pk_id,
a.col2,
b.some_value
FROM
some_table a,
some_other_table b
WHERE
b.pk_id = a.col1
) e
ON (b.pk_id = e.pk_id)
WHEN MATCHED THEN
UPDATE SET b.some_other_value = e.some_value
WHEN NOT MATCHED THEN
INSERT ( b.pk_id,
b.col2,
b.some_other_value)
VALUES( b.pk_id,
b.col2,
b.some_value);
END;It's going to take a bit of analysis and work but the fastest and most scalable way to approach processing data is to use SQL rather than PL/SQL. PL/SQL data processing i.e. cursor loops should be an option of last resort.
HTH
David -
SQL Dev converts MS SQL to Oracle - issue with numeric prefix column name
Hi,
We're working on migrating MS SQL data into Oracle 10g. An issue we encountered is that some of MS SQL's tables have column names with numeric prefix like 1Q07, 2Q07, ..., 4Q08, and so on. The converted model as well as script can be created. But one thing I notice is that SQL Dev appends a prefix "A" for column names with numeric prefix. This makes sense because Oracle does not allow a column with number. But somehow this does not work with only 4Q
1Q04 => A1Q01
2Q07 => A2Q07
3Q08 => A3Q08
4Q08 => 4Q08 ???
Why? Any place in the tool where I can override this?
Obviously I can manually modify column name 4Q08 to A4Q08 in the script. But by doing this when moving data, it would fail because tool has no knowledge of updated column name.
Thanks in advance.Hi ittichai,
In <repository>.MIGRATION_TRANSFORMER body
FUNCTION first_char_check(p_work NVARCHAR2) RETURN NVARCHAR2
v_allowed := C_DISALLOWED_CHARS || '012356789_$';
should be
v_allowed := C_DISALLOWED_CHARS || '0123456789_$';
If you make this change and convert the 4Q08 will be
A4Q08 is expected, without any manual rename.
-Turloch
Message was edited by:
Turloch O'Tierney -
Customer account statement has issue with dual currency.
Hello Experts,
As per your clients requirement we have modified the form for customer account statement for ETHIOPIA.
In the requirement we have asked to get the opening balance of the customer. For example we are running the report for the period 01.03.2010 to 31.05.2010. In this case client what us to display the balance up to 28.02.2010 as opening balance, where we are using the function module BAPI_AR_ACC_GETKEYDATEBALANCE to bring the opening balance.
Know your issue is when we are doing this process the account ageing for opening balance is not getting displayed in the customer account statement. When we followed the standard functionally then it was working fine. But the issue comes when there is a dual currency for some of the customers where we are getting two accounts ageing for two different currencies. To void this we have taken the arrear field from FBL5N report as base so that we can have single account ageing, which was working fine. But in this process no account ageing is getting displayed for opening balance.
Can someone help me on this issue?
Thanks and Regards,
Rajesh Kumar Mantri.Hi,
Sorry we have done that and not successful in find the solution. Any other solution.
Thanks and Regards,
Rajesh Kumar Mantri. -
Sql Server Connectivity issue with ODI Data Profiler
Hi all,
To profile data from SQL Server Data source, i had created a ODBC connection(using Windows NT authentication) in the system and it was successful. Created a connection with Type ODBC connection in Loader Connections along with System name, Port No and DSN Name. But while trying to connect the database it is throwing an error as Authentication Failed. Please guide me.ODI's DP does not support the use of sourcing data on the ODBC data source. You must extract to a file, and use the file as the input.
-
Udate SQL statement fomat issue...
Hello. I am trying to build an SQL UPDATE stmnt. , where i am using a record set to update a table. I am new to Java - I am/was able to create (separte) INSERT and DELETE SQL/CLASSES. The syntax on the Update is giving me problems (because i am a "grasshopper" no doubt). Here is the code( along with the editor errors):
String sInsertStmt;
sInsertStmt = "UPDATE cen572.vwebitem_test SET waurlc = "' rs2.getString("WAURLC") '"
CLE0001W String literals must end before the end of the source line.
WHERE WAITEMG = rs2.getString("WAITEMG")";
CLE0001W String literals must end before the end of the source line.
Thank you in advance for any tips/help that you might have to offer, i greatly appreciate it.thanks again. What if i want to update multy. fields - would this work:
System.out.println (rs2.getString("WAITEMG")); /* try this*/
String sUpdateStmt;
sUpdateStmt = "UPDATE cen572.vwebitem_test SET waurlc = '" + rs2.getString("WAURLC") + "'
SET waurli = '" + rs2.getString("WAURLI") + "'
SET waleadf = '" + rs2.getString("WALEADF") + "'";.
I seem to get error messages. I need to update multy fields. Thank you (all) again for your input, it is greatly appreciated. -
I was perusing the error console, and found many instances of this error,
I was perusing the error console, and found many instances of this error,
Maybe you are looking for
-
Super Slow Load times- 10.5.2 / 8.01
Since I did the upgrades logic takes a lot lot longer to load. It works fine eventually but something is not right. I had to do an archive and install. Are there some files that Logic is looking for, while loading, in the System folder which are not
-
Hello, Any one used row repeter UI element. how do we use this in our application. I have one case can we use it in this. I need to add my input feilds in runtime. means I have a input feild on my screen and a add button when I press add button, I sh
-
Hi, I have an ALV with all the cell editors of the columns are input fields. But, the point is, the rows are not editable and it is not allowing me to do copy paste. Is there any way to do this. Best Regards Sid
-
Hi, Does anyone have experience of using the AcceptClientCertWithoutSSL parameter in the portal? We currently have an HTTPS portal, authenticating with Client Certificates. We would like to put Web Dispatcher in front of the portal and use it to term
-
Protecting VMs against host power-offs
Every now and then and for numerous reasons, my Windows 8 desktop encounters a loss of power. I am running a Debian 6 virtual machine via HyperV and when I restore power, the VM kernel panics every single time. Rebooting the VM results in the disk be