Get Data Moving 1
Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Hein

Thread: How to use Mutiple table in source_lookup

  1. #1
    srinath is offline Junior Member
    Join Date
    Oct 2017
    Posts
    9
    Rep Power
    0

    How to use Mutiple table in source_lookup

    How can i add mutiple table name in source_lookup in TBL argument ?
    source_lookup(TTL,SCHM,TBL,EXP,COND,COND_PARAMS)

  2. #2
    Hein is offline Senior Member
    Join Date
    Dec 2007
    Location
    Nashua, NH - USA.
    Posts
    152
    Rep Power
    12
    Quote Originally Posted by srinath View Post
    How can i add mutiple table name in source_lookup in TBL argument ?
    source_lookup(TTL,SCHM,TBL,EXP,COND,COND_PARAMS)
    You probably should look at adding adding a VIEW on the source to keep the lookup simple, easier to test, and probably more maintainable.
    Then do the simple, singleton, selects from the view, in Replicate.

    I have done 'multiple table' ( join ! ) selects directly through a nasty/sneaky/clever SQL injection 'trick'/hack.

    Consider this:

    Code:
    source_lookup(2, 'dummy_schema', 'dummy_table', 'real_column_b FROM table_a A, table_b B WHERE A.some_column=? AND A.some_key = B.some_key --', 'dummy_condition', $real_parameter)
    See that '--' ? That's a comment introducer which is going to make rest of the Replicate provided SQL text be ignored. The complete, real , query is already provided.

    Example -
    Code:
    source_lookup(2,'x','y','DECUI4 from WOPHDRS0 H, CIPNAME0 N WHERE H.WONO=? AND N.CUNO = H.CUNO --', 'z',$WONO)
    Resulting SQL statement:

    Code:
    [SOURCE_CAPTURE ]V: Data lookup statement,  SELECT DECUI4 from WOPHDRS0 H, CIPNAME0 N WHERE H.WONO=? AND N.CUNO = H.CUNO

    Enjoy,
    Hein.
    srinath likes this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •