Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    India
    Posts
    114

    Unanswered: Help in query needed

    Hello

    This is my using_clause field in my table.

    select USING_CLAUSE from ocean.tms_statement_definition where
    USING_CLAUSE is not null;

    USING_CLAUSE
    --------------------------------------------------------------------------- USING v_Prg_Nm, v_Partner_Cd, v_Batch_No,v_Agy_Cd
    USING v_Prg_Nm, v_Partner_Cd, v_Batch_No
    USING v_Prg_Nm, v_Partner_Cd,v_Prg_Nm,v_Prg_Nm, v_Partner_Cd,v_Prg_Nm

    I want to count how many variables are defined in using clause. For eg for the firstrecord it should return 4 , for second 3 and for third 6.

    Plz help!!!!!!!!!!!

  2. #2
    Join Date
    Mar 2004
    Location
    Warsaw / Poland
    Posts
    73
    Assuming that #commas + 1 = #vars you could code something like
    Code:
    SELECT length(USING_CLAUSE ) - length(replace(USING_CLAUSE, ',', '')) + 1 AS no_vars
      FROM ocean.tms_statement_definition 
      WHERE USING_CLAUSE is not null;

Posting Permissions

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