How to set variable to a reserved word in Mulesoft 4 - anypoint-studio

In my the payload I have a type field and I want to set a variable that has the value of it. I get an error "Invalid input "type", expected arrayValueSelector or valueSelector (line 1, column 12)".

Any reserved word if coming as input should be enclosed in quotes like
[payload.'type']

You need to quote the attribute name to avoid that error:
#[payload[0].'type']

Related

Syntax error in my SQL when inserting a JSON field

Why this query is not working:
UPDATE country SET timezones="[{"zoneName":'Asia\/Kabul',"gmtOffset":16200,"gmtOffsetName":'UTC+04:30',"abbreviation":'AFT',"tzName":'Afghanistan Time'}] " where name='Afghanistan'
Error I get:
ERROR: syntax error at or near "zoneName"
LINE 1: UPDATE country SET timezones="[{"zoneName":'Asia/Kabul',"gm...
^
SQL state: 42601
Character: 34
the issue with your SQL statement is that the literal string you are trying to set timezones to contains improperly formatted escape characters. if you wanted to avoid that first error you can double up on quotes like timezones="[{""zoneName"": ...
you can go to the link to see more about string formating in SQL. good luck!
You're trying to update the value wrapping the string in quotes. You need to wrap the string in single quotes timezones='[{"zoneName":'Asia...}]'
However, to TitledTeapot's point, you will also have to escape the existing single quotes in your string, so you'd end up with something like this:
'[{"zoneName":''Asia\/Kabul'',"gmtOffset":16200,"gmtOffsetName":''UTC+04:30'',"abbreviation":''AFT'',"tzName":''Afghanistan Time''}]'

Oracle Application Express gives ORA-06502 when submitting text field

I have a text field in Oracle Application Express. It is an item of type 'text area' called "P61_AGENDA_TEXT".
In the validation field, 4000 characters is set.
However, anything over 300 characters entered into the text field gives an error:
Error encountered saving agenda item: ORA-06502: PL/SQL: numeric or
value error: character string buffer too small
The table column that is associated with this is varchar2(4000).
I can't work out where the 300 character setting is coming from.
Can anyone help?

Getting Invalid Column name Error in T-SQL while performing Update operation

I am trying to run a SQL query which is quite straightforward. The query is:
UPDATE dbo.Machine
SET dbo.Machine.ServerName="Server"
WHERE dbo.Machine.ServerName IS NULL;
I am getting the following error on Server
Invalid column name 'Server'.
Am I missing something ?
String should be declared with single quotes ' '
SET dbo.Machine.ServerName= 'Server'
Double quotes is for fieldnames

REGEXP_REPLACE Punctuation in Redshift

I'm trying to use REGEXP_REPLACE to remove all punctuation from a varchar. I'm using the following:
regexp_replace(d.NAME, [.,\/#!$%\^&\*;:{}=\-_`~()])
But it gives me an error, saying:
Statement 1 is not valid. ERROR: syntax error at or near "."
How can I fix this to remove all punctuation?
Firstly, the dash in a character class means a range, except when it's first or last... so put it there:
[.,\/#!$%\^&\*;:{}=\_`~()-]
And, you have to put it in quotes, and most characters don't need escaping:
regexp_replace(d.NAME, '[.,/#!$%^&*;:{}=_`~()-]')

Retrieving the value which have '#' character in ColdFusion

I'm trying to assign the value of a column from the query to a variable using cfset tag. For example, if the value is 'abcd#1244', then if I use <cfset a = #trim(queryname.column)#> it will return only abcd. But I need the whole value of that column.
You will need to escape the # symbol. You can get clever and do it all in one swoop (# acts as an escape character when placed next to another #).
Example being
The item## is #variable#.
In order to print "The item# is 254."
There are plenty of text and string functions at your disposal.
I'd recommend first trying to escape the value as soon as it is drawn from your database.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html