How to frame dynamic condition and evaluate them

hi all
i have a table which has 3 columns
col1 col2
coloumn 1 will have relational operators like =,>,< etc
and coloumn 2 will have some values
in a procedure which has a in parameter. i need to check the parameter with the col2 using col1 ie using the relational operator.
for ex
the parameter will be 10 and the operator will be > and the column2 will be 11
how will i do this dynamically and how will i evaluate this conditions
thanks in advance
hari

One approach:
SQL> create or replace function DynamicFunction ( op1 number, operator varchar2, op2 number) return boolean is
2 plsqlBlock varchar2(4000);
3 boolInt integer;
4 begin
5 plsqlBlock :=
6 'declare
7 function ExecFunc return boolean is
8 begin
9 return('||op1||operator||op2||');
10 end;
11 begin
12 if ExecFunc then
13 :result := 1;
14 else
15 :result := 0;
16 end if;
17 end;
18 ';
19
20 execute immediate plsqlBlock using OUT boolInt;
21
22 return(boolInt=1);
23 end;
24 /
Function created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> set serveroutput on
SQL> declare
2 procedure Eval( op1 varchar2, operator varchar2, op2 varchar2 ) is
3 begin
4 DBMS_OUTPUT.put( op1||operator||op2||'=' );
5 if DynamicFunction( op1, operator, op2 ) then
6 DBMS_OUTPUT.put_line( 'TRUE' );
7 else
8 DBMS_OUTPUT.put_line( 'FALSE' );
9 end if;
10 end;
11 begin
12 Eval( 1, '=', 2 );
13 Eval( 2, '>=', '2' );
14 end;
15 /
1=2=FALSE
2>=2=TRUE
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • How to increase dynamically open_cursors and session_cached_cursors

    how to increase dynamically open_cursors and session_cached_cursors
    for Ex. alter system open_cursors = 500

    instane level:
    alter system set session_cached_cursors=200 scope = spfile; or set init.ora file.
    alter system set open_cursors=400;
    More details about open_cursor and session_cached_cursor, refer the below link
    http://www.orafaq.com/node/758
    Regards
    RajaBaskar

  • I have a windows computer. How can I create apps and put them on itunes?

    I have a windows computer. How can I create apps and put them on itunes?

    You can't. The iOS SDK requires Mac OS X and an Intel Mac; Windows applications can't be put on either the iOS or Mac OS X App Stores.
    (82889)

  • My contacts are not updating from the iCloud. How can I actively go and retrieve them?

    My contacts are not updating from the iCloud even with "push" on. How can i actively go and retrieve them?

    Hello there, Lk354.
    The following Knowledge Base article offers up some great recommendations for troubleshooting issues with using iCloud Contacts:
    Get help using iCloud Contacts
    http://support.apple.com/kb/TS3998
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • How do I take movies and save them on the iPad?

    How do I take movies and save them on the iPad?
    Thank you for your help.

    Tank you Jim for responding: "(swipe Video to the selected position - don't just touch it)."
    (I can't believe this!) I open camera. tap video: nothing. Swipe video button (where to?) nothing.
    Reading videos at a glance in the iPad user guide gives me nothing. I know I must be missing something. 
    Thank you for your help.
                                             Walter                                                                                       

  • How to use dynamically column_name and column_name value in plsql procedure

    hi,
    how to use dynamically column_name and column_name value in plsql procedure.
    for example, i have one table with column col1.i want write plsql code with dynamically execute the insert one schema to another schema.
    by
    siva

    DECLARE
    CURSOR C
    IS
    SELECT cc_cd
    FROM TEMP1 WHERE s_flg ='A' AND b_num IN('826114');--,'709537','715484');
    CURSOR D
    IS
    SELECT * FROM cONSTRAINTS_test ORDER BY SRL_NUM;
    STMT VARCHAR2(4000);
    p_target_schema VARCHAR2(30):='schema1';
    p_source_schema VARCHAR2(30):='schema2';
    BEGIN
    FOR REC IN C
    LOOP
    FOR REC1 IN D
    LOOP
    STMT := 'INSERT INTO '||p_target_schema||''||'.'||''||REC1.CHILD_TABLE||' SELECT * FROM '||p_source_schema||''||'.'||''||REC1.CHILD_TABLE||' where '||REC1.COLUMN_NAME||'='||REC.cntrct_cd||'';
    Dbms_Output.Put_Line('THE VALUE STMT:'||STMT);
    END LOOP;
    END LOOP;
    END;
    cc_cd='434se22442ss3433';
    cc_t_ms is parent table-----------------------pk_cc_cd is primary key
    cc_cd is column name
    CONSTRAINTS_test table
    CHILD_TABLE NOT NULL VARCHAR2(30)
    CONSTRAINT_NAME NOT NULL VARCHAR2(30)
    COLUMN_NAME NOT NULL VARCHAR2(400)
    R_CONSTRAINT_NAME VARCHAR2(30)
    CONSTRAINT_TYPE VARCHAR2(1)
    PARENT_TABLE NOT NULL VARCHAR2(30)
    SRL_NUM NUMBER(4)
    CHILD_TABLE     CONSTRAINT_NAME     COLUMN_NAME     R_CONSTRAINT_NAME     CONSTRAINT_TYPE     PARENT_TABLE     SRL_NUM
    a aaa cc_CD     pk_cc_CD     R     cc_t_MS     1
    bb     bbb      Cc_CD     PK_CC_CD     R     cc_t_MS     2
    bb_v     bb_vsr     S_NUM     PK_S_NUM      R     bb_v      3
    cC_HS_MS     cc_hs_CD     cc_CD     PK_CC_CD     R     cc_t_MS     4
    cC_HS_LNK cc_HIS_LNK_CD     H_CD     PK_HS_HCD     R     cC_hs_ms 5
    cC_D_EMP     cc_d_EMP     Cc_CD     PK_CC_CD      R     cc_t_MS     6
    i want insert schema1 to schema2 with run time of column_name and column value.the column_name and values should dynamically generated
    with refential integrity.is it possible?
    can any please quick solution.its urgent
    by
    siva

  • How to create RFQ s and use them to complete the program

    hi,
    how to create RFQ s and use them to complete the program
    thanks in advance

    Hi Santosh,
    RFQ is created through transaction ME41.
    You need to write down BDC for mass update of RFQ, because BAPI is not available.
    Regards,
    Tutun

  • When i updated my iPhoto on my macbook my whole computer lost photos, music, documents ect, how do i fix this and get them all back?

    when i updated my iPhoto on my macbook my whole computer lost photos, music, documents ect, how do i fix this and get them all back?

    Which os do you have?  Which version of iPhoto did you update to?  Did you check iPhoto's trash?  Finder's trash?  Did you repair permissions and restart your computer after updating?
    Data recovery utilities - "Data Rescue II"
    VirtualLab™ Data Recovery
    DriveSavers Data Recovery
    http://www.stellarinfo.com
    FileSalvage

  • Somehow, I erased all my contacts when syncing music. Any idea how I go about locating and redownloading them

    Somehow, I erased all of my contacts while syncing music. Any clue on  how I go about locating and redownloading them? Thanks

    Hopefully you have those contacts on your computer from a previous sync.  If you do, connect your iphone, click on your iphone, and then go to "info" and make sure "sync all contacts" is checked.  Then sync and you should be good to go.

  • How do I create variables and store them?

    How do I create variables and store them?

    As someone already said, we need to know a little more about what you want to do with these variables, but in general, APEX Items are probably what you want. You can create APEX Items at the Application or Page level. Once you set the value of an item, you can reference it anywhere else in the application. So, if you have an item on page 1 called P1_ENAME, you can reference it on page 32 using bind variable syntax :P1_ENAME. If you just want to store but not display some information, you can use either a hidden page item or an Application Level item. Take a look at the 2 Day Developers Guide for more info.
    Tyler

  • How do I dynamically name and create arrays?

    I need to create arrays dynamically based on user's input. For example, if user enters 5, I have to create 5 arrays. Can anyone please tell me how to name and create them?

    So, if you don't know how many arrays to create when you're writing the code, you wouldn't name them. You'd create an ArrayList (or some other collective data structure) and name that, and then put the 5 arrays into that structure.

  • How to configure multiple buffers and execute them sequentially?

    I would like to build up a path follower using at least two buffers. I wish to write data into the buffers in advance and then execute them sequentially. How can I do?
    I have tried the case for using two buffers, and could only get the two buffers to work "sequentially",
    which means that I could first write data into buffer 1, then execute it, then write data to buffer 2,
    then execute it. Is there any way that I could use multiple buffers and exectue them as the sequence as
    I want?
    The following are the steps that I used for dual buffers:
    buffer 1:
    flex_set_op_mode
    flex_configure_buffer
    flex_write_buffer (check ready)
    flex_start (check complete)
    buffer 2:
    flex_set_op_m
    ode
    flex_configure_buffer
    flex_write_buffer (check ready)
    flex_start (check complete)
    I wish to achieve the following:
    flex_configure_buffer (buffer 1 & 2)
    flex_write_buffer (to buffer 1)
    flex_start (buffer 1)
    while waiting (flex_write_buffer (to buffer 2))
    flex_start (buffer 2)
    The purpose of my using two buffers is to try to prepare data for buffer 2 when we are waiting
    for the execution of buffer 1 and we could execute buffer 2 almost immediately when buffer 1 was
    done. Apparently, I have tried and with no luck to get it to work.

    You can always configure a buffer for indefinite continuous operation by setting the total points value in the configure buffer function to be the maximum value allowed. You can the use the check buffer function inside the while loop to monitor the backlog of your buffer in order for enough positions to be avaliable for the next set of points to be downloaded. As long as your sets of data are of a smaller size than the total buffer size this will have the effect you are desiring. You can always make your precalculations for the next set of points while the previous move is being executed, you just need to allow enough time between the beginning and the end of your first move for the next calculation to be done.

  • How to export HD files and play them on Western Digital HD Media PLayer?

    Hi Folks,
    I'd need your help here. I shoot HD video in AVCHD with Canon HF200.
    My goal is to be able to export my edited footage with minimum quality loss and be able to play it on the well known Western Digital HD Media Player:
    http://www.wdc.com/en/products/Products.asp?DriveID=735
    The player supports the following formats for video:
    Video - AVI (Xvid, AVC, MPEG1/2/4), MPG/MPEG, VOB, MKV (h.264, x.264, AVC, MPEG1/2/4, VC-1), TS/TP/M2T (MPEG1/2/4, AVC, VC-1), MP4/MOV (MPEG4, h.264), M2TS, WMV9
    Here is what I do:
    1. I convert the avchd files into .avi using  Cineform Prospect HD.
    2. Then I import and edit the footage in Adobe Premiere Pro CS3
    3. Finally I export the edited footage using the ' BD-h.264 ' codec in the 'Adobe Media Encoder'
    4. I end up with two files after the export: .M4V file (video) and .WAV file (sound).
    The WD HD Media Player plays 'black' screen while displaying a message 'no audio'.
    I guess the exported file is not fully supported by the WD player,
    Any ideas? How can I combine the two files into one and play it on the WD player?
    Maybe I'm not exporting it correctly?
    Please share your experience and help me out.
    Thanks

    Let me give you an optimum example of my last HD to DVD timing.  The video was shot with two cameras under good lighting conditions and there was very little color correction required and only a few special effects.  The finished video was 39 minutes (1.35 GB).  The AME encoding time on my 8 core (2.33 GHz) with a really fast RAID 0 array was 36 minutes 48 seconds!  If you start adding in a lot of color correction and lots of other effects encoding time does increase significantly. I am convinced that the DVD was of much better quality that had we shot it in SD.  I have had problem shoots (lighting) that required vast amount of color correction etc. that required many hours of MPEG2 DVD encoding.
    Incidentlly I do not export from Premiere (which uses the new copy of the Project on your C:drive), I close Premiere and open AME and use the much faster true project file on my RAID 0 array.

  • How to create mass users and map them to existing  hrms users

    Hi,
    Im running oracle ebusiness suite 12i . I want to create mass users , and map them to existing hrms users.
    The users I want to create exist in an excel spreadsheet with the columns employee id, user name. They will all be granted the same responsibility. I want to map them to existing hrms users using the employee id key.
    I have read about the package FND_USER_PKG.CREATEUSER and I can loop over it by using sql loader to create a temporary table, but I m lost on how to automatically map them to hrms users as part of the script.
    Any help.
    dula

    Thanks a lot Omka,
    I managed to create the users by running the script:
    declare
    Cursor C1 is
    select d.product_code,b.responsibility_key from FND_USER_RESP_GROUPS_ALL a,fnd_responsibility b,fnd_user c,fnd_application d
    where a.user_id = c.user_id
    and a.responsibility_id = b.responsibility_id
    and b.application_id = d.application_id
    and c.user_name ='JOCHIENG';
    Cursor employee is
    SELECT EMPLOYEE_ID,EMPLOYEE_NAME from eldoret_final;
    BEGIN
    for e in employee loop
    fnd_user_pkg.createuser
    x_user_name => e.EMPLOYEE_NAME
    *,x_owner => ''*
    *,x_unencrypted_password => 'welcome123'*
    *,x_start_date => SYSDATE - 10*
    *,x_end_date => NULL*
    *,x_description => 'CBK Employee'*
    *,X_EMPLOYEE_ID => e.EMPLOYEE_ID*
    fnd_user_pkg.addresp(upper (e.EMPLOYEE_NAME),'PER', 'CBK_EMPLOYEE_DIRECT_ACCESS','STANDARD', 'DESCRIPTION', sysdate, null);
    end loop;
    commit;
    end;
    I had first created the user JOCHIENG and assigned it the responsibility for Self service. So the script just assigns the responsibilities by copying from the one assgined to this user.
    Everything seems ok. However, when trying to log in as the new user, the login error: Login failed. Please verify your login information or contact the system administrator.
    is returned. But I can reset the password using the forms under Security > Define. Even with the correct password, the login doesn't go through.
    Any idea?
    dula

  • How to create dynamic strcture and accepting runtime value in work area

    Hi,
    I am using RFC_READ_TABLE for  joining more than table  and written select query but  into clause work area value is passed but it is short dump is displaying with too few many fields  in into clause .work area WA need some casting type conversion which accepts the some run time value  and should have some structure  for it.how to create dynamic structure?

    hi
    good
    go through this and use in your report accordingly.
    If you are trying to read some information from SAP and you can't find the right BAPI then RFC_READ_TABLE can do the job for you.
    RFC_READ_TABLE is powerful RFC it gives you the access to all tables and views in SAP. I basically used RFC_READ_TABLE for Material Master Search application on the Intranet.
    Now you may say there are lots of BAPI for this functionality. You are right but I had to work around the BAPI to get Prices (Moving Average Price) and it just did not work very well. Because of the nature of the application I had to use RFC_READ_TABLE because then I can use powerful SQL expression for searching. RFC_READ_TABLE give you the ability to code the where clause which is quite enough.
    I have included part of the code use in asp page to read ENT1027 for Mgroup and M description & number but without object creation. The other part of the code reads MBEW for price & quantity.
    Code
    lt;%
    '#######################Diming the Structures
    Call BAPIRFC.DimAs("Rfc_Read_Table", "FIELDS", MaterialSelection_RS)
    Call BAPIRFC.DimAs("Rfc_Read_Table", "OPTIONS", Selection_RS)
    '########################Search Type########################
    ' C contanis
    ' S Start with
    ' E Ends with
    if searchtype = "C" then
    FormatedSearch_Keyword = "%" & Search_Keyword & "%"
    elseif searchtype = "S" then
    FormatedSearch_Keyword = Search_Keyword & "%"
    else searchtype = "E" then
    FormatedSearch_Keyword = "%" & Search_Keyword
    end if
    '################# Flaged for deletion Materials #####################
    if showdeleted = "No"  then
    Selection_RS.AddNew Array("TEXT"),Array("LVORM <> 'X' AND")
    end if
    '############## users can search three material group ################
    '############## GROUPS: OFFICESUP TECOMHARD TECOMSOFT ###############
    '##USER STILL CAN NAROW THEIR SEARCH BY SELECTING ON OF THREE#########
    if MGroup = "ALL"  then
    Selection_RS.AddNew Array("TEXT"),Array("MATKL IN ('OFFICESUP','TECOMHARD','TECOMSOFT')")
    else
    Selection_RS.AddNew Array("TEXT"),Array("MATKL = '"& MGroup &"' and ")
    end if
    '#######################ADDING SEARCH KEYWORD TO STRUCTURE##############
    if not  Search_Keyword = "" then
    Selection_RS.AddNew Array("TEXT"),Array(" MAKTG LIKE '" & FormatedSearch_Keyword &  "'")
    end if
    Selection_RS.Update
    '#######################ADD RETURNED FIELDS#########################
    MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATNR","000000","000000" ,"","")
    MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATKL","000000","000000" ,"","")
    MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MAKTG","000000","000000" ,"","")
    MaterialSelection_RS.Update
    call BAPIRFC.Rfc_Read_Table("ENT1027", Material_RS, MaterialSelection_RS, Selection_RS, "~", "", "0", "0")
    If Err.Number > 0 then
                   Response.Write "Error:" & "<BR>"
                   Response.Write "   Err.number...... " & Err.Number & "<BR>"
                   Response.Write "   Err.Description. " & Err.Description & "<BR>"
    end if
    '###########LOOP THROUGH RECORDSET
    if not Material_RS is nothing then
    do while not Material_RS.eof
    loop
    end if
    %>
    thanks
    mrutyun^

Maybe you are looking for

  • Miro BAPI

    Hi, I am trying to use BAPI_INCOMINGINVOICE_CREATE for MIRO transaction.  Can anyone please explain to me how to use component PROFIT_SEGM_NO in structure BAPI_INCINV_CREATE_GL_ACCOUNT?  (This is missing from the documentation as it is a 'late' addit

  • Step status, number of steps and result container

    Hi All. I have several problems with my OI. 1. I am using my own execution viewer, its build up on UIMessages, that is executed from my custom step types as a poststeprun. The problem is that when poststeprun is executed then the status expression is

  • Mac vs. PC Graphic profile - Underexposed photos

    Is there a way to assign the PC graphic profile to png or jpg images? Can have some opinions how to deal with the difference in color/ graphic profiles between PC and Mac. My fotos look very dark on PC. I can't ignore it! If i'd fix the contrast, exp

  • Lenovo ideacentre a310 graphics

    Hi all Simple question, anyone know if there is a possible graphics upgrade for this ideacentre? Thanks - Kasper

  • Macbook air 13 lcd problem

    My 2012 13 inch macbook air lcd has got a 1 long line in the middle. How to fix it?