PLSQL - Like statment

can i add parameter to like statment in PLSQL code :
select * from abcd where any_value like '%input parameter %'
thanks

This should be asked in sql pl/sql forum PL/SQL
Timo

Similar Messages

  • Crystal Syntax "Like" Statment on date searches.

    Post Author: smilbuta
    CA Forum: Data Connectivity and SQL
    Hello,
    I am currently developing an application using VS2005 and Crystal Reports.
    I wish to pass a Crystal Syntax statement to the report that searches for like dates in a date column in a SQL 2005 Database..
    The statments as follows.
    crystalsyntax = "{EQ_Equipment.equipment_warranty} like '2009'"
    I get returned an error saying string expected??
    so i tested diferent formats, and if i use this string i get only one record returned out of a known test group of 10 records.
    "{EQ_Equipment.equipment_warranty} Like DateValue('2009')"
    so im unsure what im doing wrong. Any advice would be apreciated.

    Post Author: Jagan
    CA Forum: Data Connectivity and SQL
    LIKE is used to compare strings. You're trying to compare a date with a string. That's why it says "string expected".
    I'm not sure what the result of DateValue('2009') is, but it's pretty certain that what you've then got is a date (warrenty) being 'liked' with a date, so both are being implicitely converted to strings first.
    What you could do is explicitely convert the warrenty date to a string in a format of your choice (don't rely on the implicit format) and then LIKE that with '2009'.
    Or change your statement to Year() = 2009  but this might result in Crystal doing the hard work instead of the database.
    Best would be to test that the warrenty date is in the year range, so that you can still use any index that might exist on the warrenty date column. See the help on 'in range operator'. e.g.  in DateValue(<year>, 01, 01) to DateValue(<year>, 12, 31)

  • Are there any tools to generate doc plsql like javadoc???

    Hi
    I want to know if there are any tools or plugin in order to buil-in javadoc with pl/sql code.
    Thanks
    Edited by: user10388210 on Oct 2, 2008 10:35 PM

    For what version?
    There are plenty of third-party tools available and there is an excellent built-in with 11gR1.
    http://www.oracle.com/pls/db111/search?word=PL%2Fscope&partno=
    http://www.psoug.org/reference/plscope.html

  • [b]how to use EJB QL for LIKE and ROWNUM[/b]

    Hi,
    i am using CMP EJB with OC4J server
    i face two problems in it when i make any query like
    select object(o) from Partymas o where o.stationCode like '?1' and o.rownum &gt;='?2' and o.rownum &lt;='?3' order by party_name
    then it shows error on rownum so i cant understand how to solve it
    second is when i use LIKE statment in EJB QL like this:-
    select object(o) from Partymas o where o.pinCode like '%?%'
    then it shows error so can any one help me
    thanks
    warm regards
    vikassheelgupta

    <ejb-ql>select object(o) from Partymas o where o.stationCode like '?1' and
    rownum >='?2' and rownum <='?3' order by party_name</ejb-ql>Try this:
    rownum >= ?2 and rownum <= ?3
    <ejb-ql>select object(o) from Partymas o where o.partyName like '%?%'</ejb-ql>Try this:
    like ?1

  • Using database links in a plsql page process

    I am trying to use a database link in a pl/sql page process.
    It works fine when I use the link name in the plsql like this:
    BEGIN
    SELECT 
    CARD_ID
    into  
    :P12_HDR_CARD_NUMBER 
    from     [email protected];
    But the link name will be coming from a page item (P12_DBLINK) populated as follows:
    select db_link d, db_link r from user_db_links; 
    I have tried the following and it's not working:
    DECLARE
    l_link VARCHAR2(30);
    BEGIN
    l_link :=  :P12_DBLINK;
    SELECT 
    CARD_ID
    into  
    :P12_HDR_CARD_NUMBER 
    from     fusion.EXM_CC_COMPANY_ACCOUNTS@l_link;
    this gives me:
    ORA-04052: error occurred when looking up remote object FUSION.EXM_CC_COMPANY_ACCOUNTS@L_LINK.WORLD ORA-00604: error occurred at recursive SQL level 3 ORA-02019: connection description for remote database not found
    I thought that maybe the link name was getting appended with .WORLD automatically but the link name already has .WORLD at the end. I tried stripping that off first but the error is the same.
    Is there some synatx for this that will work for this? Will I need to use dynamic sql?
    Any suggestions are most appreciated.
    thanks,
    john

    Hi John,
    check the following example to use the execute immediate statement for your purpose
    sql - Variable for Database Link Name - Stack Overflow
    let me know if this answers your query in the current thread

  • Passing parameters to like condition

    hi all,
    i am trying to pass a parameters from a form to a report and use this parameter
    in a where condition of the sql query , my problem is that i need to use this parameter in a like statment to bring all the records which are like this parameter
    its not working...
    function AfterPForm return boolean is
    V_WHERE VARCHAR2(200);
    begin
    --:P_called is the parameter sent from the form
    IF :P_called IS NOT NULL THEN
         V_WHERE := '%'||:P_called||'%';
    END IF;
    :P_where := 'AND CALLED like' || V_WHERE;      
    return (TRUE);
    end;
    ----- this is the query----
    SELECT *
    FROM VOIP_CDR
    where substr(VOIP_CDR.CALL_INITIATION_TIME,1,8) between :f_date and :t_date
    &p_where

    What if you change the code like:
    :P_where := ' AND CALLED like' || V_WHERE;
    so add an additional space in front of the AND statement

  • Plsql exceptions from Java?

    If I have plsql like this:
    blue exception;
    red exception;
    Is there some way that I can tell from
    which java which of those exceptions has
    been raised? (I am aware of raise_application_error).

    http://examples.oreilly.com/9780596514464/Chapters_27and28_OPLSQL5e.pdf
    Sybrand Bakker
    Senior Oracle DBA

  • How can I do Shift operation in plsql

    hello,
    i want to know whether there is any package or operator to do the shift operation in plsql.
    like (myVar<<8 in c++).

    why don't you use
    myvar := mywar * power(2,8);

  • Capture insert, update and delete messages PlSql

    How can I capture insert, update and delete messages in PlSql, like
    '1 row inserted'.
    TIA, Leo

    You can check the following script --
    satyaki>
    satyaki>create table test_598703
      2   (
      3      Sno   number(5)
      4   );
    Table created.
    satyaki>
    satyaki>declare
      2    cnt  number(5);
      3  begin
      4    insert into test_598703
      5    select empno
      6    from emp;
      7   
      8    cnt := sql%rowcount;
      9   
    10    dbms_output.put_line(cnt||' Rows Inserted');
    11  exception
    12    when others then
    13      dbms_output.put_line(sqlerrm);
    14  end;
    15  /
    16 Rows Inserted
    PL/SQL procedure successfully completed.
    satyaki>
    satyaki>select * from test_598703;
           SNO
          7369
          7499
          7521
          7566
          7654
          7698
          7782
          7788
          7839
          7844
          7876
           SNO
          7900
          7902
          7934
          9898
          7006
    16 rows selected.Similar approach need to follows for other operations.
    Regards.
    Satyaki De.

  • Why can't I view and download PDF's?

    Folks;
    I keep having problems since I upgraded to Snow Lepard. Since the upgrade I have not been able to view or down load PDF's like statments from various organizations. It doesn't seem to make any difference which browser I use, Safari or FireFox. Before SL I was able to download these same files and view them in Preview. Any suggestions?  Do I need Acrobat Reader?
    Thanks
    Cap2799

    Only a few PDFs require Adobe Acrobat.  Preview should be able to open most.     What happens if you Option click the PDF link and open it from your download folder using the control-click Open-with Preview?

  • Jdeveloper with VPD / FGAC possible ? i.e. oracle portal tables and views

    I am trying to create some view objects based on oracle portals views and tables. However I always get the following error.
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1407
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1216
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1469
    ORA-06512: at "PORTAL.WWCTX_API", line 152
    This is because I have not set the context using plsql. i.e
    portal.wwctx_api_private.set_context(p_user_name => 'PORTAL',p_update_flat => true);
    Is there a way of using portal views in jdevloper and setting the context first. I am thinking the portal database uses vpd, fine grained access control.
    Regards
    Orlando

    Hi,
    using ADF BC you can override the prepare session method on the AM to set the context.
    public void prepareSession(Session _session)
    super.prepareSession(_session);
    // some PLSQL like
    String appContext = "Begin ctxhrpckg.set_userinfo('"+getApplicationUserName()+"'); END;";
    java.sql.CallableStatement st= null;
    try
    st = getDBTransaction().createCallableStatement(appContext,0);
    st.execute();
    } catch (java.sql.SQLException s)
    throw new oracle.jbo.JboException(s);
    } finally
    try
    if (st!= null)
    st.close();
    } catch (java.sql.SQLException s2){}
    Frank

  • Any EVAL() equalant functions in SQL or PL/SQL

    good day
    i have 2 loops ,
    outer loop has the real data from a table
    and
    inner loop has the column name to be selected from outer loop.
    so in runtime, i need to select the columns dynamically .thats why i use inner loop. please see below.
    for i in data Loop
    for j in col_name Loop
    --column name of data loop should be selected from this col_name loop.
    dbms_output.put_line(i.||j.col_name);
    End Loop;
    End Loop;
    But this should not work.
    is there any eval function in plsql like in java and javascript to resolve this?
    please advice.
    thanks

    > so in runtime, i need to select the columns dynamically .thats why i use
    inner loop.
    There are two basic approaches to dealing with dynamic projections. (projection = the columns and data types returned by a SELECT)
    One is to use an interface that allows you, at run-time, to describe the projection. This is called a cursor's describe interface. In PL/SQL, that requires you to create a DBMS_SQL cursor. Details are in the [url
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#sthref7370]Oracle® Database PL/SQL Packages and Types Reference guide.
    The other approach is to deal with the projection as a collection. This is illustrated below. The two problems with this approach is that you must use the collection's constructor in the projection, and that you must deal with implicit conversions or hardcode explicit data type conversions.
    SQL> create or replace type TStrings as table of varchar2(4000);
    2 /
    Type created.
    SQL>
    SQL> declare
    2 cursor c is
    3 select
    4 TStrings( object_id, object_name, object_type, created )
    5 from user_objects
    6 where rownum < 3;
    7 colValue TStrings;
    8 begin
    9 open c;
    10 loop -- data loop
    11 fetch c into colValue;
    12 DBMS_OUTPUT.put_line( '**start of row**' );
    13 for i in 1..colValue.Count
    14 loop -- column loop
    15 DBMS_OUTPUT.put_line( 'column '||i||' value='|| colValue(i) );
    16 end loop;
    17 DBMS_OUTPUT.put_line( '**end of row**' );
    18 exit when c%NOTFOUND;
    19 end loop;
    20 close c;
    21* end;
    SQL> /
    **start of row**
    column 1 value=12108
    column 2 value=BIN$OU4aqY4cfvXgQPsKOl1I1A==$0
    column 3 value=TABLE
    column 4 value=2007/08/31 12:20:47
    **end of row**
    **start of row**
    column 1 value=11753
    column 2 value=BONUS
    column 3 value=TABLE
    column 4 value=2007/08/27 14:26:57
    **end of row**
    **start of row**
    column 1 value=11753
    column 2 value=BONUS
    column 3 value=TABLE
    column 4 value=2007/08/27 14:26:57
    **end of row**
    PL/SQL procedure successfully completed.
    SQL>

  • Disable profile option updation at user level

    I want to disable the profile option HR: Security Profile or for that matter any other profile option at user level. The user should be able to see the value set by the system administrator (Field should be grayed out) and user should not be able to update it.
    How to do it??

    Try a personalization combined with custom PLSQL, like this:
    1) Acces System Profiles
    2) Help->Diagnostics->Custom Code->Personalize
    3) In the newly displayed Form Personalization form, create a line with a description like this: Prevent modification of USER_VISIBLE_VALUE
    4) In the Conditions tab, set Trigger Event = WHEN-NEW-ITEM-INSTANCE
    5) Set Trigger Object = PROFILE_VALUES.USER_VISIBLE_VALUE
    6) In the Condition text area, enter:
    apps.xxror_test_sysprofile(:PROFILE_VALUES.USER_PROFILE_OPTION_NAME,'USER')=1
    7) Set Processing Mode to Both
    8) Switch to the Actions tab and create two actions:
    first:
    type = property
    description = Don't update
    Language=all
    enabled=yes
    object type=Item
    target object=PROFILE_VALUES.USER_VISIBLE_VALUE
    property name=UPDATE_ALLOWED
    value=false
    second:
    type=property
    description=Don't enter
    language=all
    enabled=yes
    object type=Item
    target object=PROFILE_VALUES.USER_VISIBLE_VALUE
    property name=ALTERABLE_PLUS
    value=false
    9) Repeat steps 3-8 if desired for other levels, such as:
    Prevent modification of SITE_VISIBLE_VALUE
    Prevent modification of APPL_VISIBLE_VALUE
    Prevent modification of RESP_VISIBLE_VALUE
    Prevent modification of SERVER_VISIBLE_VALUE
    Prevent modification of ORG_VISIBLE_VALUE
    paying attention to update the corresponding names for xxx_VISIBLE_VALUE.
    10) Create the following PLSQL function:
    CREATE OR REPLACE function xxror_test_sysprofile (
    prof_opt_name in varchar2,
    lvl in varchar2
    return number
    is
    v_ret number;
    s_prof varchar2(1024);
    s_uname varchar2(100);
    s_lvl varchar2(10);
    begin
    -- returns 0 if the user "uname" must be granted access the profile named "prof_opt_name" at the "lvl" level
    -- returns 1 if the user "uname" must be forbidden to access such a profile at such a level.
    -- important assumption: the "lvl" parameter may have only one of the following values:'SITE', 'APPL', 'RESP', 'USER', 'SERVER', 'ORG'
    -- or else this function will return 1, thus forbidding the access
    s_uname:=substr(upper(trim(nvl(fnd_profile.value('USERNAME'),''))),1,100);
    if s_uname in ('MY_ADMIN_1','MY_ADMIN_2','SYSADMIN') then
    v_ret:=0; -- no restrictions
    else
         if s_uname in ('MY_POWERUSER_1','MY_POWERUSER_2') then
         -- restrict to only the below mentioned profiles
         s_prof:=substr(upper(trim(nvl(prof_opt_name,''))),1,1024);
              s_lvl:=substr(upper(trim(nvl(lvl,''))),1,10);
              if
              (s_prof like '%WHATEVER%')
              then
                   if s_lvl in ('SITE', 'APPL', 'RESP', 'USER', 'SERVER', 'ORG') then
                        v_ret:=0; -- level acceptable for these users on these profiles
                   else
                        v_ret:=1; -- unknown level, so reject
                   end if;
              else
                   -- these users may not access these profiles, so reject
                   v_ret:=1;
              end if;
         else
              if s_lvl = 'SITE' then
              -- no way any other user than those above may modify site-level profiles
              v_ret:=1;
              else
                   -- any other user than those above may modify lower-level profiles, but
                   -- for now reject all
                   v_ret:=1;
              end if;
         end if;
    end if;
    return v_ret;
    end;
    Pls be aware that testing first on a test instance is always advisable.

  • I am looking for information about Portal on internet

    Hi,
    Do you know any page on internet where I can find information
    about Portal ?
    I want to know functions and procedures that are available to use in Portal aplication plsql like p_session and others...
    Thanks.
    Enrique

    Hi,
    You can try using this link
    http://otn.oracle.com/products/iportal/htdocs/portal_faq.htm
    Thanks,
    Sharmila

  • Install error and PL/SQL error

    Hello,
    I'm new to Oracle. I installed Oracle8iR2 on Redhat Linux 6.2. During installation (more precisely during "Linking Oracle8i Enterprise Edition 8.1.6.1.0") I got this error :
    Oracle: Error in invoking target ioracle of makefile /home/oracle/OraHome/rdbms/lib/ins-rdbms.
    mk
    ORA-124547: TNS: lost contact
    ORA-03114: not connected to Oracle
    I clicked "Ignore" and the installation continued without any other errors.
    After the installation was finished I performed the initial configurations described in the manual as user root and user oracle. After that as user oracle I tried to start plsql like this :
    Enter user-name : system
    Enter password : *******(manager )
    oraclebogdan: error in loading shared libraries libdsbtsh8.so : cannot opeb shared object
    file : No such file or directory
    ERROR : ORA -12547 : TNS : lost contact
    Can you help me to fix the problems?
    Thank you,
    Bogdan Paduraru

    Bidyut Kumar (guest) wrote:
    : Jason Howk (guest) wrote:
    : : Jack Lauman (guest) wrote:
    : : : During the linking process of "./orainst /c", I got the
    : : following
    : : : error on the RDBMS, SQL*PLUS and PL/SQL install:
    : : : /usr/i386-linux/bin/ld: cannot open -lnsl: No such file or
    : : : directory
    : : : make: *** [u01/app/oracle/product/8.0.5/rdbms/lib/oracle]
    : : Error
    : : : 1
    : : : Status: 2
    : : : ((OIERR-SYSTEM: make -f ins_rdbms.mk
    : : : ORACLE_HOME=/u01/app/oracle/product/8.0.5 install))
    : : : --------[ rdbms.ins 2631---------------
    : : : The file in question is nowhere on the disk. Anyone have
    : any
    : : : clues?
    : : : Thanking you in advance for your cooperation,
    : : : Jack Lauman
    : : : nwcascades.com
    : : I get the same error using Slackware 3.6. Anyone have any
    : : clues? FYI, I receive the same error on the standard
    edition
    : as
    : : well.
    : : --Jason
    : Even I have the same problem and unable to find the solution.
    : Why is happening. I have no clue at all.can anybosy anywhere
    : could help?
    : Thanks
    : --Bidyut
    I have a similar problem on Red Hat 5.2. In my case, the
    failing command is:
    Command: make -f ins_plsql.mk install <<!
    The failing portion of that make file is:
    `cat /raid/u01/app/oracle/8.0.5/lib/sysliblist`
    It seems that file (sysliblist) contains the following:
    -lnsl -lm
    So, it appears to be looking for
    /raid/u01/app/oracle/8.0.5/lib/libnsl.a and
    /raid/u01/app/oracle/8.0.5/lib/libm.a
    Neither of those files exist anywhere on my hard disk. This
    appears to be the same problem originally reported, above.
    So far, no clues.....
    ============================================
    By the way, I had an earlier failure during a different make
    where it was trying to compile something and include a header
    file of "sys/types.h" and I fixed it by creating a "sys"
    subdirectory in /usr/include that only had in it a symbolic
    link to the regular "types.h" file.
    null

Maybe you are looking for