SQL statement works as a View... however
Question: Why does a SQL statement works in the "View" or in
a stored procedure works, however when I turn it into
<cfquery> it does not work. Does anyone have any
ideas?
What is the db and what is the sql? Also, in what way does it
not work?
Similar Messages
-
SQL statement works with SQL/Plus - but not with ODBC
Hi all,
I have a rather copmplex SQL statement:
BEGIN
UPDATE ContentDataTable
SET SYMBOLIC_PATH_PARENT = N'/Test',
SYMBOLIC_NAME = N'HAWK01.GIF',
VERSION_NUMBER = 1 +
SELECT MAX(VERSION)
FROM
(SELECT MAX(VERSION_NUMBER) AS VERSION
FROM ContentDataTable WHERE
SYMBOLIC_PATH_PARENT = N'/Test' AND
SYMBOLIC_NAME = N'HAWK01.GIF'
UNION
SELECT MAX(VERSION_NUMBER) AS VERSION
FROM RevisedContentDataTable WHERE
SYMBOLIC_PATH_PARENT = N'/Test' AND
SYMBOLIC_NAME = N'HAWK01.GIF'))
WHERE SYMBOLIC_PATH_PARENT = N'/Test' AND SYMBOLIC_NAME = N'HAWK02.GIF' AND VERSION_NUMBER = 1;
END;
It works fine in SQL/Plus or SQL Worksheet and does what it should do ;-)
But when using it via ADO (ODBC Driver) I get the following error:
PLS-00103 found 'string' but expected one of the following: 'string'"}
Any idaes?
Thanx,
Christian
nullPardon my ignorance, but what's the significance of the N'<string>' construction? That's not one I'm familar with.
Justin -
SQL Statement Works In sqlplus, Not Grid Ctl For User Defined Metric
I'm trying these queries:
Query 1:
select '0', '0' from dual
union
SELECT
to_char(d.sid),
to_char(d.serial#)
FROM v$sql a,
dba_Users c,
v$session d
WHERE
c.Username = 'SYSADM'
AND (a.Elapsed_Time * 0.000001 > 5
OR a.Executions > 1000)
AND a.Executions > 0
AND c.User_Id = a.ParSing_User_Id
AND (Round(a.Elapsed_Time * 0.000001 / a.Executions)) > 10
AND a.last_active_time > (sysdate - 1)
and a.sql_id = d.sql_id
Query 2:
select 0, 0 from dual
union
SELECT
d.sid,
d.serial#
FROM v$sql a,
dba_Users c,
v$session d
WHERE
c.Username = 'SYSADM'
AND (a.Elapsed_Time * 0.000001 > 5
OR a.Executions > 1000)
AND a.Executions > 0
AND c.User_Id = a.ParSing_User_Id
AND (Round(a.Elapsed_Time * 0.000001 / a.Executions)) > 10
AND a.last_active_time > (sysdate - 1)
and a.sql_id = d.sql_id
As you can see, Query 1 is selecting character results, Query 2 is selecting numerical results. Both work from sqlplus on the host. Trying to run either of them in a user defined metric in Grid Control returns: ORA-00918: column ambiguously defined
1. Why is the error returned in Grid Control?
2. Is there a way to see exactly which column Grid Control has the issue with?Never mind, I got it.
-
I have intermittant issues importing files and folders into Final Cut Pro. When the window to select the file or folder I want pops up, I often don't have the ability to select an item when the window is in list view, but when I switch to icon view, the open button loses its greyed out appearance and I'm able to select a file or folder.
I'm running FCP 7.0.3 and OS 10.5.8. At first thinking this could be an OS issue, I tried attaching a file to an email within Chrome and didn't have a problem selecting and opening files from a list window.
I trashed my FCP preferences and user data info, hoping this would resolve the issue, but it hasn't. Thoughts?
Thanks in advance for any advice you can offer.Thanks, Luis. I had selected FCP 7 in the drop down. Not sure how it got moved to X. And don't see an edit option on my original post.
-
Same SQL Statement Works in Data Service but not in its Input Port
Hi Experts,
I am using this query in one of my data service. Test execute success which returned:
E U H M L
2 Less Than 1 Week 0 0 0 0 0
3 1 - 2 weeks 0 0 0 0 0
4 2 - 4weeks 0 0 0 0 0
5 More Than 1 Month 0 0 6 0 0
However, when i copy the same query to the input port, enclosing it with "[my query]"
Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
#1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
[EXCEPTION]
#1#java.lang.NullPointerException
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
Any idea what is the mistake?
Thanks in Advance,
SarahHi Experts,
I am using this query in one of my data service. Test execute success which returned:
E U H M L
2 Less Than 1 Week 0 0 0 0 0
3 1 - 2 weeks 0 0 0 0 0
4 2 - 4weeks 0 0 0 0 0
5 More Than 1 Month 0 0 6 0 0
However, when i copy the same query to the input port, enclosing it with "[my query]"
Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
#1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
[EXCEPTION]
#1#java.lang.NullPointerException
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
Any idea what is the mistake?
Thanks in Advance,
Sarah -
I cannot figure how to get the text(SQL statement) from a system view(i guess it is in a system view... but witch??). 'Till now i have the sql_address and the sql_hash_value..
I know it is possible.. EM does it ... so i should be able to do the same..
ps:I use 9.2v$sql ?
-
OO4O & VC++ Access Violation with large sql statement
Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
Windows 98/NT/2000/XP.
Open a dynaset with a large sql statemant more then 1000 chars you get
a Access Violation, like below.
szSQL = "select..."
ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
Any ideas?I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
I will try using a new JDBC driver, hope it works, I am just struggling to find a free one -
OO4O & VC++ Access Violation with large sql statement - REPOST
This is a repost - my email address was incorrect on the previous message
OO4O & VC++ Access Violation with large sql statement
Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
Windows 98/NT/2000/XP.
Open a dynaset with a large sql statemant more then 1000 chars you get
a Access Violation, like below.
szSQL = "select..."
ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
Any ideas?
[email protected]I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
I will try using a new JDBC driver, hope it works, I am just struggling to find a free one -
Sql statement causes my JRun server to fail.
I'm beginning JSP and can't go through this recurrent error: the first request to the JSP page containing sql statement works well, in the second, an error occurs and finally, the third forces my Jrun server to fail with a stack error...
<CODE>
<%-- page global declaratiosn --%>
<%@ page import="java.sql.*,javax.sql.*,allaire.taglib.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
String url = "jdbc:odbc:ademeregion" ;
Connection con = DriverManager.getConnection( url , "" , "" ) ;
Statement stmt = con.createStatement();
ResultSet itom = stmt.executeQuery( "SELECT * FROM ITOM" ) ;
ResultSetMetaData itomMetaData = itom.getMetaData( ) ;
out.print( getServletContext().getInitParameter( "test" ) + "<br>" ) ;
%>
<table border=1 cellspadding=0 cellspacing=0>
<%
while( itom.next() ){%>
<tr>
<%
for (int i = 1 ; i <= itomMetaData.getColumnCount() ; i++ ){
out.print( "<td><font face=Verdana color=#EEEEEE size=1>" + itom.getString( i ) + "</font></td>") ;
%>
</tr><%
%>
</CODE>
I assume it could be a typical jdbc problem that beginners encounter...
Help required...
Thanks a lot...
SylvainThnks but it's allready done:
I had the following code allready:
<%
itom = null ;
itomMetaData = null ;
stmt.close( ) ;
con.close( ) ;
%>
But thanks anyway... -
Hi,
I am trying to find where I can find the log for users being unlocked thru a SQL statement and this is viewved in the DB. BUT funny thing is that SU01 doesnt show last changed according to the log.
I need to know how to view or which table it is in ORACLE table for me to view this information, tks.Hi Jack,
which users do you want to look up in the DB? Users in the ABAP systes are changed using tx SU01 or something similiar. Even if an IDM is being used, most of the will use functionality of the ABAP user management to update this info. In this case, changes will be done to tables like USR* and recorded in different tables like USH*. You would then look up the info in tx SUIM.
If a user would be unlocked directly on the database using SQL commands, this would result in a direct modification of table USR02. You could spot this by inconsistencies in tabel USR02 and USH02. However I would guess the real modification can only be detected using table logging on table USR02.
However except for the SAP ABAP system, I would hope no one has access to these tables, so I'm not sure where you are heading to.
Regards,
Patrick -
BIDS 2008 DataFlow viewer not showing even though the sql statement returns data
Have a dataflow and trying to see why no rows are being written to the destination. I popped a viewer on the connection, but it doesnt show up when I run. What can I check?
The DataFlow source runs a sql statement and it runs fine and returns a result.Why would that be if I can execute the sql statement that is being used in the OLEDB Source, and I get a result, yet the destination gets no rows afterwards. Even executing the Dataflow task by itself, no rows are written.
I do have a script task that modifies the connection before the dataflow, but this was working fine yesterday :)
Even so, if there was a problem with the connection, I would get an error. There no no errors, it just sees no rows and the dataviewer is never displayed.
What the heck can I check? -
Logging/viewing SQL statements generated by the SQL Developer IDE?
I know it is possible to view the SQL statements that the SQL Developer IDE generates to fetch result-sets from the database whenever one performs any action - say expanding the "Tables" node for a database, for example. I would appreciate if someone could point out how this functionality could be enabled.
Thanks,
RGIn 1.0, you could use the AddVMOption -Daudit.trace=db_api option inside the sqldeveloper.conf file.
In 1.1 however, I don't get output inside the console anymore (for expanding trees, etc.).
Kris, has this option been replaced by another one? Please let us in on all the fun ;-)
K. -
SQL Statement not works using functions or subqueries-MAXDB
Hello All,
I created an ABAP program to select information about country(table: T005) with the country names (Table: T005T). I tried to create a sql query with a sql subquery to select everything but for some reason that I don't know it doesn't work. Please find the query below.
DATA:
resu TYPE REF TO cl_sql_result_set ,
stmt TYPE REF TO cl_sql_statement ,
qury TYPE string .
qury = `SELECT land1, spras, `
&& `(SELECT landx `
&& `FROM SAPNSP.T005T `
&& `WHERE mandt = '` && sy-mandt && `' `
&& `AND spras = 'EN' `
&& `AND land1 = ? ), `
&& `(SELECT natio `
&& `FROM SAPNSP.T005T `
&& `WHERE mandt = '` && sy-mandt && `' `
&& `AND spras = 'EN' `
&& `AND land1 = ? ) `
&& `FROM SAPNSP.T005 `
&& `WHERE mandt = '` && sy-mandt && `' `
&& `AND land1 = ? `
&& `GROUP BY land1, spras` .
resu = stmt->execute_query( qury ) .
Well, the query above works but the fields LANDX and NATIO are in blank in ALL THE CASES, even with information registred in table T005T.
So, exploring the SDN forum and after read some documents regarding ADBC, I create a function to handle this sql select and get the correctly the missing informations, but, still don't work. Please find the function below:
CREATE FUNCTION select_landx (land1 CHAR(3)) RETURNS CHAR(15)
AS
VAR landx CHAR(15);
DECLARE functionresult CURSOR FOR
SELECT spras, land1, landx
FROM SAPNSP.t005t
WHERE spras = 'EN'
AND land1 = :land1;
IF $count IS NULL THEN <- | $count is always 0, my SELECT
BEGIN it's not work but I don't know why
CLOSE functionresult;
RETURN NULL;
END
ELSE
SET $rc = 0;
WHILE $rc = 0 DO
BEGIN
FETCH functionresult INTO :landx;
END;
CLOSE functionresult;
RETURN landx;
Calling the function in a SQL statement:
DATA:
resu TYPE REF TO cl_sql_result_set ,
stmt TYPE REF TO cl_sql_statement ,
qury TYPE string .
qury = `SELECT land1, spras, select_landx(?) landx `
&& `FROM SAPNSP.T005 `
&& `WHERE mandt = '` && sy-mandt && `' `
&& `AND land1 = ? `
&& `GROUP BY land1, spras` .
resu = stmt->execute_query( qury ) .
Any comments ?
Best regards,
Arthur SilvaHello,
Thank's a lot, it works. It's funny because the given solution works using only abap codes.
It may be happens because the abap interpretor send the sql statement to the db interface that handle the code in the another way.
Thanks again, it was driving me crazy.
Best regards,
Arthur Silva -
Which view contains the exact sql statement
Dear All,
Developers have used bind variables in their sql inside their applications (for example: SELECT Name FROM Employee WHERE EmployeeID =:empno)
This bind variable is supplied a value within the application. I wanted to know which data dictionary view will give me the exact sql statement which gets executed.
For example SELECT Name FROM Employee WHERE EmployeeID = 100;
When I query V$SQL, V$SQLAREA, V$SQLTEXT, I get the same query with the bind variables (SELECT Name FROM Employee WHERE EmployeeID =:empno), instead can i get the query which actually holds the value for the bind variable.
Regards,
qAhttp://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4254158186083#75306330816538
-
Query with JPA not working. Is possible to see the executed SQL statements?
Hi all,
I have a question regarding namedqueries. I am having an error for which I am not being able to find any solution. ORM mappings seem to be ok, and the EntityManager validates correctly. However I am getting an error when trying to retrieve some results. My question is if it is possible to retrieve the set of SQL statements queried on the server, to see if it is due to a different issue than JPA settings.
Thanks in advance,
Chal-lo.You can enable sql logging in a provider specific way (e.g for hibernate you add hibernate.show_sql=true in the hibernate.properties file).
You could get more help if you described the problem you are getting.
Maybe you are looking for
-
T60p after pressing Fn + blue key icon will not fade out
The icon at the borrom center of the screen will not go away. As soon as I select Fn +brightness or Fn + sound, etc the little icon at the bottom of the screen stays forever. Re-booting and the latest updates don't help and I can't find a setting for
-
Why won't my flash player work on my mac OS x 10.7.5 lion???
everytime i try to play a video on youtube or what ever, i get a message telling me to download the new flash player though i've already installled it and tried many times to reinstall it. flash player 11.6.602.167. i am using sfari as my web browse
-
Airport supreme software upgrades for OS 10.9.5
Mt time machine is full and stoped backing up. I dumped a bunch of stuff from my wifes macair old backups and now it's backing us up again but all my old backups are unreadable. My airport extreme utility (the short square variety) is using 5.5.3 and
-
6.3 - Insync Time is 10 minutes off....
DS 6.3 - insync utility [ldap@ldap1] /opt/ldap $ date Wed Mar 18 *15:19:08* CDT 2009 [ldap@ldap1] /opt/ldap $ insync -d -d -n -t -T 5 -D "cn=directory manager" -w PASSWD -s ldap-1:13902 -c ldap-3:13902 ReplicaDn Consumer Supplier Delay Transport dc=c
-
I just got another iphone, new sim same number same account, my messeges use to show on my mac, but now they dont and i already logged in to icloud from the mac and still nothinG, i use to be able to recieve my imesseges including none iphone messege