Test Boolean Function
Dear All
How I Can test boolean function that return true or false.
Hi,
Write a Wrapper Function , that is, another function that is wrapped around your first fucntion, which you can call from SQL, and call it.
CREATE OR REPLACE FUNCTION check_mobile_varchar2 (p_mobile IN VARCHAR2)
RETURN VARCHAR2
IS
return_string VARCHAR2 (5) := 'FALSE';
BEGIN
IF check_mobile (p_mobile)
THEN
return_string := 'TRUE';
END IF;
RETURN return_string;
END check_mobile_varchar2
/To test:
SELECT txt
, CHECK_MOBILE_VARCHAR2 (txt) AS check_mobile
FROM table_x
;This assumes you really want a function that returns a BOOLEAN, and therefore can't be used in SQL. A lot of folks just write functions that return 'TRUE' or 'FALSE' (or 'T' or 'F', 1 or 0) in the first place.
If check_mobile is in a package, check_mobile_varchar2 should be in the same package.
Edited by: Frank Kulash on Mar 13, 2011 11:46 AM
Added RETURN startement.
Similar Messages
-
Best design for Boolean function from simple query
Hello,
what is the most efficient, shorter, readable, simple way to make a boolean function that simply return true or false from a simple query that return 0 or 1 to n records?
Is this solution using a cursor's the best (working...):
FUNCTION is_date_present (p_date IN DATE)
RETURN BOOLEAN
IS
CURSOR chk_cursor
IS
SELECT COUNT (*)
FROM target_dates
WHERE target_date = p_date;
nb NUMBER := 0;
BEGIN
OPEN chk_cursor;
FETCH chk_cursor
INTO nb;
CLOSE chk_cursor;
IF nb >= 1
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;Performance, clarity and simplicity are important...
ThanksWell, I prefer (not tested):
FUNCTION is_date_present (p_date IN DATE)
RETURN BOOLEAN
IS
nb NUMBER := 0;
BEGIN
SELECT COUNT (*)
INTO nb
FROM target_dates
WHERE target_date = p_date;
IF nb >= 1 THEN
RETURN TRUE;
LSE
RETURN FALSE;
IF;
END;Regards,
MiguelWhy count multiple records when you only care if you get at least 1 occurrence? Just wasted cycles.
FUNCTION is_date_present (p_date IN DATE)
RETURN BOOLEAN
IS
nb NUMBER := 0;
BEGIN
SELECT COUNT (*)
INTO nb
FROM DUAL
WHERE EXISTS
SELECT NULL
FROM target_dates
WHERE target_date = p_date
IF nb >= 1 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;Or you could just add a ROWNUM = 1 on to yours, either way. -
Boolean() function gives true in all cases
The implementation of the boolean() function in BPEL (version 10.1.2.1.0) have an FATAL ERROR.
boolean(0) gives 1 and
boolean(false) gives 1
I have tried to make a TAR, however I cannot connect to meta-link today.
Regards,
FlemmingThanks for your answer Clemens.
Perhaps, I missed to send you my test-case.
Try with the following assign, based on the schema below with input and output defined as boolean (in default generated bpel-syncron project):
<assign name="Assign_1">
<copy>
<from expression="boolean(bpws:getVariableData('inputVariable','payload','/client:TestIfProcessRequest/client:input'))"/>
<to variable="outputVariable" part="payload" query="/client:TestIfProcessResponse/client:result"/>
</copy>
</assign>
<types>
<schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/TestIf"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="TestIfProcessRequest">
<complexType>
<sequence>
<element name="input" type="boolean"/>
</sequence>
</complexType>
</element>
<element name="TestIfProcessResponse">
<complexType>
<sequence>
<element name="result" type="boolean"/>
</sequence>
</complexType>
</element>
</schema>
</types>
It gives the result
<TestIfProcessResponse>
<result>true</result>
</TestIfProcessResponse>
no mather what I gives as input in the BPEL Console.
I have tried with 0, 1, true, false.
Regards,
Flemming -
The Test-OrganizationRelationship function on Exchange 2010 SP3 Rollup4 error
Hi
If I run Test-OrganizationRelationship function on Exchange 2010 SP3 Rollup4 the fallowing error appear:
[PS] C:\WINDOWS\system32>Test-OrganizationRelationship -Identity "emag" -UserIdentity [email protected] -verbose
VERBOSE: [12:24:44.359 GMT] Test-OrganizationRelationship : Active Directory session settings for
'Test-OrganizationRelationship' are: View Entire Forest: 'False', Default Scope: 'hq.flanco.ro', Configuration Domain
Controller: 'CALYPSO.hq.flanco.ro', Preferred Global Catalog: 'CALYPSO.hq.flanco.ro', Preferred Domain Controllers: '{
CALYPSO.hq.flanco.ro }'
VERBOSE: [12:24:44.359 GMT] Test-OrganizationRelationship : Runspace context: Executing user: hq.flanco.ro/FLANCO -
Users/HQ/IT/Marian NICA, Executing user organization: , Current organization: , RBAC-enabled: Enabled.
VERBOSE: [12:24:44.359 GMT] Test-OrganizationRelationship : Beginning processing &
VERBOSE: [12:24:44.359 GMT] Test-OrganizationRelationship : Instantiating handler with index 0 for cmdlet extension
agent "Admin Audit Log Agent".
VERBOSE: [12:24:44.391 GMT] Test-OrganizationRelationship : Current ScopeSet is: { Recipient Read Scope: {{, }},
Recipient Write Scopes: {{, }}, Configuration Read Scope: {{, }}, Configuration Write Scope(s): {{, }, }, Exclusive
Recipient Scope(s): {}, Exclusive Configuration Scope(s): {} }
VERBOSE: [12:24:44.391 GMT] Test-OrganizationRelationship : Searching objects "[email protected]" of type "ADUser"
under the root "$null".
VERBOSE: [12:24:44.406 GMT] Test-OrganizationRelationship : Previous operation run on global catalog server
'CALYPSO.hq.flanco.ro'.
VERBOSE: [12:24:44.406 GMT] Test-OrganizationRelationship : Searching objects "emag" of type "OrganizationRelationship"
under the root "$null".
VERBOSE: [12:24:44.406 GMT] Test-OrganizationRelationship : Previous operation run on domain controller
'CALYPSO.hq.flanco.ro'.
VERBOSE: Test that organization relationships are properly configured.
VERBOSE: [12:24:44.406 GMT] Test-OrganizationRelationship : Resolved current organization: .
VERBOSE: [12:24:44.406 GMT] Test-OrganizationRelationship : Calling the Microsoft Exchange Autodiscover service for the
remote federation information.
VERBOSE: [12:24:44.983 GMT] Test-OrganizationRelationship : The Autodiscover call succeeded for the following URL:
https://autodiscover.emag.ro/autodiscover/autodiscover.svc.
VERBOSE: [12:24:44.983 GMT] Test-OrganizationRelationship : The Autodiscover call succeeded for the following URL:
https://autodiscover.emag.ro/autodiscover/autodiscover.svc.
VERBOSE: [12:24:44.983 GMT] Test-OrganizationRelationship : Generating delegation token for user [email protected]
for application FYDIBOHF25SPDLT.exchangedelegation.emag.ro.
VERBOSE: [12:24:46.138 GMT] Test-OrganizationRelationship : The delegation token was successfully generated.
VERBOSE: [12:24:46.138 GMT] Test-OrganizationRelationship : The Microsoft Exchange Autodiscover service is being called
to determine the remote organization relationship settings.
VERBOSE: [12:24:46.138 GMT] Test-OrganizationRelationship : The Client will call the Microsoft Exchange Autodiscover
service using the following URL: https://autodiscover.emag.ro/autodiscover/autodiscover.svc/WSSecurity.
VERBOSE: [12:24:46.185 GMT] Test-OrganizationRelationship : The Microsoft Exchange Autodiscover service failed to be
called at 'https://autodiscover.emag.ro/autodiscover/autodiscover.svc/WSSecurity' because the following error occurred:
SoapException.Code =
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd:InvalidSecurityToken
Exception:
System.Web.Services.Protocols.SoapHeaderException: An error occurred when processing the security tokens in the
message.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse
response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Exchange.SoapWebClient.CustomSoapHttpClientProtocol.<>c__DisplayClass4.<Invoke>b__3()
at
Microsoft.Exchange.SoapWebClient.HttpAuthenticator.NoHttpAuthenticator.AuthenticateAndExecute[T](SoapHttpClientProtocol
client, AuthenticateAndExecuteHandler`1 handler)
at Microsoft.Exchange.SoapWebClient.SoapHttpClientAuthenticator.AuthenticateAndExecute[T](SoapHttpClientProtocol
client, AuthenticateAndExecuteHandler`1 handler)
at
Microsoft.Exchange.SoapWebClient.AutoDiscover.DefaultBinding_Autodiscover.GetOrganizationRelationshipSettings(GetOrgani
zationRelationshipSettingsRequest Request)
at
Microsoft.Exchange.Management.Sharing.TestOrganizationRelationship.<>c__DisplayClass8.<GetInvokeDelegate>b__7(DefaultBi
nding_Autodiscover binding)
at
Microsoft.Exchange.SoapWebClient.AutodiscoverClient.<>c__DisplayClassf.<InvokeAndFollowSecureRedirects>b__c(IWebProxy
webProxy)
at Microsoft.Exchange.SoapWebClient.AutodiscoverClient.InvokeWithWebProxy(String url, InvokeWithWebProxyDelegate
invokeWithWebProxy)
at Microsoft.Exchange.SoapWebClient.AutodiscoverClient.InvokeAndFollowSecureRedirects(InvokeDelegate invokeDelegate,
Uri url)
at Microsoft.Exchange.SoapWebClient.AutodiscoverClient.InvokeForUrl(InvokeDelegate invokeDelegate, Uri url)
VERBOSE: [12:24:46.185 GMT] Test-OrganizationRelationship : The Autodiscover call failed.
RunspaceId : b3b378f5-d912-4042-b578-e949b54da4c1
Identity :
Id : AutodiscoverServiceCallFailed
Status : Error
Description : The Autodiscover call failed.
IsValid : True
VERBOSE: [12:24:46.185 GMT] Test-OrganizationRelationship : Admin Audit Log: Entered Handler:OnComplete.
VERBOSE: [12:24:46.185 GMT] Test-OrganizationRelationship : Ending processing &
It's not this, is it -
http://johanveldhuis.nl/en/error-occurred-processing-security-tokens-message/ ? -
How to write Boolean function (If Then Else)?
Hi all,
I have a logic to write in the query. It is:
If (A = 0 and B = 0)
Then 0
Else
If (A = 0 and B > 0)
Then 100
Else
A/B (we want to show %)
How to use boolean function to write this Netted If Else statement? Thank you in advance!Hi
If (A = 0 and B = 0)
Then 0
Else
If (A = 0 and B > 0)
Then 100
Else
A/B (we want to show %)
1. create a formula in the query designer. and use this formula for if - else
( ( (A==0) AND (B==0) ) * 0) + ( ( a==0 ) AND (B >0 ) * 100 + (A/B*100) )
: denotes THEN
+ : denotes ELSE
See if this works.
Assign points if helpfull
From
ManesH -
HOW TO MAKE A BOOLEAN FUNCTION IN LABVIEW5.0
I want to use a boolean funtion but it does not exist in existing functions?so how can I do it?I final aim is how to make a VALVE boolean function and how to use it?please teach me,experts! Thank you very much!
Hi,
what do you mean by "boolean function"?
For boolean operations you can use
1. Case structure. It is located in Functions->Structures
2. Boolean functions (such as AND, OR, NOT, etc.). They are located in Functions->Boolean
3. Comparison functions (such as equal?, greater?, less?, etc.). They are located in Functions->Comparison
You have to give more info about your problem.
Good luck.
Oleg Chutko. -
To use Boolean function in DECODE or CASE statement
Hi all
I have a scenario where i need to use a boolean function inside DECODE statement. When i tried this way iam getting "ORA-06553: PLS-382: expression is of wrong type".
I doubt whether i can use boolean function inside DECODE or not?
My query will be like this:
select decode(my_fuction( ),'TRUE',1,'FALSE',0) from dual;
Any help is highly appreciated.
Thanks
SriramOverloaded functions must differ by more than their
return type . At the time that the overloaded
function is called, the compiler doesn't know what type
of data that function will return. The compiler cannot,
therefore, determine which version of the function to
use if all the parameters are the same. -
Can you use boolean function in where clause
Hi,
I have a boolean function. Is it possible to use it in where clause of query.
Eg;
is_prime(13) returns boolean
select 1 from dual where is_prime(13)What about something like this
Create or replace function boolret(id number) return boolean as
begin
If id <10 then
return true;
elsif id>10 and id<100 then
return false;
else
return null;
end if;
end;
1 declare
2 id_cat boolean;
3 begin
4 id_cat:= boolret(8);
5 dbms_output.put_line(id_cat);
6* end;
SQL> /
dbms_output.put_line(id_cat);
ERROR at line 5:
ORA-06550: line 5, column 2:
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
ORA-06550: line 5, column 2:
PL/SQL: Statement ignored
It seems PL/Sql doesn't have any datatype like Boolean,But it handles Boolean like datatype.
Regards
Raj deep.A -
How to Use a boolean function in a process
Hi,
I created a boolean function named change_pwd with 3 varchar2 parameters : login_name, old-pwd and new_pwd. I would like to use it in a process but I can't, this is how I do it :<br><br>
select change_pwd (
v('P12_Login'),v('P12_Old_Pwd'),v('P12_New_Pwd')) from dual;
<br><br>
BennI got this error : <br><br>
ORA-06550: line 2, column 8: PLS-00382: expression is of wrong type ORA-06550: line 2, column 1: PLS-00428: an INTO clause is expected in this SELECT statement
<br><br>
and here is my function :<br><br>
create or replace function "CHANGE_PWD"<br>
(p_username in VARCHAR2,<br>
p_old_password in VARCHAR2, <br>
p_new_password in VARCHAR2)<br>
return boolean<br>
is<br>
l_count number;<br>
l_password varchar2(4000);<br>
l_stored_password varchar2(4000); <br>
l_idcontact number;<br>
begin<br>
-- Check to see if the user is in the user table<br>
select count(*) into l_count from CONTACTS where MATRICULE = p_username;<br>
if l_count > 0 then<br>
-- take the stored password<br>
select u.MOTDEPASSE, u.IdContacts into l_stored_password, l_idcontact from <br>UTILISATEURS u, CONTACTS c where u.IdContacts = c.IdContacts AND c.MATRICULE = p_username;<br>
<br>
-- apply the cash function<br>
l_password := user_hash(p_username, p_old_password);<br>
<br>
-- compare the hashed password with the stored password<br>
if l_password = l_stored_password then<br>
-- change password<br>
update UTILISATEURS set MotDePasse = user_hash(p_username, <br>p_new_password) where idcontacts = l_idcontact;
return true;<br>
else<br>
return false;<br>
end if;<br>
else<br>
return false;<br>
end if;<br>
end;<br> -
How to test Barcode Functionality in siebel
Hi Experts,
We need to read input from a Bar code and store the data in the field in a Business Component. From the bookshelf we found that bar code reader need to transmit the bar code with prefix as "Ctrl - \" and suffix as "Ctrl - /". My question is, is there any way to test this functionality without a actual bar code reader and a dedicated software. We need this as a Proof of Concept.
Thanks in Advance
ShanmukhThe mic that has the most problems with iPhone 4 is the mic used during phone calls without speaker mode. Also try other mic with speaker mode on. I think you can also check the handsfree mic using the Voice Memo App. But the only way to check the important mic is to make a real call.
-
Hi,
I want to test the BAPI Function mudule for PO.how to test it in SE37.
please tell me the Step by Step procedure like how to give values and how to know the errors etc.
Regards,
Shobha Henryhi,
It similar to like testing any function module. after execution you have to check the RETURN parameter to see how the bapi was executed.
you might want to call commit bapi in order to see if bapi really does the changes that you want ot do... In such case you to call commit bapi after your bapi call in se37 itself..
To do so
1. Go to trasanction SE37
2. Menu path: Function Module --> Test --> Test Sequence..
3. On the popup menu enter the sequence of func mode want to execute in series...
4. For example, for one of my test I executed bapis in these order.
BAPI_PS_INITIALIZATION
BAPI_BUS2054_CREATE_MULTI
BAPI_PS_PRECOMMIT
BAPI_TRANSACTION_COMMIT
Hope this helps you.
Enjoy SAP.
Pankaj Singh. -
Hi
I am using standard Boolean function ' if '. I want to set the confition in that. How can I do that ?? Either right click or double click is not leading to any screen where I can put my condition. If length comes to 15 I want to route to one channel and when it comes to 20, I want to route to channel two. How to set this condition in "if" node function ?? Basically I want navigation to use this funcation.
Thanks
kumarAdd the field you wish to check
add the length (text) function.
Add the equalS function and build this up....
Look at Page 23 here for an example... https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd -
Boolean Function Ifs not giving proper out put
Hi ,
I am using boolean function Ifs in message mapping of one of my scenerio.
My problem is First argument have exist function and if first argument is true it gives value of second argument but if is false , I am passing a Constant value in else condition(3rd argument) it give no out put.Can you suggest how can i resolve it.Hi Mohit,
In your case you need not to use IFs , instead make use of boolean function If , it will work fine for you.
Regards
Nishant Kumar Singh -
Invoking a Database boolean Function from Java
Hi,
I have the following boolean database function --
FUNCTION isPositive(p_count NUMBER) RETURN BOOLEAN
IS
BEGIN
IF p_count < 0 THEN
return false;
END IF;
return true;
END;I read somewhere that CallableStatement doesn't support the boolean function.
I tried to use CallableStatement to invoke the above function as follows --
String sql = "begin ? := helperpkg.isPositive(?); end;";
CallableStatement cs = jdbcConn.prepareCall(sql);
cs.registerOutParameter(1, java.sql.Types.BOOLEAN);
cs.setInt(2, -5);
cs.execute();
return cs.getBoolean(1);But it gave me the exception --
java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:244)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:393)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:462)
at DBConnector.invokeFunction(DBConnector.java:63)
at DBConnector.main(DBConnector.java:21)Please advice.
ThanksI read somewhere that CallableStatement doesn't
support the boolean function.http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/apxref.htm#BABFECBJ
Best regards
Maxim -
Testing custom function modules
Hi Friends ....
As I am new to ABAP testing , I need help in knowing how to test custom function modules .
Below is how I am trying :
Step : 1 -- > Open Tcode SE37
Step : 2 --> Display the function module
Step : 3 --> Do its syntax check.....activate it..... execute it
What if no test data is available???
I am trying to execute directly where it gives a return parameter for some function modules saying No Entry \ No data available for this ID etc.,
I am in a confusion whether its correct or not
I want some ideas regarding this
- Swapna>
Swapna Vadlamani wrote:
> Hi Anupama...
>
> Thank u a ton for the quick reply...but I have another doubt..if I execute without giving any selection parameter data...it says
>
> No data stored for in the selected period
>
> -Swapna
Ok, so that is what it does if you don't pass it any selection parameter data - I doubt very much if that is how it will be used in Production. Any function module is just a bit of code that does what it has been programmed to do; to test it you just need to find out what it is supposed to do from whoever has asked for it to be built and then check that it does it. If there is no test data set up, then you'll need to find out from your functional consultant how to set some up or get them to set it up for you.
Maybe you are looking for
-
R300 + xf86-video-ati + xorg-server 1.6.1 - Can't run ET
Hello. Ever since i updated to xorg-server to 1.6 series i haven't been able to run Enemy Territory. This on a r300 class gfx card with opensource drivers. error ...loading libGL.so.1: Initializing OpenGL display ...setting mode 4: 800 600 Using XFre
-
Unrecognized drivers and non-English utilities for Satellite A100-785
I have got Satellite A100-785 PASAANE Since I am using win2003 with SP2 and all its updates, I have downloaded all drivers for windows XP; because its drivers are compatible with 2003. But I have experienced this problem (please see pic below ): http
-
Email server down again - why locked?
Email service down again.... yes - it is 2012 and a company backed by ADOBE, charging a premium price for hosting is more unreliable that a couple of kids working out of their garage. I'm disgusted. No one will give out the names of who is in charge
-
BPC User Management Tools in different versions
Hi all, I am comparing the different versions of BPC from 5.1 to 10.0 and I have the following questions about user management tools: 1) How does "User Management Server" work? What's the difference when it is compared with "Active Directory" and "BP
-
URGENT-Session Synchronization between WebSEAL and WebLogic Server 6.1
Hi All, I am a new-bee to Access Manager and WebSEAL. I have an application running in WebLogic Server6.1. I have WebSEAL junctioned to iPlanet Web Server, which in turn integrates with WebLogic through NSAPI plug-in. I am using iPlanet Directory Ser