Error in boolean expression
I try to enter a formula in an field for hiding the output on certain conditions
I enter IF(@i_report_type == 'P',true,false)
but I get the error that a boolean expression/value is required ????
I don't know what is wrong with true and false as boolean ?
if I put it in capitals then I get the error unrecoginezed identifier 'True' ??
do I miss some strange logic here ??
kind regards
arthur
Hi Arthur,
you might want to try the following:
BOOL(IF(@i_report_type == 'P',true,false))
Hope this helps.
Regards,
Joseph
Similar Messages
-
Errors trying to apply a Boolean expression for conditional text
I have been trying to create some Boolean expressions to filter conditional text, with mixed results. The Boolean expression is three conditions separated by ORs followed by four conditions preceded by AND NOTs. When I apply the expression, FrameMaker exhibits and error and has to quit. The numbers in the error message are:
9004, 4908044, 6134440, 5459515
The hidden log file appears to be nothing more than a stack dump.
Do the numbers listed above indicate anything?
Are there any known limitations on how long a Boolean expression can or should be? One expression with one fewer OR worked.
Does there need to be a space between an AND and a NOT? The builder does add one, so I assume it is not necessary.
Does anyone have some general rules of thumb when working with Boolean expressions for conditional text?
Thanks,
VanVan,
The error values are meaningless to users. However, please do send the logfiles to the [email protected] address.
As far as conditionals go, the general rules are that conditon names must be quoted and that if your ar using the NOT, it must run together with the AND or OR, e.g. ANDNOT ORNOT.
There's an articel in the Developer Connection on using the boolean operators at http://www.adobe.com/devnet/framemaker/articles/fm8_single_sourcing.html
Perhaps if you posted the condition that caused the crash, someone might be able to spot an error. -
How to convert a boolean expression into a number in SQL (not PL/SQL)
I have a boolean expression
FIELD IN (SELECT FIELD FROM TABLE)
which I would like to convert into a number, preferably into 0 for true and into 1 for false. The reason being that I want to sum the values in a HAVING clause.
I have tried with DECODE, SIGN, TO_NUMBER, but all fail with an error message to the order of wrong type of argument.
Does anyone have an idea?
/poul-jorgenHi, you can do it with case if you have Oracle 9i
Regards
Laurent
select case when dummy in ('X') then 1 else 0 end from dual; -
Hi everybody. I wrote de following type
create or replace TYPE ALMACEN AS OBJECT
id_almacen number(10),
descripcion varchar2(40),
existencias number(6),
precio number(4),
member function movimiento (p_num number) return boolean
create or replace TYPE BODY ALMACEN AS
member function movimiento (p_num number) return boolean AS
v_inf boolean;
n number(6);
BEGIN
if self.existencias+p_num>=0 then
self.existencias:=existencias+p_num;
return TRUE;
else return FALSE;
end if;
END movimiento;
END;
I have Oracle 11g release I.
In previous releases it worked, but now SQLDeveloper marks
self.existencias:=existencias+p_num;
Error PLS 00363 expression "string" cannot be used as an assignment target in sentence
Please, What's wrong?
Thanking in advanceHi,
Not quite a PL/SQL XML question but anyway...
Since the member function modifies the object instance, the implicit argument "self" must be declared explicitly as "IN OUT" :
member function movimiento (self in out nocopy almacen, p_num number) return boolean -
Error while activating expression Functional call
Hi All,
I created a functional call expression..I mainteined target function name and result object as well..The syntax check doesn't return any error messages.But when I try to activate it , I get an error message
ZCALL_FUNCTION_1 (Expression) : No active version found for time stamp 20.111.018.120.507 (Details) Display Longtext.
I activated all the subobjects..But I still I get the above mentioned error.. Could anyone please suggest me the solution..
Regards,
Raghu.Hi ,
Please implement note 1639477.
Thanks and Regards,
Rama. -
Trying to run Migration Assistant on a PC (Windows XP). Error message "Outlook Express could not be started. The application was unable to initialize the store directory. Your computer may be out of memory or your disk is full. Contact Microsoft support for further assistance. (0x80007114)" Then the Migration Assistant shows a box stating that Outlook Express must be stopped before running the assistant.
I have enough memory. The disk is not full. Outlook Express runs just fine on my PC. And it was not runing at the time.
Apple Support (two tries) and my Apple store have essentially said this is a Microsoft problem. Of course, Microsoft says it is an Apple program failing so it is an Apple problem.
MS info about the error indicates that it prevents OE from starting. Than is not my situation at all. The fix is draconian (as many are) and could risk my OE so I have not gone there - yet. Hopefully there is another way.
Does anyone have any experience on how to (easily) solve this dilemma. I am also trying on the MS side.
This is my first MAC. I was convinced to go Apple by several folks who touted the excellent support. It was purchased in July 2012 and has been a boat anchor since. Support??
Thanks for any info you can provide.So I had this as well.
I went to the file tab and went to export. From there I picked 720p and it worked. It may be different for you depending on the resolution of the video. hopefully it works for you too! -
Can i use Boolean Expressions in Mail Rules?
Can i use Boolean Expressions in Mail Rules?
I need to create a rule to check whether a message contains BOTH a first and last name of EITHER of two people.
For example, the rule im looking to create goes something like this:
If ANY of the following conditions are met:
message content - contains - john & doe
message content - contains - jane & doe
ive tried and cant seem to get it to work...
Message was edited by: mysteriosoAFAIK Mail rules do not support boolean expressions.
to do what you want you'd have to create two rules
rule 1
if ALL of the following conditions are met
message content - contains - john
message content - contains - jdoe
and similarly for rule 2. -
Search problems : Boolean expressions and spam folder
I get about 1000 spam per day that I have to check.
Some of them contains certain keyword that the real emails would never have.
I would like to setup a smart folder or similar that found all emails in the spam folder that contains any of those keywords. I read some blogs etc. that said that spotlight boolean expressions could be used but they do not seem to work.
e.g. "pill OR berry" yields no results at all but when each of the keywords are used on their own they produce 80 or so results each.
Another problem I have is that I can do a manual search in the spam folder by typing in the search field and it yields results. But if I save that as a smart folder it yields no results at all. It seems that the rules do not work on the spam folder.
I then tried to do all this from spotlight in the finder. I found the folder where the spam mailbox emails are stored (called "messages"). I managed to construct a nice search query and save it as a search. But if I delete one of the emails from the finder it still remains in Mail and the next time I start Mail it will be regenerated from somewhere.
Anyone have any insights to provide here?I had actually missed that preference. Unfortunately it did not help.
Even if I make a new smart mailbox with just one rule (the email must be in the spam folder) it doesnt work. It doesn't matter if I change between any/all either.
I started experimenting with adding a rule saying that the email must not be in any of the other mailboxes but spam. That seemed to work for a bit but as I added more rules, excluding more mailboxes, it eventually broke. I will investigate it a bit more but currently don't have high hopes... -
Pl/sql boolean expression short circuit behavior and the 10g optimizer
Oracle documents that a PL/SQL IF condition such as
IF p OR q
will always short circuit if p is TRUE. The documents confirm that this is also true for CASE and for COALESCE and DECODE (although DECODE is not available in PL/SQL).
Charles Wetherell, in his paper "Freedom, Order and PL/SQL Optimization," (available on OTN) says that "For most operators, operands may be evaluated in any order. There are some operators (OR, AND, IN, CASE, and so on) which enforce some order of evaluation on their operands."
My questions:
(1) In his list of "operators that enforce some order of evaluation," what does "and so on" include?
(2) Is short circuit evaluation ALWAYS used with Boolean expressions in PL/SQL, even when they the expression is outside one of these statements? For example:
boolvariable := p OR q;
Or:
CALL foo(p or q);This is a very interesting paper. To attempt to answer your questions:-
1) I suppose BETWEEN would be included in the "and so on" list.
2) I've tried to come up with a reasonably simple means of investigating this below. What I'm attempting to do it to run a series of evaluations and record everything that is evaluated. To do this, I have a simple package (PKG) that has two functions (F1 and F2), both returning a constant (0 and 1, respectively). These functions are "naughty" in that they write the fact they have been called to a table (T). First the simple code.
SQL> CREATE TABLE t( c1 VARCHAR2(30), c2 VARCHAR2(30) );
Table created.
SQL>
SQL> CREATE OR REPLACE PACKAGE pkg AS
2 FUNCTION f1( p IN VARCHAR2 ) RETURN NUMBER;
3 FUNCTION f2( p IN VARCHAR2 ) RETURN NUMBER;
4 END pkg;
5 /
Package created.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY pkg AS
2
3 PROCEDURE ins( p1 IN VARCHAR2, p2 IN VARCHAR2 ) IS
4 PRAGMA autonomous_transaction;
5 BEGIN
6 INSERT INTO t( c1, c2 ) VALUES( p1, p2 );
7 COMMIT;
8 END ins;
9
10 FUNCTION f1( p IN VARCHAR2 ) RETURN NUMBER IS
11 BEGIN
12 ins( p, 'F1' );
13 RETURN 0;
14 END f1;
15
16 FUNCTION f2( p IN VARCHAR2 ) RETURN NUMBER IS
17 BEGIN
18 ins( p, 'F2' );
19 RETURN 1;
20 END f2;
21
22 END pkg;
23 /
Package body created.Now to demonstrate how CASE and COALESCE short-circuits further evaluations whereas NVL doesn't, we can run a simple SQL statement and look at what we recorded in T after.
SQL> SELECT SUM(
2 CASE
3 WHEN pkg.f1('CASE') = 0
4 OR pkg.f2('CASE') = 1
5 THEN 0
6 ELSE 1
7 END
8 ) AS just_a_number_1
9 , SUM(
10 NVL( pkg.f1('NVL'), pkg.f2('NVL') )
11 ) AS just_a_number_2
12 , SUM(
13 COALESCE(
14 pkg.f1('COALESCE'),
15 pkg.f2('COALESCE'))
16 ) AS just_a_number_3
17 FROM user_objects;
JUST_A_NUMBER_1 JUST_A_NUMBER_2 JUST_A_NUMBER_3
0 0 0
SQL>
SQL> SELECT c1, c2, count(*)
2 FROM t
3 GROUP BY
4 c1, c2;
C1 C2 COUNT(*)
NVL F1 41
NVL F2 41
CASE F1 41
COALESCE F1 41We can see that NVL executes both functions even though the first parameter (F1) is never NULL. To see what happens in PL/SQL, I set up the following procedure. In 100 iterations of a loop, this will test both of your queries ( 1) IF ..OR.. and 2) bool := (... OR ...) ).
SQL> CREATE OR REPLACE PROCEDURE bool_order ( rc OUT SYS_REFCURSOR ) AS
2
3 PROCEDURE take_a_bool( b IN BOOLEAN ) IS
4 BEGIN
5 NULL;
6 END take_a_bool;
7
8 BEGIN
9
10 FOR i IN 1 .. 100 LOOP
11
12 IF pkg.f1('ANON_LOOP') = 0
13 OR pkg.f2('ANON_LOOP') = 1
14 THEN
15 take_a_bool(
16 pkg.f1('TAKE_A_BOOL') = 0 OR pkg.f2('TAKE_A_BOOL') = 1
17 );
18 END IF;
19
20 END LOOP;
21
22 OPEN rc FOR SELECT c1, c2, COUNT(*) AS c3
23 FROM t
24 GROUP BY
25 c1, c2;
26
27 END bool_order;
28 /
Procedure created.Now to test it...
SQL> TRUNCATE TABLE t;
Table truncated.
SQL>
SQL> var rc refcursor;
SQL> set autoprint on
SQL>
SQL> exec bool_order(:rc);
PL/SQL procedure successfully completed.
C1 C2 C3
ANON_LOOP F1 100
TAKE_A_BOOL F1 100
SQL> ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=0;
Session altered.
SQL> exec bool_order(:rc);
PL/SQL procedure successfully completed.
C1 C2 C3
ANON_LOOP F1 200
TAKE_A_BOOL F1 200The above shows that the short-circuiting occurs as documented, under the maximum and minimum optimisation levels ( 10g-specific ). The F2 function is never called. What we have NOT seen, however, is PL/SQL exploiting the freedom to re-order these expressions, presumably because on such a simple example, there is no clear benefit to doing so. And I can verify that switching the order of the calls to F1 and F2 around yields the results in favour of F2 as expected.
Regards
Adrian -
ORAMED-01101 :[Filter Expression Error]Error evaluating filter expression.
I am a newbie with oracle soa suite 11g. I am trying to use file adapter to upload the csv file contents to database.
My csv file looks like:
employeeid,employeename,designation,managerempid
1121,abc,mts,211
1122,def,mts,232
1123,xyz,abc,133
The generated xml file during the xsd test is
<?xml version = '1.0' encoding = 'UTF-8'?>
<Root-Element xmlns="http://TargetNamespace.com/EmpAdaptor">
<emp>
<employeeid>1121</employeeid>
<employeename>suneetha</employeename>
<designation>mts</designation>
<managerempid>211</managerempid>
</emp>
<emp>
<employeeid>1122</employeeid>
<employeename>challa</employeename>
<designation>mts</designation>
<managerempid>232</managerempid>
</emp>
<emp>
<employeeid>1123</employeeid>
<employeename>xyz</employeename>
<designation>abc</designation>
<managerempid>133</managerempid>
</emp>
</Root-Element>
and in the mediator, I have the filter expression as shown:
$in.body/ns1:EmpDetails/ns1:Emp
the d/b table i created is
CREATE TABLE empdtls (EMPID NUMBER(5) PRIMARY KEY,ENAME VARCHAR2(15) NOT NULL,DESIG VARCHAR2(10),MGREMPID NUMBER(5));
When I deployed it, the application throws the below fault
Non Recoverable System Fault :
ORAMED-01101:[Filter Expression Error]Error evaluating filter expression.Possible Fix:Please make sure filter expression is valid, otherwise contact oracle for support. Cause:ORAMED-01102:[Filter Expression Metadata Error]Error evaluating filter expression, "$in.body/ns1:EmpDetails/ns1:Emp"Possible Fix:Please make sure filter expression metadata is valid, otherwise contact oracle for support.
I have been trying to fix this error for almost three days..
Somebody please help me..Sorry the generated xml during test is
<?xml version = '1.0' encoding = 'UTF-8'?>
<EmpDetails xmlns="http://TargetNamespace.com/ServiceName">
<Emp>
<employeeid>1121</employeeid>
<employeename>suneetha</employeename>
<designation>mts</designation>
<managerempid>211</managerempid>
</Emp>
<Emp>
<employeeid>1122</employeeid>
<employeename>challa</employeename>
<designation>mts</designation>
<managerempid>232</managerempid>
</Emp>
<Emp>
<employeeid>1123</employeeid>
<employeename>xyz</employeename>
<designation>abc</designation>
<managerempid>133</managerempid>
</Emp>
</EmpDetails> -
Dynamic execution of boolean expression
Hi folks,
I want to execute a boolean expression dynamically, can you pls help me how to do it.
For example,
String str = " ( X & ( Y | Z ) ) " ;
They value of X , Y or Z will be either true or false.
After replacing their value, I will get string as follow
String result = "( true & (false | true ) ".
Now I want to execute the String as boolean expression in order to get
a result as a true or false.
So, i need a solution to implement this. The expression may be simple or compound . It is so urgent waiting for your reply.
Appreciated if you provide sample code.
Thx !
With regards,
RahulJava is a compiled language (well, strictly, a semi-compiled language.) This means that stuff like parsing expressions only happens at compile time. Variable names don't exist at run time, neither does the code which analyses expressions.
If you really need to do this kind of thing, therefore, all the code for parsing these expressions has to be a part of your program, and stuff like values for variable names will have to be set explicitly by your program, not in regular variables but in variable list for the "scripting engine" you invoke.
You can either write your own expression analyser (not a trivial task if you haven't done it before) or you can search arround the web for one someone else has written and find out if it covers your requirements. BeenShell has been suggested. Find it on the web and study it's documentation.
Incidentally when the new release of Java comes out it will include serveral such "Scripting engines" for languages like JavaScript or Jython, and such things will be less hastle. -
Dynamic boolean expression evaluation
Hey everyone,
We have a table that consists of a couple key columns and a column containing a boolean expression. We want to select a number of rows based on the key columns and evaluate the boolean expression in the expression column for each, only returning the first row wherein the boolean expression evaluates to true.
We are using a context to inject the test variables into the boolean expressions and currently we are selecting all the key rows in a PL/SQL procedure and going through the cursor evaluating each of the boolean expressions with an execute immediate.
The expressions are currently formated in the columns as anonymous PL/SQL blocks that, when called, will either return true or false to the PL/SQL procedure. Upon returning true, the procedure stops looping and returns true to the caller.
Psuedo-code would be:
- set-up sys_context with condition variables
- create cursor for: select * from expression_tbl et where <key matches>
- begin loop through cursor
- execute immediate cursor_row.expression using out :out_is_true
- if out_is_true = 'Y' then return true
- loop
- return false
The expressions (anonymous PL/SQL blocks) from the table look something like this:
begin if ((''||sys_context('ctx', '1')||'' = 'FL') AND (''||sys_context('ctx', '3')||'' BETWEEN 1619 AND 4598) ) then :1 := 'Y'; end if; end;
This works, but it seems like I should be able to do this another way and potentially extract more performance.
So...a couple questions:
1) I have read on ask Tom that a dynamic select statement (rather than an anonymous PL/SQL block) can evaulate the boolean expressions. I.E. rather than use an execute immediate clause on an anonymous PL/SQL block contained in the expression column, I would make the expression column compatible with a where clause and create this dynamic SQL query: 'select count(*) from dual where ' || expression. I would then execute that query and if it returns a row then the expression is true, otherwise it is false. My question is, does anyone think the performance of parsing the SQL and executing it would be better than that of executing an anonymous PL/SQL block for every row? Tom said that the SQL could incur a lot of hard-parses and kill performance, but how deathly is the constant compilation of anonymous PL/SQL blocks as shown above in comparison?
2) Would there be any benefit to pulling the execute routines out of the PL/SQL block and issuing a query such as the following:
select * from expression_tbl et where <key matches> AND pkg.eval_routine(et.expression) = 'Y' AND rownum <= 1.
I realize that the evaulating routine would then need to either perform an execute immediate on et.expression (if we keep the current method in place) or formulate the dynamic SQL statement and execute it. But, could this be faster than doing the same loop through rows explicitely in PL/SQL?
Doing this would trim my PL/SQL down to:
- set up sys_context
- execute the above select statmenet
- if a row is returned then return true otherwise return false
Seems more elegant, but the peformance is all that matters.
3) Is there any built-in routine that I may be able to replace pkg.eval_routine from 2 with that would evaulate boolean expressions for me? Or any other way to inline the idea from 1 with 2? I can't think of one given the dynamic nature of the beast, but...maybe there's something I missed.
Thanks everyone! Hopefully I've expressed myself clearly.Brian - According to Tom Kyte Doing PL/SQL inside Execute Immediate should be faster as you are already within the context of a PL/SQL engine. If we choose to do it in SQL then the PL/SQL engine has to hand it over to the SQL Engine for executing the dynamic Select statements and so might be a little slower. But I am not sure if the difference can be quantifiable unless u do your own test of both evaluators and run them for like a few thousand times in a loop.
If you are using 10g R2 - you might want to look into DBMS_RLMGR package which is the API for the Oracle's version of the embedded business rule manager.
I looked into it but it didn't fit our needs as its deficient with respect to rule versioning and effective and until date based business rule enforcement/ validation.
After taking a shot at designing something home grown I feel its not that difficult to construct one that fit our needs inclusive of the features( rule versioning, effective and until dates) that I listed above as deficiencies in the Oracle embedded rule engine.
If you don't have those requirements may be using the Business Rule manager API of 10g R2 might not be a bad anticipating it will be improved in future versions.
Regards
-Suren -
Search MessageSelector sample for complex boolean express with AND, OR, NOT
As far as I know I can specify in the "Message Selector" field of a JMS-PartnerLink
a boolean expression.
How are AND, OR and NOT written here? Can I use brackets?
Can I use blanks inside the boolean expression?
Assume I would like to specify:
((myfield1 > 3.0) && (myfield2 == 777)) || (myfield3 != 'aaa')
Is the syntax correct for this?http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/server.102/b14257/jm_create.htm
11.3 JMS Point-to-Point Model Features/MessageSelector
that will give you some examples of how to use it -
While processing MIRO, received a error message that express document upda
Hi,
When i am processing document through MIRO,i got an error messge that Express document update was terminated.
Can anybody let me know the possible solution for this.Hi,
please check the no. ranges for invoices.
This error is a result of overlapping of no.ranges
rgds
jaya -
CF9 Service not starting - error parsing boolean property notifyclientonalert
Hi, I clean installed CF9 (after uninstalling CF8) on win2003 32bit and all was workign fine, however after a server restart the CF9 Application service refuses to start automatically or manually. I am getting an error in windows event logs saying see Coldfsuion logs, but there is nothing in these logs, not very helppful! any ideas apart from a reinstall?
After reinstalling I get the same problme, but this tuime in coldfusion server log I get the following error message
"Error","jrpp-2","11/17/11","16:21:59",,"Monitor service: Error parsing boolean property notifyclientonalert, using default false"
thanks
OliHi Oli,
Suggest try start CF from CMD prompt. Run cmd as an admin, CD ColdFusion9\bin\ , type CFSTART press enter. Some detail of what happens?
HTH, Carl.
Maybe you are looking for
-
How to connect to a Sql server from Oracle using db link
Hi All, Does anybody have any idea about how to connect to a sql server from oracle database using db link to syncronize the data? I need to pull the data from Sql server table to Oracle tables and relay messages back to the sql server. Thank you, Pr
-
I own the suit of Adobe Programs which I have been using for years. They are paid for and registered and I have serial numbers. Today, I cannot open the programs. The message is: Design and Web Premium Trial. Expired. I do not want to use CC. I
-
I recently upgraded to Office 2013. Everything seems to be working fine with Acrobat Pro XI, except when I try to combine Word 2013 files into a single PDF, I get this message: "Acrobat does not support the conversion of one or more of your files to
-
My £2000 MacBook Pro 17'' is falling apart???!!!
I gave the case, keyboard and screen a wipe down with a dry lint free cloth earlier and am shocked!!! There is a thin silver bar runing along the bottom of the keyboard, its painted SILVER - why, this area must get a hammering and my machine is 4 wee
-
Design issue with an application
Hi Requirement : I have an application which needs to access database and show the resultset on the screen. The design is as follows: (I am implementing Connection Pooling as I have not been able to configure the Tomcat's Connection Pooling) 1)I have