Help: Left Equivalent function in Oracle?

Hey can anybody throw somelight on the function which is equal to LEFT in Oracle.
Left$(patientmemberid, Len(patientmemberid) - 2)
Thanks

Maybe:
with
names(EName) as
(select 'sana' from dual union all
select 'saleem' from dual union all
select 'aijaz' from dual union all
select 'mohbat' from dual union all
select 'aasia' from dual union all
select 'asad ali' from dual union all
select 'asif' from dual union all
select 'aftab' from dual union all
select 'sagar' from dual union all
select 'hanif' from dual
select ename
  from names
where length(ename) - length(replace(ename,:ch)) = 1Regards
Etbin
Edited by: Etbin on 26.7.2012 9:13
select ename
  from names
where regexp_count(ename,:ch) = 1

Similar Messages

  • Need help for Conversion Function in Oracle

    Hi, Can Any One help me Please.
    I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
    Thanks In Advance.

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Please help me : SUBSTR function in Oracle 6i

    Dear all people!
    I have a problem with SUBSTR as follow:
    my code:
    declare
    string1 varchar2(300);
    string2 varchar2(65);
    begin
    string1 := ....
    string2 := substr(string1,1,60);
    end;
    when i run program in debug
    at command "string2 := substr(string1,1,60);" it raise error ORA-06502;
    Please tell me how to assign substr(string1,1,60) to string2 (max length of string2 is 65);
    I'm looking to forward to receiving your response!
    Thank you very much;

    The question was simple:
    I am trying to do is bring in anything after the * in the Id column no matter how long the name is before the * but my calculation is way off L:
    Here is an example of what my data would look like but what I need it to do:
    Id                                                        NEW COLUMN
    TNET*231333                                  231333
    AMER*29283893.2                       29283893.2
    TNEY*21893838                             21893838
    Do you know how to create this calculation?
    Answer: SUBSTR(id,INSTR(id,'*',1)+1,999)
    this was emailed to me from someone on here saying "try to see if this helps" and it did that's why i said thank you.

  • Equivalent of DB2  functions in ORACLE 11g

    Hi,
    I am trying to convert the SQL queries written in DB2 to ORACLE. There are some db2 specific functions are used in the queries.I am not able to find the equivalent function in ORACLE. The function names are written below:
    1) DateDD()
    2) SELECT @@IDENTITY
    3) SELECT *
    FROM (
    SELECT ROWNUMBER() OVER() AS rowId_1, INNER_TABLE.*
    FROM (----)as innertable
    ) AS Outertable
    Error is: ROWNUMBER is INVALID identifier.
    4) DAYOFWEEK()
    5) DAYS()
    6) dayofyear()
    Please help me in finding the equivalent function in ORACLE.
    Thanks in advance!!

    You probably don't need a DateAdd function in Oracle. You can add a number to a date in Oracle-- that adds the number of days to the date.
    SELECT sysdate today, sysdate+1 tomorrow
      FROM dualWhy are you using DAYS()? If, as in the example, you're just trying to determine the number of days between two dates, you can subtract dates in Oracle and the difference will be a number of days (including a fractional component if applicable)
    SELECT date '2011-09-27' - date '2011-09-25' difference_in_days
      FROM dualIf you really need the number of days since January 1, 0001, you could subtract the date from Jan 1, 0001, i.e.
    SELECT date '2011-09-27' - date '0001-01-01'
      FROM dualI would assume that Oracle and DB2 would return the same number but there could well be some differences since the current calendar didn't exist in the year 1 and I know there were issues in the transition from the Gregorian to the Julian calendar where some days were decreed not to exist. It wouldn't shock me if Oracle and DB2 counted some of the days in the 1500's differently.
    Justin

  • Convert Date function to oracle

    The follwoing Sql for Sqlserver, what is the equivalent function in oracle. Need help on this.
    YTD:
    YOUR_DATE_FIELD between DATEADD(yy,
    DATEDIFF(yy,0,@Prompt('BEGIN_DATE','D',,mono,free)), 0) AND
    @Prompt('END_DATE','D',,mono,free)
    MTD:
    YOUR_DATE_FIELD between DATEADD(mm, DATEDIFF(mm, 0,
    ,@Prompt('BEGIN_DATE','D',,mono,free)), 0) AND
    @Prompt('END_DATE','D',,mono,free)
    WTD
    YOUR_DATE_FIELD between (,@Prompt('BEGIN_DATE','D',,mono,free) -
    DATEPART(dw, ,@Prompt('BEGIN_DATE','D',,mono,free)))+1 AND
    @Prompt('END_DATE','D',,mono,free)

    Extracting month,year,day from sysdate (You may even opt to use to_char)
    SQL> select extract (month from sysdate) from dual;
    EXTRACT(MONTHFROMSYSDATE)
                            4
    SQL> select extract (year from sysdate) from dual;
    EXTRACT(YEARFROMSYSDATE)
                        2007
    SQL> select extract (day from sysdate) from dual;
    EXTRACT(DAYFROMSYSDATE)
                          5
    Adding 5 days to today's date
    SQL> select sysdate + 5 from dual;
    SYSDATE+5
    10-APR-07
    Adding Months
    SQL> select add_months(sysdate,3) from dual;
    ADD_MONTH
    05-JUL-07
    Date Difference
    SQL> select sysdate - to_date('01/04/2007','dd/mm/yyyy') from dual;
    SYSDATE-TO_DATE('01/04/2007','DD/MM/YYYY')
                                    4.42670139
    Date Difference
    SQL> select trunc(sysdate) - trunc(to_date('01/04/2007','dd/mm/yyyy')) from dual
    TRUNC(SYSDATE)-TRUNC(TO_DATE('01/04/2007','DD/MM/YYYY'))
                                                           4
    SQL>

  • How to use Left & Right Functionality for Strings..

    Please help i am unable to find Left & Right Functions in Oracle 11g.. Instead i just found Substr who can be a replacement for Left but not for Right..

    Alex Nuijten wrote:
    Atari Basic ruled!
    http://en.wikipedia.org/wiki/Atari_600XL#Newer_XL_machines
    First computer I ever saw was in a research laboratory at a Polytechnic (before they all became Universities). I was left with some research students by my mum while she went to a lecture (I was only about 8 at the time) and they asked me my name, fiddled with some wires and switches and lo and behold, my name appeared on a TV screen. Wow! I was hooked from that moment on. There was no such thing as home computers back then. LOL!

  • Hash function in Oracle

    Hi all,
    SELECT HashBytes( 'md5', '1234' )
    --returns 0x81DC9BDB52D04DC20036DBD8313ED055
    The above is in sqlserver do we have any such function in Oracle,
    I have to compare the data in sqlserver with Oracle, I know we have the above function
    in sqlserver would like to know, what is the equivalent function in Oracle.
    Else if any of u have better Idea for comparasion. plz let me know.
    Thanks in Advance.

    AAK 460425 wrote:
    Thanks, I was not knowing sys is the owner,
    Is there any more argument I need to pass
    select dbms_crypto.hash('HELOO') from dual;
    wrong number or type of argument in call to hashExample:
    SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('HELLO'),3) from dual;
    DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('HELLO'),3)
    C65F99F8C5376ADADDDC46D5CBCF5762F9E55EB7
    SQL>http://www.morganslibrary.org/reference/dbms_crypto.html

  • Can I call MS Excel Function in Oracle

    Hi everyone,
    I prototyped my application in Microsoft Excel. In this prototype, I'm using the BETADIST() function, which returns the cumulative beta probability density function. And, yes, if you're like me, and not a statistician, it's pretty crazy. Just for fun, check out the wikipedia page on it, and you'll see what I mean. Anyway, so now, I'm trying to perform the same functionality as that function in my Oracle APEX 4.0/Oracle 10g-R2 app.
    I've studied this function a bunch, and I couldn't find an equivalent function in Oracle to do what this function does. CUME_DIST... nope, DBMS_STATS_FUNC... nope. So, I assumed I would need to figure out what exactly the function does and basically rewirte it in Oracle using PL/SQL. I've already got questions out on Statistics and Excel forums trying to figure that out.
    But, before I go any further and reinvent the wheel by coding out the logic embedded in this function (which is very hairy, of course), I wanted to check with you all and see if there's a way to invoke this MS Excel function through Oracle. Not sure if an external procedure can get to an Excel library, or how to do it if it can.
    Any ideas?
    Thanks!
    Mark

    I'm pretty sure this BETADIST exists in Java already.Not natively I think.
    But one can download Cern's COLT Libraries for High Performance Scientific and Technical Computing in Java.
    Loading the libraries via loadjava
    loadjava -user michael/xxxx@oracle_server:1521:oracle_sid -verbose -force -order -resolve -thin colt.jar concurrent.jarand creating a function
    create or replace function betadist (alpha number, beta number, c number)
         return number
      as
         language java
         name 'cern.jet.stat.Gamma.incompleteBeta(double, double, double) return double';
    /is rather straightforward.
    Calling it
    SQL> select betadist(4,5,0.4) from dual
    BETADIST(4,5,0.4)
             ,4059136
    1 row selected.the result coincides quite well with the example given in http://www.excelfunctions.net/Excel-Beta-Dist-Function.html.

  • T-SQL functions in ORACLE

    Use T-SQL functions in ORACLE too, so you can write one script version that works in SYBASE, SQLSERVER and ORACLE when need to use the following functions:
    ceiling, charindex, dateadd, datediff, datename, datepart, day, db_id, db_name, getdate, host_id, host_name, left, len, month, replicate, right, space, str, str_replace, stuff, substring, suser_id, suser_name, user_id, user_name and year.
    The file [comp_tsql_ORA_schema.txt|http://forums.databasejournal.com/attachment.php?attachmentid=564&d=1258547015] creates the tablespace and schema to put the objects, and the file [comp_tsql_ORA.txt|http://forums.databasejournal.com/attachment.php?attachmentid=569&d=1259256898] creates the functions into the new schema. They will be avaliable for any schema of the oracle instance.
    Hope this help!
    Any suggestion please contact.
    aklein2003
    Edited by: user1958693 on 26/11/2009 10:16

    jgarry wrote:
    J2EE beta released around 1999. Religious programming wars far preceded that. Here's but [one example|http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/1c50bc13e9302f00/34bb8f3ac77e2388?q=programming+language+religion#34bb8f3ac77e2388] from a quick google. I'm no longer convinced that elegance is a desirable trait for a language. So call me a heretic.
    Ever tried XLISP? :-)
    It's different. Back then it was simply the language itself. And it was not really a religious kind of battle, but more a mine-is-bigger-and-better-than-yours one.
    With Java, it is all about The Acrhitecture and the blessed language of Java. ;-)
    I wouldn't so much blame J2EE believers for that. I think there is a fundamental complexity to web type paradigms that hasn't been described in a precise and encompassing enough manner to enable correct project planning.The basic problem is that the database is treated as a persistent storage layer only. A bit bucket. And that is exactly what a database is not.
    But as it is used that, loads of database features now need to be duplicated in the application layer. Which is done. Very poorly.
    Heck, I've even been told that J2EE's 3-tier architecture is not client server. Such ignorance is really unbelievable. Or is it pure stupidity?Until you just made me look it up, I would have thought that too, I'm sure I saw client/server defined as two-tier in the last century. But I have much more stupid misdefinitions to deal with on a daily basis, simply from the multiplicity of paradigms. I tend to retreat into my shell. Hehehe. Know that feeling... These days I rather run away, or set shields to full power, than try to get in yet another frustrating, fruitless and futile discussion with a Java head about the wonders of the J2EE architecture. Or trying to explain that this "new" architecture is predated with what we used in the 80's on mainframe systems with transaction monitors, block devices (the 80's web browsers) and databases - which software layer for software layer was almost identical to "+The Great Architecture+" of today. (and we did it without buzzwords too) ;-)
    Client-server is a software architecture and in essence describes 3 basic software components. The User Interface (UI), the Application (APP) and the Database (DB). And there are various ways to put these components together in a client-server architecture. The mistake that the Java fanbois make is thinking that client-server means having the client as the UI and APP as a single component (so-called fat client) and then the DB component as the server.
    There are numerous versions of these - including the APP component being a server component (as we now these days more commonly used in over the web).
    My beef with the J2EE "+religion+" always has been that client-server is client-server. The fundamentals stay the same.

  • Help:Modifying access sql to Oracle sql

    Hello folks can anybody please help me in changing the following code to oracle.Thanks a million.
    select
    IIf(prorated_directpay = 0 And prorated_feepaid = 0,
    "CASH DEPOSIT",
    IIf(prorated_directpay <> 0 And prorated_feepaid = 0,
    'NONCASH DIRECTPAY',
    IIf(prorated_directpay <> 0 And prorated_feepaid <> 0,
    "NONCASH FEE RECEIVED"))) AS recovery_flg,
    Left$(patientmemberid, Len(patientmemberid) - 2) AS Pat Mem ID
    from
    table
    WHERE (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_FEEAMT) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_DIRECTPAY) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_FEEPAID) <> 0))
    Edited by: user11961230 on Nov 5, 2009 1:35 PM

    user11961230 wrote:
    Hello folks can anybody please help me in changing the following code to oracle.Thanks a million.
    select
    IIf(prorated_directpay = 0 And prorated_feepaid = 0,
    "CASH DEPOSIT",
    IIf(prorated_directpay <> 0 And prorated_feepaid = 0,
    'NONCASH DIRECTPAY',
    IIf(prorated_directpay <> 0 And prorated_feepaid <> 0,
    "NONCASH FEE RECEIVED"))) AS recovery_flg,
    Left$(patientmemberid, Len(patientmemberid) - 2) AS Pat Mem ID
    from
    table
    WHERE (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_FEEAMT) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_DIRECTPAY) <> 0))
    Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
    ((Debtor . PRORATED_FEEPAID) <> 0))
    Edited by: user11961230 on Nov 5, 2009 1:35 PMYou bet, start by applying the lessons you learned in [YOUR LAST POST|http://forums.oracle.com/forums/message.jspa?messageID=3874940#3874940] and then come back with specific questions. Have you thought to use google to determine what the Access functions, which are not available in Oracle, do? After doing that, you can again google to see if you can find similar functionality in Oracle, if not ... we're here to help.

  • Using FILTER function in oracle answers

    Gurus,
    I have a question related to using Filter function in oracle answers.
    When trying to insert a Filter (expr) Using (expr) clause in the formula area of a fact table field, It errored out with msg saying about using a wrong measure.
    I know this can be done with a case expression but I tried filter clause since this is available in oracle answers.
    Please help me figuring out this scenario.
    Thanks.

    David / Raghu - Thanks for u'r replies and apologizes for not posting question with proper material.
    Am posting my code and the error message from the screen.
    Code :
    IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0)
    Error :
    nQSError: 10058] A general error has occurred. [nQSError: 22032] Function FILTER requires at least one measure attribute in its first argument. (HY000)
    SQL Issued: SELECT "Dim - MBS Loan"."LOAN AMOUNT", "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK", "Dim - MBS Loan"."LOAN TYPE SEN/SUB", "Dim - MBS Project"."PROJECT NAME", "Dim - MBS Project"."PROJECT NUMBER", "Fact - MBS Loan Transactions"."AR BALANCE INTEREST", "Fact - MBS Loan Transactions"."GL BALANCE INTEREST", IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0) FROM "Financials - MBS"
    OK (Ignore Error)
    Please continue answering my queries. Since am a newbie your answers won't be just a reply but it's actually learning for me.
    Thanks.

  • How to create SSWA plsql function in Oracle Apps of HTML call .html

    Hello Team,
    I am working on Oracle Apps 11i (11.5.10.2)
    I want to know , what is the process to create a , "SSWA plsql function" in Oracle Apps of type "HTML" and html call tab.
    How to create that Function and how to attach the PL/SQL code to these functions.
    How it works.
    Please help me to understand this concept from basics.
    Kind Regards

    Hi;
    Please review:
    how to setup a forms function in R12 to launch an URL?
    http://www.trutek.com/serendipity/index.php?/archives/15-An-Example-of-How-to-Create-Custom-Functions,-Menus,-and-Responsibilities.html
    Regard
    Helios

  • How to distinguish the User-Defined-Function from Oracle Build-In function

    Hi Friends,
    I could get the function list form all_objects table by the SQL:
    select * from all_objects where object_type = 'FUNCTION'
    but there is no column in all_objects specify the function is build-in or user-defined.
    But I found in SQL Server there is a column "is_ms_shipped" in the sys.all_objects table. This column will specify the object is build-in or user-defined. I want to get the equivalent column in Oracle but failed.
    Could anyone tell me how to solve this problem?
    Thanks,
    Ricky

    Thanks Pavan.
    But if an user connects to database using "conn /as sysdba" syntax and creates a function. This user-defined funtion goes into the "SYS" schema also. I know it is not the best practise to create objects using sys user so I think your solution is right.
    Regards,
    Ricky

  • Need Assistance for VBA function in oracle how to implement

    My very respected and Senior, regards,
    Sir, hope you will in best of health and wealth by the grace of God,
    Sir, i have a request problem as i m very junior against you and you have passed this time before many years ago as i m standing where. Sir i m a very junior developer of oracle and have a problem putting on your desk with the hope that you can help my as a boss.
    Sir me have to calculate yield of Bond using oracle form
    i have tried my best and tired
    there is a formulae in excel which give the Yield() when we provide the parameters
    and i need the excel formulae or the oracle calculation code of PLSQL for this.
    How can i get yield when i have price, coupon rate, frequency, issue and maturity of the coupon , coupon period , next coming coupon , and others detail.
    or tell me how to use EXCEL VBA for this problem ,
    thnx n regards,
    yours student, junior developer youngest brother
    Faraz
    How can I get the solution using Excel VBA function with oracle
    so that move values to excel calculate them and copy the result from excel to oracle forms

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • How to call java function in Oracle forms?

    Hi I am having Oracle 9i with 10g Developer Suite.
    I am new to Oracle forms..
    I had one function in java getDatas()..
    How can I call this function in Oracle Forms..
    Pls help
    Thanks

    Thanks Francois,
    I want to display values from my java code in the Forms..
    For that purpose only i am installing 10g Developer Suite..
    The below is java code..
    public class DBTest {
              public static String callDB(int id,String name){
              String ss="Hai";
              Connection con=null;
              try{
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("url","id","pwd");
                   Statement st=con.createStatement();
                   System.out.println("Connected...");
              int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
                   if(r==1){
                        ss="Inserted Sucessfully";
                   else{
                        ss="Insertion Failed";
              }catch(final Exception e){
              System.out.println(e);
              return ss;
         public static void main(String[] args) {
              int empid=102;
              String empname="Gilbert";
              String resultStr=callDB(empid,empname);
              System.out.println(resultStr);
    I want to dispaly Inserted or Insertion Failed in Oracle Forms..
    As per Gerd Volberg suggestion, i had placed DBTest.jar in
    E:\DevSuite\forms\java\DBTest.jar
    and in formsweb.cfg the below jar is added..
    archive_jini=frmall_jinit.jar,DBTest.jar
    But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
    org,ice,com and subnodes are available.
    But my jar is not available..
    Is my way is coorect?
    Pls provide soln..
    Thanks

Maybe you are looking for

  • How can I create a link or reference to an email in my inbox in Mail?

    I want to create links to emails (not links in emails), to be able to access an email directly out of my todo list program (I use Wunderlist). Example: an email requires an action. I create a todo in Wunderlist and I want to add a reference or link t

  • Deleting data from a table where there are no indexes on the table

    Hi We have one interface program for one time process.When I was testing the process it was taking too much time to load the data around 1000 records. it happens in 2 steps 1 puts into stage table 2 puts into base table in the process/package I have

  • Production order Target cost Zero - Varience calculation error KV151

    Hi Experts, I am having an issue on KKS2 variance calculation, system throwing error KV151 Target cost is 'Zero' All pre-requisites are ok including BOM, Rates, Routings etc.. Process: Production order with FERT - valuated material, All BOM component

  • Extend the SSO Oracle Portal Authentication Mechanism

    Hi All, I need to put some logic just before the Oracle Portal user is authenticated to SSO. Specifically I need to collect some information about the user from a database just before the SSOLoginServlet is called with all the parameters it needs. (u

  • IPhone 6 Antenna Vs. iPhone 5S Antenna

    HEllo Apple and other members recently i saw some videos...  of iphone6 has faster network signals...  iPhone LTE Speed Test: iPhone 6 vs. iPhone 5s iam having iphone 5s there is no LTE in my area.. in my home there is 2 bars of 3g network that is ve