Actually, I tried SQL::Parser. It really gets lost and gives me undef values for all parameters ( my guess is because it has nested queries )... Any other suggestion:S?

$VAR1 = { 'table_names' => [ 'table1' ], 'values' => [ [ { 'value' => 'SEQ_TABLE1', 'type' => 'string', 'fullorg' => 'SEQ_TABLE1' } ] ], 'column_aliases' => {}, 'org_col_names' => [ 'PARAM1', 'PARAM2', 'PARAM3', 'PARAM4', 'PARAM5', 'PARAM6', 'PARAM7' ], 'column_defs' => [ { 'fullorg' => 'PARAM1', 'type' => 'column', 'value' => 'param1' }, { 'fullorg' => 'PARAM2', 'type' => 'column', 'value' => 'param2' }, { 'fullorg' => 'PARAM3', 'type' => 'column', 'value' => 'param3' }, { 'type' => 'column', 'fullorg' => 'PARAM4', 'value' => 'param4' }, { 'value' => 'param5', 'fullorg' => 'PARAM5', 'type' => 'column' }, { 'type' => 'column', 'fullorg' => 'PARAM6', 'value' => 'param6' }, { 'value' => 'param7', 'type' => 'column', 'fullorg' => 'PARAM7' } ], 'dialect' => 'ANSI', 'org_table_names' => [ 'TABLE1' ], 'command' => 'INSERT', 'original_string' => 'INSERT INTO TABLE1 ( PARAM1, PARAM2, + PARAM3, PARAM4 , PARAM5, PARAM6 ,PARAM7)values (SELECT nextval(\'SEQ_TABLE1\') , 9613000001 , 1 , , PARAM8 , 1234 + , localtimestamp FROM TABLE2 , TABLE3 WHERE TABLE2.PARAM8= TABLE3.PARAM2 AND SETTING = 1)', 'ORG_NAME' => { 'param5' => undef, 'param3' => undef, 'param2' => undef, 'param7' => undef, 'param1' => undef, 'param6' => undef, 'param4' => undef }, 'join' => {} };

In reply to Re^2: Parse complex SQL statement by perl_help26
in thread Parse complex SQL statement by perl_help26

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.