Quote phenomenon in Recordset SQL
Why I try this in one database and it doesn't work:
$query_Recordset1 = sprintf("SELECT * FROM change WHERE change.Changes_made LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
but why i put quotes then it works
$query_Recordset1 = sprintf("SELECT * FROM `change` WHERE `Changes_made` LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
I tried this on another database and the query works without the quote. Can anyone explain this strange phenomenon?
Thanks, I will be sure to avoid the reserved word, or else I will have the trouble of putting lots of quotes.
The link to the SQL 5.1 reserved words is shown below:
http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
Similar Messages
-
How to run recordset SQL query in FORM DATA event
How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?
Hi Slamet,
When you receive a form data event you have a class containing inside it a ObjectKeys xml info regarding the object added/modified,...
With the objects keys you can then use the DI API method called GetByKeys to obtain the DI Object.
There is some information about it in the SDK Help file, mainly in the "FormDataEvent" class definition:
<i>The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.</i>
Pay attention you don't have this information in the Before=True event of the Add as it is not yet in the database.
Hope it helps
Trinidad. -
Error while passing parameter(quoted string parameter ) to sql script
Hi all,
I have a master script insert_attribute_single.sql which takes 6 parameter. when i am using in sql prompt
SQL>@@INSERT_ATTRIBUTE_SINGLE.SQL 'LEED PROJECT START DATE' 7 'N' 27265185 '7'22'008' NULL;
then it is giving error for the 5th parameter. and i need to pass 5th parameter '7'22'008' in this.
in the master script it is giving error - ORA-06550 here.
dbms_output.put_line('Processing attribute : &1 Project : &4 Char value : &5 Numeric Value : &6 ' ) ;
can you please help me to resolve this with single quotes in string.
Thanks in advance.
regards
shyam~Here is my sql file:
declare
a_Var VARCHAR2(10) := '&1';
begin
dbms_output.put_line(a_var||','||'&2');
end;
/Here is how I am calling the sql file with parameter values containing quotes in itself:
SQL> @@d:\a.sql '12''''23''''23' '123'
old 2: a_Var VARCHAR2(10) := '&1';
new 2: a_Var VARCHAR2(10) := '12''23''23';
old 4: dbms_output.put_line(a_var||','||'&2');
new 4: dbms_output.put_line(a_var||','||'123');
12'23'23,123
PL/SQL procedure successfully completed.
SQL> -
Double quote encapsulated identifiers in sql developer 1.5.1
hello,
i migrated a mysql database to oracle using the sql developer 1.5.1 on linux. unfortunately i'm using some reserved words in my table name / columns. how is it possible to generate an import script that uses double quote encapsulated identifiers? in the migration workbench, there is an option named "Create ANSI-compilant names" which should do what i need, but i cannot find this option in sql developer.
thank you for your help. regards,
sebastianI'm not sure what your question is; Did you migrate successfully? How do you generate an import script? What is failing? Can you provide an example?
K. -
Hi,
I'm implementing an ASP Javascript page where the items in a
database are returned and sorted based on the results of a
drop-down function. I have it working as follows:
var Recordset1__MMColParam = "Cutting";
if (String(Request("MM_EmptyValue")) != "undefined"
String(Request("MM_EmptyValue")) != "") {
Recordset1__MMColParam = String(Request("MM_EmptyValue"));
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
if not isempty(request("Select")) then
select case request("Select")
case "Brand"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Brand;"
case "High"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Our_Price DESC;"
case "Low"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Our_Price ASC;"
end select
else
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
special_sort ASC;"
end if
</script>
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.CommandText = sql;
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200, 1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
The issue is the line in bold, setting the SQL statement to
be a variable statement where all the parameters are resolved
outside of Dreamweaver, except for the Department, which is defined
by MMColParam. When setting
Recordset1_cmd.CommandText = sql, Dreamweaver no longer
displays the Recordset1 in the Server Behaviour window and all the
server behaviours on the page have a red exclamation mark --
however, the page itself works perfectly (including all server
behaviours). Since I no longer see the Recordset in the server
behaviour window or in the Bindings tab, I can't add new behaviours
or add new bindings to the page (without hand-coding it).
Any ideas?
Neal.MacGyver_971 wrote:
> That's kinda silly. There are many things you cannot do
within the Recordset
> dialog box, and it hasn't changed in years either. Add
to that, I've tried
> (unsuccessfully) to install the updated ADDT for CS4,
which may give me
> additional flexibility, but DW simply crashes when that
extension is installed.
ADDT is not yet compatible with CS4. I've heard others
mention early 2009 was when it would be released, but no news
recently.
> So how are we supposed to create something relatively
simple within
> Dreamweaver like sort a database based on the results of
a drop-down list box
> -- without breaking DW?
It's easy to filter a column value from a form field,
however, Dreamweaver seems to not be able to handle dynamic column
names (which you're doing) or even dynamic sort orders. And I'm
sure there are a number of other things that DW will potentially
choke on. As long as you end up with valid SQL, the generated
recordset can be used, but as you've seen the recordset may not be
available in the Server Behaviors panel, or in the bindings panel.
Here's a suggestion:
1. Copy your recordset opening code block. From your earlier
post:
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.CommandText = sql;
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200,
1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
2. Paste that code immediately after the code block you
copied.
3. Delete the line with your sql variable.
4. Then comment out the code by adding /* at the beginning
and */ at the end. Like so:
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200,
1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
That should allow you to have DW recognize the recordset from
the commented out code block and not the one that you're generating
dynamically.
In a quick test locally, that seemed to work fine for ASP
JavaScript. For others listening in, ASP VBScript may not work out
so well as it doesn't allow for multi-line comments (that I'm aware
of), and you may run into issues with re-dimmed variables, so play
around with commenting out some lines and maybe you'll find a combo
that works.
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert -
Dumb double quote question in my SQL.
This maybe a dumb question, but I want the rownum to appear in my query output and not the word 'rownum' - what am I missing. Maybe one too many quotes or missing one somewhere.
select '**''9'',''f21'',''|| rownum - 1 ||''**' from dual;
I want this ==> **'9','f21','1'**
NOT this ==> **'9','f21','|| rownum - 1 ||'**
Cheers
John.SQL> select '**'||'9'||','||chr(39)||'f21'||chr(39)||','||chr(39)||to_char(rownum-1)||chr(39)||''||'**' from dual
2 /
'**'||'9'||','||CHR(39)||'F21'||CHR(39)||','||CHR(39)|
**9,'f21','0'**But you will always get 0 rownum-1.
Khurram
Message was edited by:
Khurram Siddiqui -
How to return a recordset (SQL)
I would like to know if it is possible to return a record set from a procedure and if so how?
Thanks in advance for any help.If you find out how to... could you please let me know it...
Thanks... I'm looking for the same thing.
my email: [email protected] -
SQL Injection, replace single quote with two single quotes?
Is replacing a single quote with two single quotes adequate
for eliminating
SQL injection attacks? This article (
http://www.devguru.com/features/kb/kb100206.asp
) offers that advice, and it
enabled me to allow users to search name fields in the
database that contain
single quotes.
I was advised to use "Paramaterized SQL" in an earlier post,
but I can't
understand the concept behind that method, and whether it
applies to
queries, writes, or both.Then you can use both stored procedures and prepared
statements.
Both provide better protection than simply replacing
apostrophes.
Prepared statements are simple:
Set myCommand = Server.CreateObject("ADODB.Command")
...snip...
myCommand.CommandText = "INSERT INTO Users([Name], [Email])
VALUES (?, ?)"
...snip...
myCommand.Parameters.Append
myCommand.CreateParameter("@Name",200,1,50,Name)
myCommand.Parameters.Append
myCommand.CreateParameter("@Email",200,1,50,Email)
myCommand.Execute ,,128 'the ,,128 sets execution flags that
tell ADO not to
look for rows to be returned. This saves the expense of
creating a
recordset object you don't need.
Stored procedures are executed in a similar manner. DW can
help you with a
stored procedure through the "Command (Stored Procedure)"
server behavior.
You can see a full example of a prepared statement by looking
at DW's
recordset code after you've created a recordset using version
8.02.
"Mike Z" <[email protected]> wrote in message
news:eo5idq$3qr$[email protected]..
>I should have repeated this, I am using VBScript in ASP,
with an Access DB.
> -
SQL error: Error creating fake recordset:
Hello, I have this problem with a login page but only in the server, in local (wamp) I have no problem. Someone can help me? Thanks
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /httpdocs/includes/common/lib/db/KT_Connection.class.php on line 71
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /httpdocs/includes/common/lib/db/KT_Connection.class.php on line 71
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in httpdocs/includes/common/lib/db/KT_Connection.class.php on line 92
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in httpdocs/includes/common/lib/db/KT_Connection.class.php on line 105
Errore:
Errore interno.
Developer Details:
tNG_fields.getFakeRecordset:
SQL error: Error creating fake recordset:
SQL:
SELECT '' AS kt_login_user, '' AS kt_login_password, '0' AS kt_login_rememberme (FIELDS_FAKE_RS_ERROR)
tNG Execution Trace - VIEW
tNG_login.executeTransaction
STARTER.Trigger_Default_Starter
tNG_login.getRecordset
tNG_login.getLocalRecordset
tNG_login.getFakeRecordset* (in red)-----
These are the privileges. They are ok to create temporary tables?
yes, as "all privileges" also includes granting the "CREATE TEMPORARY TABLES" privilege.
Granting each and every possible privilege is of course pretty insecure, and I would never do that on a public webserver -- that said, you can also narrow down the privileges like this:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TEMPORARY TABLES ON database.* TO username@'localhost' IDENTIFIED BY 'password';
please see a list of possible privileges and their meaning here: http://kb.mediatemple.net/questions/788/HOWTO:+GRANT+privileges+in+MySQL
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
How to replace double quotes with a single quote in a string ?
Hi All:
Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
Thanks,
Dima.Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
REPLACE(
STN. 'A'{code}
Nicoals. -
Restful service unable to insert data using PL/SQL.
Hi all,
Am running: AL 2.01 standalone mode on OEL 4.8 in VM box A.
Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.
Able to performed oracle.example.hr Restful services with no problem.
Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
which uses the following table (under schema: scott):
create table json_demo ( title varchar2(20), description varchar2(1000) );
grant all on json_demo to apex_public_user; and below procedure ( scott's schema ):
CREATE OR REPLACE
PROCEDURE post(
p_url IN VARCHAR2,
p_message IN VARCHAR2,
p_response OUT VARCHAR2)
IS
l_end_loop BOOLEAN := false;
l_http_req utl_http.req;
l_http_resp utl_http.resp;
l_buffer CLOB;
l_data VARCHAR2(20000);
C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
BEGIN
-- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
-- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
-- rather than just returning the text of the error page.
utl_http.set_response_error_check(false);
-- Begin the post request
l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
-- Set the HTTP request headers
utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
-- Write the data to the body of the HTTP request
utl_http.write_text(l_http_req, p_message);
-- Process the request and get the response.
l_http_resp := utl_http.get_response (l_http_req);
dbms_output.put_line ('status code: ' || l_http_resp.status_code);
dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
LOOP
EXIT
WHEN l_end_loop;
BEGIN
utl_http.read_line(l_http_resp, l_buffer, true);
IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
l_data := l_data||l_buffer;
END IF;
EXCEPTION
WHEN utl_http.end_of_body THEN
l_end_loop := true;
END;
END LOOP;
dbms_output.put_line(l_data);
p_response:= l_data;
-- Look for client-side error and report it.
IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
dbms_output.put_line('Check the URL.');
utl_http.end_response(l_http_resp);
-- Look for server-side error and report it.
elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
dbms_output.put_line('Check if the Web site is up.');
utl_http.end_response(l_http_resp);
RETURN;
END IF;
utl_http.end_response (l_http_resp);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line (sqlerrm);
raise;
END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585/apex/demo';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
anonymous block completed
status code: 200
reason phrase: OK
with data inserted. Setup using 2.0.1
Workspace : wsdemo
RESTful Service Module: demo/
URI Template: test
Method: POST
Source Type: PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585//apex/wsdemo/demo/test';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
status code: 500
reason phrase: Internal Server Error
Listener's log:
Request Path passes syntax validation
Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
Applied database connection info
Attempting to process with PL/SQL Gateway
Not processed as PL/SQL Gateway request
Attempting to process as a RESTful Service
demo/test matches: demo/test score: 0
Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
Determining if request can be dispatched as a Tenanted RESTful Service
Request path has one path segment, continuing processing
Tenant Principal already established, cannot dispatch
Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
demo/test is a public resource
Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
Performing JDBC request as: SCOTT
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: Error occurred during execution of: [CALL, begin
insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
java.sql.SQLException: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
at $Proxy46.execute(Unknown Source)
at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
Error during evaluation of resource template: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idPlease advise.
Regards
ZackZack.L wrote:
Hi Andy,
Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
Source
begin
insert into scott.json_demo values(:title,:description);
end;
it's failing during the insert?
Yes, it failed during insert using AL2.0.1.
So the above statement produces the following error message:
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem. -
Switch from MySQL to MS SQL Server, Query not working
I'm sure there is a simple setting somewhere for this, but cannot seem to find it and really would appreciate some assistance. Have an application which uses JDBC to connect to a MySQL DB to run the following query without an issue:
SELECT * FROM users
This returns the desired results. Changed to connect to MS SQL Server 2000 using the JDBC-ODBC bridge and the same query returns no results. The problem, SQL Server wants this query instead:
SELECT * FROM [users]
I don't want to have to change queries depending on the DB, as that is supposed to be one of the advantages of JDBC. Is there a setting in MySQL (or the JDBC driver) to have it work correctly if I pass table names in []? Or is there a setting in MS SQL Server (or in the JDBC, or ODBC) to have it accept queries without the []?
Or is there a different approach that I'm missing which would avoid this whole problem?
Thanks,
MattI suspect your database definitions are different. It has nothing to do with your java code.
The bracket syntax is used to indicate the more standard quoted identifiers in standard SQL.
Thus you could do this in oracle and in MS SQL Server...
SELECT * FROM "users"
I suspect that the above will work for your MS SQL Server database and will not work for your Oracle database. However if you created the table in oracle and specifically used "users" (with the double quotes around the name) when creating the table then it would work.
Of course if the database definitions are different it means you must use different SQL for each. Just as if the name of the table was 'other' rather than 'users'. -
JDBC Adapter Quoting of String
Hi everybody!
I am posting data to a JDBC Receiver adapter using the JDBC adapter's XML format. I have configured the logging of the adapter to show the SQL commands issued to the adapter, since I received some strange errors from the database.
I now find entries like:
INSERT INTO xxx (field1, field2, field3) VALUES (value1, , value3)
Notice the "missing" value2 - the field's value is a space character (" "). However, I actually wanted to quote the values in this field, since this SQL command of course gives a syntax error because of the two consecutive commas...
How can I quote strings in this SQL command?
Regards, JoergHi,
I don't know if I stated my problem clearly enough... Here is the XML document I post to the JDBC adapter:
<root>
<insert>
<xxx action="INSERT">
<field1>value1</field1>
<field2> </field2>
<field3>value1</field3>
</xxx>
</insert>
</root>
(note the blank character for field2's value). If I understand your answer correctly, I should use the following instead:
<root>
<insert>
<xxx action="INSERT">
<field1>'value1'</field1>
<field2>' '</field2>
<field3>'value1'</field3>
</xxx>
</insert>
</root>
This is somewhat inconvenient, since there might be <b>NULL</b> values as well and I'd have to code manymany <b>if</b> statements and <b>mapWithDefaults</b>, then. I was wondering if there is something like the config setting "Interpretation of Empty String Values" for NULL values, some switch I set globally in order to <i>always</i> quote a string...
Regards, Joerg -
Hello Everyone
I am using database 11g. Can someone pl suggest what are the rules for putting single quotes for dynamic sql like
1) how many single quotes before/after a sql statement .
2) Rules for putting single quotes if there exists i) a variable in the sql statement
ii) a constant for e.g 100 in the sql statment.
If you could give the answers with a simple select statement, it will be even better !!!
Thanks and regards
Gautamms wrote:
Hello Everyone
I am using database 11g. Can someone pl suggest what are the rules for putting single quotes for dynamic sql like
1) how many single quotes before/after a sql statement .
2) Rules for putting single quotes if there exists i) a variable in the sql statement
ii) a constant for e.g 100 in the sql statment.
If you could give the answers with a simple select statement, it will be even better !!!
Thanks and regards
Gautamwrite the SQL statement as you would for any SQL client & enclose it using Q-quote
http://askanantha.blogspot.com/2007/12/q-quote-operator-introduced-in-oracle.html
Handle: ms
Status Level: Newbie
Registered: Jun 3, 2007
Total Posts: 46
Total Questions: 17 (17 unresolved)
WOW!
*NEVER got any answer in 5+ years & still wasting time here again, still!
You must be an eternal optimist.
I hope I get credited for your FIRST answer. -
SQL: Having problems passing a date value to dynamic SQL
SQL Version 2008 (not R2)
Problem: 1) I'm getting the following error message when trying to run the sql code below.
SQL "Messages" Returned when running code:
Msg 206, Level 16,
State 2, Procedure uspxc_WAWP_10_Get_VPData, Line 0
Operand type clash: int is incompatible with date
Loaded VP DATA for Month: 20121201
Problem Code Line:
SET @dynamicSQL = 'EXEC ' + @StoredProcedureName + ' ' + @DEVModeYN + ', ' + CAST(@WIPMonth as varchar);
Any help would be greatly appreciated. I've spent several hours trying to get around this error.
Full Code:
ALTER PROCEDURE [dbo].[uspxi_XIUD_98_DataConversionGET_VP_WIPJobHistory] (@DEVModeYN nchar(1) = 'D', @WIPMonth Date)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @returnCode AS INT ,
@dynamicSQL AS VARCHAR(8000),
@msg as varchar(60),
@DEVModeYN nchar(1) = 'D',
@WIPMonth date = '20121201',
@StoredProcedureName AS VARCHAR(60)
SET @returnCode = 0
SET @StoredProcedureName = 'uspxc_WAWP_10_Get_VPData'
-- Check to see if @StoredProcedureName exists in the database.
IF EXISTS(SELECT name FROM sys.procedures WHERE name = @StoredProcedureName)
BEGIN
-- RUN SP to Import VP Data for each WIPMonth parameter value
SET @dynamicSQL = 'EXEC ' + @StoredProcedureName + ' ' + @DEVModeYN + ', ' + CAST(@WIPMonth as varchar);
SELECT @dynamicSQL;
-- RUN stored procedure for WIP Month
EXEC (@dynamicSQL);
SET @returnCode = 0;
SELECT @returnCode;
SET @msg = 'Loaded VP DATA for Month: ' + @WIPMonth;
PRINT @msg;
GoTo SPEND
END
ELSE
SET @returnCode = 1;
SET @msg = 'NO DATA IMPORTED for Month: ' + CAST(@WIPMonth as varchar(10))
PRINT @msg
SPEND:
END
Bob SutorWhen you work with dynamic SQL, you should never build a full SQL string by concatenating values, because this is more difficult to get right and also has problems with SQL injection and efficient use of the SQL Server cache.
So the correct way to do this in dynamic SQL would be:
SET @dynamicSQL = 'EXEC ' + quotename(@StoredProcedureName) '@DEVModeYN, @WIPMonth';
EXEC sp_executesql @SQL, N'DEVModeYN nchar(1), @WIPMonth date',
@DEVModeYN, @WIPMonth
A lot easier and cleaner! (Note that the variable @SQL must be declared as nvarchar.)
...however, in this particular case, this is still an overkill, and there is no need for dynamic SQL at all. EXEC accepts a variable for the procedure name, so:
EXEC @StoredProcedureName @DEVModeYN, @WIPMonth
...but it does not stop there. You can make all these changes, but you will get the same error. To wit, you get the error on Line 0, which means that it is the call to the procedure that fails. Apparently, you are passing an integer value, when you were
supposed to pass a date. Maybe you forgot to put the dates in quotes?
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
Ipod nano 7th gen bluetooth bug?
It cannot discover or pair to any other devices, though other devices will discover the nano (but not pair). Tried 4 different nano's and none work. Even the Apple store genius bar couldn't find a nano 7th gen that works, and there were plenty of blu
-
Module Pool Programming - Radio Buttons & Screen Field Invisible or Display
Hi, I have 2 radio buttons in my screen and both of them are checked or on. Not sure how to make one of them is on and other is off at a time. If A is off, i need to make few screen fields invisible or display. if A is on, i need to make the screen f
-
How do I get the pc to upload calendar events to the cloudy?
I cannot get calendar events posted on my windows 2007 outlook calendar but they are not showing up on the cloudy. yes i refresh the calendar and use the cloudy page in Outlook calendar 2007. It appears the refresh down loads but does not upload
-
I'm having trouble with Mail. Sometimes I click on reply to a message and the original message text disappears - rather frustrating when I'm trying to answer someone's questions. But its not a setting I've chosen - most of the time the original messa
-
When I click on thumbnail images SOME do not convert to a larger image ready for editing. All I get is a broken outlined square where the image should be.I have noticed this is preceeded by a very brief flash of the image prior to the outlined square