Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have simply written CASE statement in the procedure as below
(case when (T1.DEVICEHOLD = 'Z1' or T2.ISHOLD = 1) then 1
else 0
END) AS HOLD
But when I'm compling procedure its giving an error Compilation errors for PACKAGE BODY
Error: PLS-00103: Encountered the symbol "Z1" when expecting one of the following:
* & = - + ; at in is mod remainder not rem
or != or ~= >= and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol "* was inserted before "Z1" to continue.
Could anyone help me to resolve this?
Thanks in advance!
This is a compiler error. The most likely cause is a stray ' somewhere which means that the first ' in your snippet terminates a quoted string and so the compiler considers Z1 to be code, and not valid as such.
The easiest way to spot such things is to use a decent editor or IDE which has syntax highlighting. These tools colourize quotes, keywords and comments and so make it easy to spot where we have made our bloomers. There are plenty of free tools available: Notepad++ or Oracle SQL Developer are popular options.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have a very simple equation in vbscript/asp. I get error on minus operator. I even had to add 0 in start of equation because I got same error at first one too.
y = 0 - (0.0114 * (x^2)) − (0.2396 * x) + 112.57
Microsoft VBScript compilation error '800a0408'
Invalid character
y = 0-(0.0114 * (x^2))-(0.2396 * x)+112.57
----------------------------^
The character between the x^2)) and the (0.2396 does not look like the character between the 0 and the (0.0114. It is likely an en dash, not a minus/hyphen. Fix that. Do not use Word or other word processor for creating code; the smart replacement of dashes and quotes will cause problems with code. Use a text editor like Notepad or Notepad++ instead.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I'm getting an error in my VHDL 1993 code which I cannot solve in the following code line:
if (((cur_stap2 := IDLE) or (cur_stap2 := MDLE)) AND (txe_n = '0') AND (wr_n = '1')) then
VHDL compiler issues an error with this statement:
Error (10500): VHDL syntax error at mst_fifo_fsm.vhd(123) near text ":="; expecting ")", or ","
IDLE, MDLE are states which are declared with this lines of code:
type states is (IDLE, MTRD, MDLE, MTWR);
signal current_state, next_statem, cur_stap1, cur_stap2, cur_stap3, cur_stap4 : states;
txe_n and wr_n are normal signals with type std_logic.
Can you please tell me what is the correct way of checking if these conditions are met?
Thank you in advance
using Intel Quartus 17.0
Your code uses a ":=" where it needs an "=". Your code corrected is:
if (((cur_stap2 = IDLE) or (cur_stap2 = MDLE)) AND (txe_n = '0') AND (wr_n = '1')) then
":=" is for variable assignment and initialization in declarations. "=" is for comparison.
Note: Compilers do not have AI. The way to read this error message (and any error message in general) is "Dear user, I found ":=" and I died. I think the reason is ..." Note sometimes the "..." is useful, sometimes it is not. So in this case, it correctly told you, don't use ":=" here.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I've got a problem in Ruby, "unexpected tidentifier expecting keyword_end", how Can I solve it?
def riko(user)
if user.name.eql? 'Mia Khalifa Fan'
#client.send_msg 'Hola Mia <3 ¿Cómo te trato este dia, cosa guapa y sensual?',
else
if user.mame.eql? 'Skul Goy'
#client.send_msg 'Muerete. '
else
#client.send_msg "Hola #{user.name} o/ \ :v / "
end
end
You're using else if which works fine in other languages, but in Ruby represents 2 distinct conditionals. You probably want to replace it with elsif instead, which is the Ruby equivalent.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am trying to use the reactive programming concept in ruby, I have create two block of code:
1 Imperative
a = 5, b = 2
c = a + b
print c #=> 7
a = 2
print c #=> 7
2 Declarative
a := 5, b := 2
c := a + b
print c #=> 7
a := 2
print c #=> 4
However second example doesn't work for me and give the below error:
d.rb:1: syntax error, unexpected '=', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
a := 5, b := 2
^
Please anyone help me to find out the error in the code. Any suggestion will be highly appreciated.
I know the second one is pseudo code but one thing surprise me that top score person make it off topic? The second code can also be executed using Reactive Library and top score programmer don't aware about it.
The := is not valid Ruby.
The error message is because symbols are represented by leading colons so :example is a symbol (compare to "example" which is a string).
So encountering : Ruby expects a valid beginning character for a symbol, which would be any of...
#$_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Middle characters can be...
_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
And the last character can be...
!_=?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
So = is never a valid symbol character.
The article you reference is showing pseudo-code not actual Ruby.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
Take a string like "4 / 10 + 5 x 3"
how would you parse the string in Ruby and evaluate the math?
Note: Hopefully, the solution doesn't involve regex if possible
You can use eval to evaluate a string as Ruby code.
eval(string [, binding [, filename [,lineno]]])
Evaluates the Ruby expression(s) in string. If binding is given, which
must be a Binding object, the evaluation is performed in its context.
If the optional filename and lineno parameters are present, they will
be used when reporting syntax errors.
In your case
string = '4 / 10 + 5 * 3'
eval(string)
Keep in mind that the string you posted is not valid Ruby code. In fact, x is invalid, the correct operator is *.
str = "4 / 10 + 5 x 3"
eval(str.tr("x","*"))
If you want to keep the x you can translate it using tr.
eval can run anything, so don't try this with user input.
str = "4 / 10 + 5 x 3"
result = eval(str)
Your current code will throw a Syntax error since you're trying to multiply using the character x.
You should use * operator.
After that it's simple by using eval(). But normally this should be refrained from.
result = eval("4 / 10 + 5 * 3")
For math parsing I would look into this gem, haven't tried it myself but seems better than raw eval.