How can I implement cursor in OWB

Hello,
I would like to try convert my PL/SQL into OWB structure, basically here is how I coded into PL/SQL
Variable cur_a = NULL
Variable prev_a = NULL
Variable found_data = 'N'
Open Cursor read data from table_a order by ....
cur_a = cursor.data_column1
if cur_a <> prev_a or prev_a is NULL then
found_data = 'N'
end if;
if cur_a = prev_a and found_data = 'N' and other condition in cursor match then
insert data into table_b
change found_data from 'N' to 'Y'
elseif cur_a = prev_a and found_data = 'Y' then
do nothing
end if;
prev_a = cur_a;
Loop
I would like to convert them into using OWB, can OWB able to do as I mention without using any Oracle procedure/function..
Thank you in advance.

If I understood your problem correctly, you need to insert only rows if data_column1 is different from the one in previous row or if there is no previous row. For example:
key_kolumn.....data_column1
223344..........100,00
223344..........100,00
223344..........150,00
223344..........150,00
In this case you would only insert rows 1 and 3. When applying LAG to data_column1, you would get:
key_kolumn.....data_column1..LAG(data_column1)
*223344...........100,00...........NULL*
223344..........100,00.........100,00
*223344...........150,00...........100,00*
223344..........150,00.........150,00
If you filter the rows which have data_column1 &lt;&gt; LAG(data_column1), you would get the desired result set (in bold). There would be no need to use a variable to know if a row is already inserted.
Regards,
Mate

Similar Messages

  • I need to run a map against a particular dataset  - how can i do it in OWB

    Hello again :)
    I need to run a map against table on a particular dataset (WHERE clause) - how can i do it in OWB?
    The map is loading data from table A into table B (doing all sorts of wierd and wonderful things in between). Now table A had more (a lot more) data added which i have to load into table B.
    How can i modify my map so that it only runs agains this newly added data (normally i would do a where clause).
    i cannot find how to do it in OWB :(
    The map i am runnig is fairy complex so i didn't really want have to create another table/view of the data i need then remap in all etc.
    Any ideas would be greatly appreciated.
    thank you very much
    Kind Regards
    Vix

    Hello AP
    Well that is the thing - records are constantly added to table A all the time and then undergo tramsformations and loaded into table B. What i want to do is somehow indicate in the the map to only run agains records that have beed added (colmn2 = 'value').
    At the moment i created a view for the desired dataset (colm2 = 'value') and remapped everything. But it is a bit of a pain:
    1) there are a lot of functions and each takes a number of columns (i have some functions taking up to 6 diff columns)
    2) i have data loaded to table A all the time and i need to then transform and load it to table B. so i try to aviod doing the whole re-mapping thing all the time.
    In TOAD it would be a simple statment 'where colm2 = 'value' and all my functions will be run agains those records that satisfy the condition. How can i do it in OWB?
    If i use filter - i would have to use 'mid' table where filtered records will be loaded and from that use 'mid' table as table A in the map. does this make sense?
    the main disadvantage is the performance - moving data from one table to 'mid' table etc.
    I tried using conditional load filter and it still doesn't do what i want.
    After trying diff options i decided to ask people here about it. The only thing i have left to try is to ask Oracle support. I am sure it would be a 'user knowledge' as i am sure this functionality exist i just can't find any references to it.
    Thank you very much for all your help. In fact this forum helped me a lot with a number of other issues :)
    i just feel like a lemon coz it is very simple thing and i can't find how to do it...
    Kind Regards

  • How can I implement a comfirmation window when closing javafx application?

    hi,guys
    I'd like to add a confirmation window when user is closing my javafx application,if user click yes, I will close the application,if no ,I wouldn't close it ,how can I implement this function?
    primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
                   @Override
                   public void handle(WindowEvent arg0) {
                        try
                             //todo
                        catch(Exception ex)
                             System.out.print(ex.getMessage()+"\r\n");
            });

    Hi. Here is an example:
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Pos;
    import javafx.stage.*;
    import javafx.scene.*;
    import javafx.scene.paint.Color;
    import javafx.scene.layout.*;
    import javafx.scene.control.*;
    public class ModalDialog {
        public ModalDialog(final Stage stg) {
         final Stage stage = new Stage();          
            //Initialize the Stage with type of modal
            stage.initModality(Modality.APPLICATION_MODAL);
            //Set the owner of the Stage
            stage.initOwner(stg);
            Group group =  new Group();
            HBox hb = new HBox();
             hb.setSpacing(20);
            hb.setAlignment(Pos.CENTER);
            Label label = new Label("You are about to close \n your application: ");
            Button no  = new Button("No");
            no.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                       stage.hide();
            Button yes  = new Button("Yes");
            yes.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                       stg.close();
             hb.getChildren().addAll(yes, no);
             VBox vb =  new VBox();
             vb.setSpacing(20);
             vb.setAlignment(Pos.CENTER);
             vb.getChildren().addAll(label,hb);
            stage.setTitle("Closing ...");
            stage.setScene(new Scene( vb, 260, 110, Color.LIGHTCYAN));       
            stage.show();
    }Test:
       import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.*;
    * @author Shakir
    public class ModalTest extends Application {
         * @param args the command line arguments
        public static void main(String[] args) {
            Application.launch(ModalTest.class, args);
        @Override
        public void start(final Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
           primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
                   @Override
                   public void handle(WindowEvent arg0) {
                                    arg0.consume();
                        try
                         ModalDialog md = new ModalDialog(primaryStage);
                        catch(Exception ex)
                             System.out.print(ex.getMessage()+"\r\n");
            primaryStage.setScene(scene);
            primaryStage.show();
    }

  • How can I implement a real time datawarehouse

    Hi, I'm a little lost here but I want to know how can I implement a real time datawarehouse in sql server, I don't know if it is only to make the extraction process the shortest time possible.
    Thank you

    Hi Mega15, 
    I agree with everything Seif and Louw said, but I'd like to add that if you are using SQL Server 2012 or 2014 and you want to use DirectQuery or ROLAP mode (depending on what SSAS mode are you using, tabular or multidimensional) you may be interested on
    using columnar indexes on your base tables. 
    Analytical and aggregated queries will take GREAT advantage from these indexes, they will perform much better than with traditional B-Tree indexes in most of your scenarios. 
    Regards. 
    Pau.

  • How can I implement a Digital I/O counter with a maximum source frequency of 80 MHz (like 6602 board) using CompactRIO?

    How can I implement a Digital I/O counter with a maximum source frequency of 80 MHz (like 6602 board) using CompactRIO? It appears as if the Digital I/O modules for CompactRIO are much slower than this.
    Thank you,
    --Ray

    Hi Ray,
    The highest frequency input we offer for C Series modules is 20 MHz if you are doing LVTTL and 10 MHz for 5 V TTL.  These modules are the 9402 and 9401, respectively.  Unfortunately, there is no 80 MHz input on this form-factor.
    Regards,
    Chris E.
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • How can I create cursors within the cursor?

    How can I create cursors within the cursor?
    Table1 2001 - 2007 data
    Account_no
    Account_eff_dt
    No_account_holder
    Num
    Seq_Num
    Value1
    Value2
    Table2_Historical (doesn't have Num as a field) 1990 - 2000 data
    Account_no
    Account_eff_dt
    No_account_holder
    Seq_Num
    Value1
    Value2
    Table3_06
    Account_no
    Account_eff_dt
    No_account_holder
    Num
    My result table should be:
    Table_result_06
    Account_no
    Account_eff_dt
    No_account_holder
    Num
    Value1_min (the minimum value for the minimum of record_sequence)
    Value2_max (the maximum value for the maximum of record_sequence)
    I have to get data from Table1 and Table2_Historical. If one account was open in 1998 and is still effective, the minimum value of that account is in the Table2_Historical.
    Let's say I open a cursor:
    cursor_first is
    select * from table3_06;
    open csr_first
    loop
    fetch cursor_first into
    v_Account_no
    v_Account_eff_dt
    v_No_account_holder
    v_Num
    EXIT WHEN csr_first%NOTFOUND;
    How can I open a second cursor from here that will get the Seq_Num from Table1
    csr_second
    select Seq_Num from Table1 where
    v_Account_no = Account_no
    v_Account_eff_dt <= Account_eff_dt
    v_No_account_holder=No_account_holder
    v_Num = Num
    How does it works???
    Thanks a lot

    Thanks so much for replying back. Here is what I am trying to do.
    I have to create a table for each year 2002, 2003, 2004, 2005, 2006 that has all the account numbers that are active each year plus some other characteristics.
    Let’s say I will create Table_result_06. This table will have the following fields. The account number, account effective date, Number of the account holder and the field Num (The primary key is a combination of all 4 fields), the beginning look of value 1 in 2006, the last look of value 1 in 2006.
    Table_result_06
    Account_no key
    Account_eff_dt key
    No_account_holder key
    Num key
    Value1_min (the minimum value for the minimum of record_sequence)
    Value2_max (the maximum value for the maximum of record_sequence)
    All the active account numbers with the Account_eff_dt, No_account_holder and Num are in the Table3. As such I can build a query that connects Table3 with table Table1 on all 4 fileds, Account_no, Account_eff_dt, No_account_holder, Num and find the Value1_min for the min of req_sequence in 2006 and Value1_max for the max of req_sequence in 2006. Here my problem starts.
    Table 1 doesn’t have a new entry if nothing has changed in the account. So if this account was open in 1993 and nothing has changed I don’t have an entry in 2006 but this doesn’t mean that this account doesn’t exist in 2006. So to find the minimum value I have to go back in 1993 and find the max and min for that year and that will be max and min in 2006 as well.
    As such I have to go to Table_2 historical and search for min and max. But this table doesn’t have the field NUM and if I match only on the Account_no, Account_eff_dt and No_account_holder I don’t get a unique record.
    So how can I connect all three tables, Table 1 for max and min, if it doesn’t find anything will go to table 2 find the two values and populate Table_result_06.
    Thanks so much again for your hep,

  • How can I implement an user function in a derived column of a report ?

    Hello,
    I've a report and added a derived column.
    In this column should be displayed the result of a function.
    GETANZGJMONATE ( to_date(#START_AFA#,'DD.MM.YYYY'), #ND#, :P302_GJ );
    How can I implement this?
    Thanks in advance
    Regards Ulrike

    Ulrike - I would do this in the SQL statement (there may be other ways).
    Presumably START_AFA and ND are table columns?
    Presumably you've also created the GETANZGJMONATE function?
    So, something like this should work (this also assumes that START_AFA is of a DATE type - you'll need the TO_DATE call if not):
    SELECT COL1
    , COL2
    , START_AFA
    , ND
    , GETANZGJMONATE (START_AFA, ND, :P302_GJ)
    from TABLE
    where ...
    Can't remember if you have to grant any particular execute permissions on the function ('grant execute on GETANZGJMONATE to public', for example) when you call it from SQL on a page, but you could try that if the function call fails.
    Depending on what's in :P302_GJ and what the function parameter data type is, you might need to use the '&P302_GJ.' syntax or TO_NUMBER etc.
    Hope this helps.
    Regards,
    John.

  • How can i implement 'Distribute Qty' function in BAPI_GOODSMVT_CREATE

    Hi all,
    Using MIGO For GR. if more than one Batch or Production Date or Vendor Batch for same Purchase Order Line Item and Deliv date, need to hit ‘Distribute Qty’ button to split the entry line into multiple lines before enter Production Date and Vendor Batch.
    So I want use bapi BAPI_GOODSMVT_CREATE  implement MIGO function for a interface. Anyone have some suggestion how can i implement the 'Distribute Qty' function in the bapi.
    My email address: [email protected]

    Hello,
    1. Use structure BAPIPAREX for passing custom fields. (There are several blogs/posts on how to make use of this).
    2. In the BAPI i noticed there is a BAdI to populate these fields into your business tables.
    Call BAdI MB_BAPI_GOODSMVT_CREATE to fill own fields
        TRY.
            get badi lo_mb_bapi_GOODSMVT_CREATE.
          CATCH cx_badi_not_implemented.                    "#EC NO_HANDLER
        ENDTRY.
        TRY.
            call badi lo_mb_bapi_goodsmvt_create->extensionin_to_matdoc
              EXPORTING
                EXTENSION_IN = EXTENSIONIN[]
              CHANGING
                CS_IMKPF     = S_IMKPF
                CT_IMSEG     = T_IMSEG[]
                CT_RETURN    = return.
          CATCH cx_badi_initial_reference.                  "#EC NO_HANDLER
        ENDTRY.

  • How can we implement the currency translation in a query definition

    How can we implement the currency translation in a query definition and should it modified for each and every type of currencies

    hi rama krishna
    i think u can not get any translation in Query. this is only for het the report as it is there in tables. if u want to write a report take a help of the Abaper
    hope u goit,assign points if u ok for this
    thanks
    subbu

  • We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    Anyone any ideas to help please?

  • How can I implement the connection pool in my java stored procedure

    my java stored procedures (in database 'B') have to connect to another oracle database ,let's say 'A'. And how can I implement the behavior like the so-called connection pool in my java stored procedure in 'B', as below.
    1. database B, has 2 java stored procedures sp1 and sp2
    2. both sp1 and sp2 connects to databse 'A'
    whatever I call the sp1 and sp2 and the database 'A' always only one connected session from sp1 and sp2 in database 'B'.
    THANKS A LOTS...

    my problem is I have a lots of java stored procedures need to cnnect to the remote oracle db, and I hope the remote db can only have a connected session from my java stored procedures in my local db. I try as below
    class sp{
    static Connection conn=null; //the remote db connection,
    public static void sp1(){...}//procedure 1, using conn
    public static void sp2(){...}//procedure 2, using conn,too
    I can 'see' the 'conn' variable if I invoke the sp1() and sp2() from the same client application(maybe sqlplus). But if I invoke the sp1() from client 'A' and invoke sp2() from client 'B' then the sp1() and sp2() can not see the 'conn' variable for each other. I think it's because the two clients cause oracle to create two instances of the class 'sp' and the sp1() and sp2() located in different instance seperately. Thus the sp1() and sp2() can not see 'conn' for each other. They can only see its own 'conn'.
    To connect to the remote db from the java stored procedure is easy but is it possible to connect to the remote db via database link from the java stored procedure at my local db ? If so, then I also archive my goal .
    BTW , thanks a lots...
    andrew :-)

  • How can we implement product key feature while installing AIR application?

    How can we implement product key feature while installing AIR application?

    Hello,
    Could you try using /Q or /QS parameter?
    http://msdn.microsoft.com/en-us/library/ms144259(v=sql.110).aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How can I implement IMAQ correlation for 16bit image?

    Hi
    When using IMAQ correlate. vi in Machine vision Filter catergory, the vi only works for 8 bit source and template image case.
    16 bit source image case makes error.
    But I need 16 bit source image without losing image information, I want to use full 16 bit image correlation with 8 bit template.
    How can I implement the code in labview?
    Need help.
    Many thanks.

    Unfortunately you can't do so.
    There are some functions in the Vision Lib that only accept 8bit images. In order to use them you have to convert your image to an 8bit Image.
    Keep in mind that converting an Image to 8bit will not necessary result in a loss of data. Check your Images, it might be that you are not using the full range of a 16bit value. you might be able to use a mixture of dynamic shifting and bit shifting in order to convert an image to an 8 bit, then embedding these criterias in the image and use them to convert back to a 16bit at a later time without losing any data, or in most cases minimal precision loss. 
    If you would like to attach one of the images you are using, I can take a look at it to see if this is possible in your case.
    Good luck,
    Dan,
    www.movimed.com - Custom Imaging Solutions

  • How can I implement Authentication in LDAP

    How can I implement Authentication in LDAP.

    Hi,
    If ur using JAAS, then use NTLoginModule in ur conf file and your own defined CallbackHandler for validating and obtaining the Subject (user connected to your domain).
    Remember the user is the one which the code obtains when u login to your Domain based machine.
    Apart from this, Apache Http Server also provides you with a popup window asking for the user's credentials when u set the SSPIDomain in the httpd.conf file.
    httpd.conf
    ========
    <Location /Seet/servlet/ >
    SSPIAuth On
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "seet190 auth"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On
    require valid-user
    SSPIDomain seet190
    </Location>
    seet190 is the domain name
    Actually so far in the Security Forum, u might refer to some of the replies posted for more help but actual LDAP authentication can be done by passing the user's info too.
    HTH,
    Seetesh

  • How can I implement this database?

    Okay, so if you are working with a company who owns more than 10 apartment complexes and they have asked you to build a database.
    So if I want to implement this database.
    What database software package should I use (SQL Enterprise or SQL Data Center) (do not know the difference between the two) or is there any other SQL version that can be used/considered
    Also what else would I have to build or buy? What combination of things do I need?
    What hardware is needed at each apartment complex?
    I was told that something off the shelf will not give me everything I need.

    Please do not duplicate posts. You already posted it here
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5dfc3897-3ffb-490b-8e60-e775b43d3303/how-can-i-implement-this-database?forum=sqlgetstarted
    Andy Tauber
    Data Architect
    The Vancouver Clinic
    Website | LinkedIn
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

Maybe you are looking for

  • Java.lang.NullPointerException in end user change password page

    Hi All I need to notify a user whenever he changes his password. when i log in to the user page and change password i get java.lang.NullPointerException. Any ideas??? Help is appreciated. Thanks

  • Error while integrating 2 portals

    We are trying to set up an FPN between our EP (EP 7.0) and BI (BI 7.0) systems. We have enabled trust between the 2 systems and done all the required steps. However when we create an Iview in EP which calls a query from the BI system it asks for a us

  • Workflow report required

    Dear I have one problem in ESS.Actually my client wants a report related to the leaves applied through ESS. In that report  they want the leave request date, start date and end date of the leaves applied and the type of the leave, with the employee n

  • How come every time I send a text it says Message failure

    It just started happening a couple of days ago, every time I send a text message to people it says "message failed to deliver" and I have to resend the text. What does this mean its driving me nuts !! H E L P !!

  • How to Change iWeb page themes after the page has already created?

    Once you have created a page with a theme and saved it, and then later you want to change it to another theme... How does one change theme without recreating the page? Also, How does one add background music to a page once it is opened? Thanks! T.