+ Reply to Thread
Results 1 to 2 of 2

Thread: Functional in Where-Clause

  1. #1
    Junior Member
    Join Date
    Jan 2012

    Functional in Where-Clause

    I've got an association table that groups accounts together. and i'm trying to select a subset of table 'target'.
    Is it possible to write a function that returns a list of account_ids (as some form of collection) that would facilitate the above code?
    Here is what i wrote :
    p_group_id := 3;
    select *
    target t
    where  t.account_id in get_account_ids(p_group_id);

  2. #2
    Simply Write that :
    select * from   target t
    where  t.account_id in 
           ( select aa.account_id
             from   assoc_account aa
             where  aa.groupid = 7;
    But take care the above query will work if assoc_account.account_id is not Null

+ Reply to Thread

Tags for this Thread


Posting Permissions

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