Is it possible to return an operator-type from a function/decode ?

Hi ,
I have a query that is calling a decode and based on the operator type (i.e <> , >= , <= etc ..) that it returns to compare 2 fields of a table
is this possible and if so could anyone advise me how to ?
below is my current declaration that gives invalid relational operator error
SELECT 1 into TmpCnt FROM Tbl1a where
a.id = ID and a.part = PART and a.parmn = TESTNAME
and a.paval DECODE(TESTCONDITION , 'LT' , '<' ,
'LE' , '<=' ,
'EQ' , '=' ,
'GE' , '>=' ,
'GT' , '>' ,
'NE' , '<>' ) TPARAMVALUE ';
tks & rdgs

You can't replace an operator with an expression.
For a limited number of operators you may be able to code this explicitly, something like...
SELECT 1
FROM   tbl1a
WHERE  a.ID = ID
AND    a.part = part
AND    a.parmn = testname
AND    DECODE (testcondition,
         'LT', CASE WHEN a.paval <= tparamvalue THEN 'Y' END,
         'LE', CASE WHEN a.paval = tparamvalue THEN 'Y' END,
         'EQ', CASE WHEN a.paval >= tparamvalue THEN 'Y' END,
         'GE', CASE WHEN a.paval >= tparamvalue THEN 'Y' END,
         'GT', CASE WHEN a.paval > tparamvalue THEN 'Y' END,
         'NE', CASE WHEN a.paval != tparamvalue THEN 'Y' END) = 'Y'Otherwise you are looking at Dynamic SQL.

Similar Messages

  • PowerShell: Possible to return a DataReader object from a function call

    I have to interact with several different db's.  I was wondering how I could use a common Function for the connection and commnad params and have it return a DatReader object that I then could evaluate?
    Example: (psuedo-code)
    Function SqlCmd(Db, instance, command) {... return <DataReader onject>}
    $Datareader= SqlCmd Db instance command
    if ($Datareader.HasRows) {..to something..}
    Thanks
    TR

    Hi TR,
    This is possible by using the Dot.Net Sql objects. Below is a small function which takes a connection string and a SQL query string and returns a DataReader object:
    function
    Get-SQLData()
    param (
       [string]$sqlConnectionString,
       [string]$query
    # Create a connection to the OLAP Database
    $connection
    =
    New-Object
    System.Data.SqlClient.SqlConnection
    $sqlConnectionString
    $connection.Open()
    if (!$?)
    {throw
    "Could not open the connection."}
    $command
    =
    New-Object
    System.Data.SqlClient.sqlCommand
    $query,
    $connection
    $dataReader
    =
    $command.ExecuteReader()
    ,$dataReader
    The most important thing to note in this entire function in the comma in front of the $dataReader at the end of the function. As PowerShell implicitly tries to unpack collection objects, this comma forces the collection to
    be returned intact allowing you to use it as required. So here is an example of usage:
    $dr
    =
    Show-SQLData
    $sqlConnectionString
    $query
    if ($dr.HasRows)
       while ($dr.Read())
    "$($dr[0]) $($dr[1]) $($dr[2])"
    Hope that helps!
    Chris

  • Returning an array type from a local method in Web Dynpro Java application

    Hi,
    In my project, we have a requirement to display 18 rolling months along with the year, starting from current month.
    How I am going to approach is that I will get the system date and get the current month and send the month and year value to a local method which will return 18 rolling months along with the year.
    But, when I tried to create a new method there is no option to return an array type. It was greyed out.
    So, we can not return an array type from a method from Web Dynpro for Java application?
    If so, what is the alternative and how am I going to achieve it?
    I will appreciate your help!
    Regards
    Ram

    HI
    You can create new methods in
      //@@begin others
      private ArrayList MyMethod(){
           // ** Put your code here
           return new ArrayList();
      //@@end
    Other option are create a context node with cardinality 0...n with one or more attributes, and in your method create the needed registers into this node. To read this values, you only need to read your context node.
    Best regards
    Edited by: Xavier Aranda on Dec 2, 2010 9:41 AM

  • How to return a entire table from a Function in Oracle?

    Can anyone pls let me know if there is some way to return an entire table from a function which is called from a stored procedure?
    Thanks

    > Can anyone pls let me know if there is some way to return an entire table from a function which
    is called from a stored procedure?
    For what purpose?
    Do you realise that this means pulling Megabytes (or even many Gugabytes) of data from disk, into the buffer cache, and then copying that data into PL/SQL memory (using a function) in order to give a stored proc that data?
    This is just plain crazy.. resource wise, performance wise, scalability wise.. this is exactly how NOT to use Oracle.
    Why don't you instead tell us what problem you want to solve. Forget for the moment what you think the solution should be. (and asking us how to get a potentially flawed solution, to work)
    Let's get an accurate problem definition so that we can provide you with suggestions and recommendation on what Oracle features can be used to address that problem.

  • Is it possible to run an operating system from an external hard drive?

    Really weird question here, but I've always wanted to know this. I have a MBP 13" mid-2012 and I installed a 256GB SSD. I currently have OSX 10.9 and Windows 8.1 installed on the drive, but is it possible to actually run an operating system from an external hard drive. I don't want to install anymore operating systems onto the internal SSD because I don't want to run out of space. So, I'm wondering can I install Linux on an external hard drive, the same way I would on an internal hard drive and just plug it in via USB 3 or Thunderbolt? Is it actually possible to use a computer this way? I know I can boot from a usb stick, so is it possible to actually use a computer with an operating system installed in an external hard drive?

    windows don't support being installed on usb mass storage installs like usb

  • Is it Possible to import an IDoc type from R/3 into APO system

    Hi Gurus ,
    Could you please guide if we can import an IDoc type from R/3 system to APO system ?? If yes , can you please give the guidelines / step - by - step procedure for this.
    Thanks in advance ,
    Roseline

    hi
    yes u can export an idoc from r/3 to a legacy system.
    the brief outline is as follows:
    1. set up an rfc connection. it has to be 'T' type in t-code sm59
    configure the saprfc.ini file if on windows based os. if on unix based os configure rfcexec.c to have the login details of apo system.
    2.set up logical systems( at least 1 each for r/3 and apo) using T-code SALE.
    3.assign clients to the logical sytems using T-code SALE..
    4.create ports using tcode we20.
    5. create idoc segments using we30 and release.
    6. create idoc type using we31.
    7. create message type using we81.
    8. assign message to idoc using we82.
    9.build a customer model using tcode bd64.
    10. create an outbound process code usint tcode we41.
    it will help if you specify your idoc that you want to use- for vendor, customer and material there are predefined distributions and idocs.
    Thanks.

  • Is it possible to return an operating system?

    I bought Mountain lion because I thought I needed it in order to update to Mavericks but it turned out I didn't need it after all. I have the code Apple emailed me, but I haven't used it or anything

    Generally there are no refunds for software; however, you can try to contact Apple and ask - they may or may not make an exception.

  • Refcursor returning image (BLOB type) from database

    Hi,
    Process : Invoke activity takes ID as input parameter and passes it to partner link (db adapter) which executes stored proc returning a ref cursor. SQL statement in stored proc - ref cursor has a column with BLOB type.
    Problem : Unable to return an image (defiined as BLOB type in database) through refcursor in BPEL.
    Error : Unable to convert XSD element Column whose JDBC type is BLOB to a corresponding XML document element.
    ORABPEL-11087
    XSD :
    <complexType name="RowSet">
    <sequence>
    <element name="Row" minOccurs="0" maxOccurs="unbounded" nillable="true">
    <complexType>
    <sequence>
    <element name="Column" maxOccurs="unbounded" nillable="true">
    <complexType>
    <simpleContent>
    <extension base="string">
    <attribute name="name" type="string" use="required"/>
    <attribute name="sqltype" type="string" use="required"/>
    </extension>
    </simpleContent>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    Need Solution : To get an image (of BLOB type) into BPEL using ref cursor.
    Please let me know if you need any more information to get it working.
    Thanks and Regards,
    Rakesh

    Hi Rakesh,
    There are some notes you might want to refer :
    Note.423909.1      'java.lang.NumberFormatException' Signaled When Using Oracle LOB Family Column Types In ODI Datastores And Integration Interfaces:
         Note.423982.1      An "ORA-17410 No More Data to Read From Socket" Error Has Been Signaled From An ODI (Sunopsis) Integration Interface:
         Note.423768.1      Using Oracle Large Object (LOB) Datatype Columns In ODI Integration Interfaces:
         Note.744101.1      ORA-22835 Message Signaled When Using The OdiSqlUnload Tool In ODI:
         Note.424658.1      "ORA-00942" Message With Oracle Large Object (LOB) Datatype Fields In ODI Integration Interfaces:
         Note.423992.1      Using Oracle LONG Datatype Columns In ODI(Sunopsis):
         Note.424107.1      ODI Integration Interfaces And The Use Of Oracle Spatial Datatypes In Source And Target Datastores:
    Hope this helps!
    Cheers
    Anirudh Pucha

  • Possibility of returning derived type from inherited operator

    Hello forum,
    I am wondering the possibility of returning a derived type from an inherited operator. A test case would include two class definitions such as:
    Public Class Base
    Dim _a
    Public ReadOnly Property A As Integer
    Get
    Return _a
    End Get
    End Property
    Public Shared Operator +(ByVal base1 As Base, _
    ByVal base2 As Base) As Base
    Return New Base(base1.A + base2.A)
    End Operator
    Public Sub New(ByVal a As Integer)
    _a = a
    End Sub
    End Class
    Public Class Derived
    Inherits Base
    Public Sub New(ByVal a As Integer)
    MyBase.New(a)
    End Sub
    End Class
    and implementation such as:
    Dim derivedA As Derived = New Derived(1)
    Dim derivedB As Derived = New Derived(1)
    Dim derivedResult As Derived = derivedA + derivedB
    'would like result as derived, not base!
    This test case returns the error that the derivedResult cannot by cast to the base type (as this is how the operator is defined). I am wondering: is there a way to change the operator definition so that the derived type is returned from the operation? There
    could be many derived types and avoiding overloading the method in each type definition could reduce the amount of code.
    Many thanks.

    I'm just Frank, not "Mr. Smith". ;-)
    I suspect that Reed is onto it with generics. He's quite familiar with it and in a question I posted a few years ago - about derived classes - he answered it using generics.
    Let's see what you or he comes up with. :)
    Still lost in code, just at a little higher level.
    Haha, I was like "who is Mr. Smith.... oh yeah, that's Frank's last name".  ;)
    @James3210:  same here... it's just Reed.  Wearing a shirt with a collar is about as formal as I get.  :)
    Anyway, back to the subject at hand, I think the generic method in conjunction with the operator overload is the way to go.  Since you'll have to write the operator on each class anyway, at least you can copy-paste the operator code and then just change
    the type used for "T":
    Public Class FooBase
    Private anInteger As Integer
    Protected Shared Function Add(Of T As {FooBase, New})(source As T, target As T) As FooBase
    Return New T() With {.anInteger = source.anInteger + target.anInteger}
    End Function
    Public Shared Operator +(source As FooBase, target As FooBase) As FooBase
    Return FooBase.Add(Of FooBase)(source, target)
    End Operator
    End Class
    Public Class DerivedFoo
    Inherits FooBase
    Public Overloads Shared Operator +(source As DerivedFoo, target As DerivedFoo) As DerivedFoo
    Return FooBase.Add(Of DerivedFoo)(source, target)
    End Operator
    End Class
    Public Class DerivedFooTwo
    Inherits FooBase
    Public Overloads Shared Operator +(source As DerivedFooTwo, target As DerivedFooTwo) As DerivedFooTwo
    Return FooBase.Add(Of DerivedFooTwo)(source, target)
    End Operator
    End Class
    In this example the shared Add() method is internal to the FooBase objects, but you could make the access modifier public if you wanted to expose the method for direct use.
    -EDIT-
    Sorry, I forgot you wanted to return the object type from the operator, not the internal result.  I've updated the code to return a new object instance.
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

  • How to use an Object Type from Another Database

    Hi,
    I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!

    Sven W. wrote:
    At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
    We can't use a remote type as procedure argument, even with the same OID.
    It's OK for query on a remote object column though :
    SQL> conn remote_user@remote_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> create table mytable (col1 mytype);
    Table créée.
    SQL> insert into mytable values (mytype(777));
    1 ligne créée.
    SQL> create or replace function myfunc (p_in in mytype) return number
      2  is
      3  begin
      4   return p_in.att1;
      5  end;
      6  /
    Fonction créée.
    SQL> disconn
    Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> conn my_user@local_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> select * from mytable@test_dbl;
    COL1(ATT1)
    MYTYPE(777)
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype@test_dbl(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype@test_dbl(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 26 :
    PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 9 :
    PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored

  • Return a flat file from an RFC

    Hi,
    I have created a function module that at the moment returns 4 tables. I want to create a flat file based on these tables and return that file from the function instead of the tables. I can create a flat file using the function GUI_DOWNLOAD.
    Is there a way to return a flat file from the function?
    Regards,
    Mark

    No, but you can return all four tables in single flat table.   First you would need to create a structure in SE11,  it would have one field, of type string.  In your function module interface, you would have a tables parameter like the structure that you just created.  No in the code of the function module, instead of writing your data of each internal table to the corresponding tables parameter to update the one table with the flat structure. 
    Make Sense?
    Regards,
    Rich Heilman

  • Viewing/modifying Extra information Types from self service

    Hi, Is it possible to mody extra information types from Self Service and does anyone know where I can find setup documents?

    check this - http://oracleappssol.blogspot.co.uk/2012/08/creating-extra-information-types-as.html

  • WSDL operation type possible in PI

    Hi folks,
    Normally a wsdl (webservice) can have multiple action types, for example a particuar service can be used to show distance between 2 points, validate addresses, etc etc,
    ideally the wsdl will have in it a wsdl operation type indicating what the consumer of theservice needs out of the service,
    But in PI i havn't come across something similar where in the wsdl generates an operation type..
    Is it somethng possible in PI?
    I don't want to use a field in the schema (Request type) indicating this intent...but instead create a wsdl operation ....

    NO , you cannot create multiple opearations for a WSDL in PI.
    You have to use External tool ( Altova XML SPY) to do that, then you can import the WSDL in XI to check it.
    But you can't create mutilple operations except one request , one response and a fault message type.
    REgards,
    Anurag Garg

  • Container operation type single

    hi all
    I am facing a problem. i have a BPM which has a block step-->Propertie mode=ForEach. inside this block i define some container operation type single whichs ones take some values. i need that the values of the containers elements update for each message in the block(ForEach).is it possible or i need to define the contasiners as multiline??
    T&R
    Rodrigo

    hi,
    there no way to define it as single and update the value.
    i need the those values to pass them as IMPORT to a Message Mapping. so the containers has to be singles.
    if no, i have to define another step in the BPM to get the first value of the all multiline container operation??
    thanks.

  • Overflow during the arithmetical operation (type P) in program SAPLBBP_FRA

    Hi All
    I am receieving the following error the moment I log onto the SRM system via the browser.
    Overflow during the arithmetical operation (type P) in program SAPLBBP_FRAMEWORK
    Please can you advise what could possibly the problem.
    Thanks in Advance
    Regards
    KC

    Hi
    <b>Please go through this SAP OSS Note which will definitely help -></b>
    Note 857137 - MENUDATA: A "short dump" occurs with several role assignment
    <u>Do let me know.</u>
    Regards
    - Atul

Maybe you are looking for

  • 1px is missing from text, but not in the stage area

    So my issue is this. I have some text, static, arial. The letter "F" has the top bar missing so it almost looks like a t. But this only looks like this when I render. In the staging area while viewing actual pixels the F looks perfectly fine. Is ther

  • Focus on mouse pointer on click- WPF

    hi, I want to focus the position of the mouse pointer when the user clicks. Exactly like the focus we get on clicking the ctrl key to locate mouse pointer after enabling it here.  Can anyone help me with this. Thanks, Shaleen TheHexLord

  • Multiple Connections in one transaction?

    Hello, we use the OC4J 9.0.3 with the fellowing DataSource configuration: <data-source class="oracle.jdbc.pool.OracleConnectionCacheImpl" name="OracleDS" location="jdbc/OracleCoreDS" xa-location="jdbc/xa/OracleXADS" ejb-location="jdbc/OracleDS" conne

  • How to use h:message to display HTML code in message from property file

    I am using <h:message for="somecomponentid"/> to display the error message for a validator attached to a component and the error message which resides in message property file contains HTML elements like <br> and The HTML doesnt get displayed properl

  • Remote network print stalls, PC sharing printer shows spooling

    Since upgrading to Snow Leopard, my remote printing to a Canon iP4300 shared on an XP Pro SP2 no longer works. My MacBook finds the printer, and allows me to print. Status shows that the document is printing. However, on the XP machine, the document