Oracle Issue (ORA-009111) - ora-00911

what is the syntax error (error code-ORA-00911) in this below code:
Insert into ctl_infa_parm
select ‘201405’,
scen_id,
infa_wkf_id,
sess_parm_file_nm,
sess_nm,
parm_nm,
parm_value,
parm_type,
wklt_nm,
actv_flag,
updtd_by,
sysdate,
sysdate
from ctl_infa_parm
where dmth_id=201404;

code-ORA-00911 represents an invalid character (see http://www.dba-oracle.com/sf_ora_00911_invalid_character.htm). Your select ‘201405’ is not the same as select '201405'. Use ' instead of ’.

It's the semi colon at the end. You have to remove it.

Related

EXECUTE FORMAT() USING in postgres is showing error for $

i will directly get to the code rather than explaining too much
execute format('
"$1" = select "Source1" from temp_tables._%s;
'::text, (translate("Song_Id_"::text, '-', '_')))
using "Source1__";
the table is dynamically created and the table name is all fine as i have used that table to insert some data into it. if i run this code, the error i am getting is
ERROR: syntax error at or near "$1"
LINE 1: $1 = select "Source1" from temp_tables._24af1593_3539_49fd_9...
^
QUERY: $1 = select "Source1" from temp_tables._24af1593_3539_49fd_9ef4_29307f301d38;
i have tried other method too like
execute
'$1 = select "Source1" from temp_tables._' || (translate("Song_Id_"::text, '-', '_')) ||';'
using "Source1__";
even this gives the same error.
note : "Source1__" is a variable of type text declared in the stored procedure where everything else is being executed too.
This is wrong. The EXECUTE command accepts only SQL statements. There is nothing statement like var = SELECT .... More - the you can pass just value by using clause USING. You cannot to pass any reference to variable. Solution is easy. Just use clause INTO
EXECUTE 'SELECT ... ' INTO target_plpgsql_variable
Please, read related documentation. Unfortunately, some parts the stored procedures are not extra intuitive because there is mix of two very different languages. It is good by reading documentation, because is hard to find correct solution without knowledge of possibilities and syntax.

Thymeleaf Cannot execute subtraction:

i want to add an th:text in select option (Thymeleaf),
<option th:each="case : ${caseCategoryList}" th:value="${case.caseCategoryId}" th:text="${case.caseCategoryName} - ${case.caseCategoryCode}"></option>
but i get this error
08:28:05,501 ERROR [[servlet-context]] Servlet.service() for servlet servlet-context threw exception
org.thymeleaf.exceptions.TemplateProcessingException: Cannot execute subtraction: operands are "INPATIENT" and "IP" (memberrki/member-rki-form:124)
at org.thymeleaf.standard.expression.SubtractionExpression.executeSubtraction(SubtractionExpression.java:91)
at org.thymeleaf.standard.expression.ComplexExpression.executeComplex(ComplexExpression.java:58)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:107)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:133)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:120)
at org.thymeleaf.standard.processor.attr.AbstractStandardTextChildModifierAttrProcessor.getText(AbstractStandardTextChildModifierAttrProcessor.java:68)
at org.thymeleaf.processor.attr.AbstractTextChildModifierAttrProcessor.getModifiedChildren(AbstractTextChildModifierAttrProcessor.java:59)
at org.thymeleaf.processor.attr.AbstractChildrenModifierAttrProcessor.processAttribute(AbstractChildrenModifierAttrProcessor.java:58)
at org.thymeleaf.processor.attr.AbstractAttrProcessor.doProcess(AbstractAttrProcessor.java:87)
at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212)
at org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1016)
at org.thymeleaf.dom.Node.processNode(Node.java:971)
...
can you help me to fix this error,
Using &#45 as suggested by glytching didn't work for me. However, this worked:
th:text="${case.caseCategoryName} + '-' + ${case.caseCategoryCode}"
Thymeleaf is interpreting this: th:text="${case.caseCategoryName} - ${case.caseCategoryCode}" as subtract the value of caseCategoryCode from caseCategoryName as display the result.
And, since these are String values, the subtraction fails.
I suspect you don't want to subtract them at all and instead you want to display the two vaues separated by a hyphen. Like this:
INPATIENT - IP
To do that you can escape the hyphen so that Thymeleaf does not treat it as a subtraction operator:
th:text="${case.caseCategoryName} - ${case.caseCategoryCode}"

Teradata : Stored Procedure : parameter column name

I'm looking for help with a stored procedure in teradata. I want to update a whole table and for this I'm trying to use a for loop cursor. the problem is that my update is defined via column names passing through parameters to the SP.
I've seen it can be possible to use dynamic sql to do that but I haven't found any information on the subject concerning for loop cursor and dynamic sql. Is it possible with FOR LOOP CURSOR ?
I've tried to do only the select and calculs with dynamic sql, it works fine but then the problem is to update the table from the cursor on the select. In this case how to update a table from my cursor?
I let you show my code.
loop cursor :
REPLACE PROCEDURE [database].calDELAI
(
IN dateDebut VARCHAR(30),
IN dateFin VARCHAR(30),
IN delay VARCHAR(30)
)
BEGIN
DECLARE DATE_DEBUT_COLONNE VARCHAR(64);
DECLARE DATE_FIN_COLONNE VARCHAR(64);
SET DATE_DEBUT_COLONNE=dateDebut;
SET DATE_FIN_COLONNE=dateFin;
FOR for_loop_update AS cur_select_set CURSOR FOR
SELECT
TMP.DATE_FIN_COLONNE-TMP.DATE_DEBUT_COLONNE
FROM [database].ORD_T_DETL_ORDR_DELAI AS TMP
/* the select is more complicated but here is the spirit of it.*/
DO
IF (delay='DELAI1') THEN SET DELAI1=NB_JR_OUVRABLE;
END IF;
END FOR ;
END ;
The errors given by teradata are :
SPL1027:E, Missing/Invalid SQL statement'E(3810):Column/Parameter '[database].TMP.DATE_FIN_COLONNE' does not exist.'.
SPL2001:E, Undefined symbol 'DELAI1'.
SPL2001:E, Undefined symbol 'NB_JR_OUVRABLE'.
Thanks in advance for your replies and your help.
The call statement should contain all the input Paramenters , make sure you are specifying all the input parameters correctly. Could you please provide your call statement.

Mysql2::Error: You have an error in your SQL syntax

I'm newby in ruby on rails, I have search textbox then everytime I type an apotraphe (') e.g testing' word ..... I always recieved error:
Mysql2::Error: 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 's word%' OR english_name LIKE '%testing's word%' OR chinese_name LIKE '%testin' at line 1: SELECT COUNT(DISTINCT `jos_store`.`id`) FROM `jos_store` LEFT OUTER JOIN (SELECT id as store_replenishment, store, MAX(stock_movement) AS stock_movement FROM jos_store_replenishment GROUP BY store) AS replenishment ON replenishment.store = jos_store.id LEFT OUTER JOIN jos_stock_movement ON jos_stock_movement.id = replenishment.stock_movement WHERE (store_id LIKE '%testing's word%' OR english_name LIKE '%testing's word%' OR chinese_name LIKE '%testing's word%')
can you help me with my problem.
Try escaping your apostrophe, eg english_name LIKE '%testing\'s word%'
if you're using '%PHRASE%' and there's another ' inside %PHRASE%, it thinks you've ended the like clause and gives you an error - if you escape with the escape character, eg \', it should work: so with your error phrase, something like:
<snip /> WHERE (store_id LIKE '%testing\'s word%' OR english_name LIKE '%testing\'s word%' OR chinese_name LIKE '%testing\'s word%')
Notice I've used '%testing\'s word%' to ensure it doesn't think the second apostrophe ends the LIKE clause

adding break line to expression

I have an expression statement to display content for a text box for a reportviewer but went blank when trying to add a carriage return or a new line between the two expression. My expression as follows:
=Format(Fields!LastDateVisited.Value, "d")+ " "+Fields!LastVisitType.Value
Instead of the space i want to make it a new line. I tried "\n" but didn't work, any suggestions would be great. Thanks!
You can also use following :
= Fields!FirstField1.Value + System.Environment.NewLine + Fields!MyField2
I think that a end of line character should work: '\n'
in your placeholder properties (Expr page) change the markup type to html

Resources