Help to make this dynamic sql work

Hi,
I have many DDLs to execute and these DDLs change over time, so I try to load these DDLs into a table (y) and write a proc to loop through them. But I run into some problems and need your help.
Here are the details:
create table y ( x varchar2(4000));
CREATE TABLE error_log (
error_log_ID NUMBER(20),
statement VARCHAR2(2000),
error_msg VARCHAR2(400),
Action VARCHAR2(16)
CREATE SEQUENCE SEQ_error_log
START WITH 1
INCREMENT BY 1
NOMINVALUE
NOMAXVALUE
NOCYCLE
CACHE 20
NOORDER
CREATE OR REPLACE PROCEDURE CUST_UPDATE1 (
schema_name IN VARCHAR2 ,
table_tablespcae_name IN VARCHAR2,
index_tablespcae_name IN VARCHAR2
) AS
v_code NUMBER;
v_errm VARCHAR2(400);
sql_stmt1 VARCHAR2(3000) ;
CURSOR c1 IS SELECT x FROM y;
BEGIN
FOR i IN c1 LOOP
sql_stmt1 := i.x;
DBMS_OUTPUT.PUT_LINE ( 'x = '|| sql_stmt1 );
/ **************************** worked if use this hard coded ********************************
sql_stmt1 := 'CREATE TABLE '||schema_name||'.zz
aa VARCHAR2(4) NOT NULL,
bb VARCHAR2(100) NOT NULL,
cc VARCHAR2(2) NOT NULL
TABLESPACE '|| table_tablespcae_name;
BEGIN
EXECUTE IMMEDIATE sql_stmt1;
EXCEPTION
WHEN OTHERS THEN
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1 , 400);
INSERT INTO error_log VALUES ( SEQ_error_log.nextval, sql_stmt1, v_errm, DECODE(v_code, -1430, 'IGNORE', 'CHECK') );
END;
END LOOP;
END;
Test:
exec cust_update1('SCOTT', 'USERS', 'c'); -- didn't use last parameter
Senario 1. insert into y values (
'CREATE TABLE schema_name.zz
aa VARCHAR2(4) NOT NULL,
bb VARCHAR2(100) NOT NULL,
cc VARCHAR2(2) NOT NULL
TABLESPACE table_tablespcae_name ' );
===> error_log show: ORA-01918: user 'SCHEMA_NAME' does not exist
Senario 2. insert into y values (
'''CREATE TABLE ''||schema_name||''.zz
aa VARCHAR2(4) NOT NULL,
bb VARCHAR2(100) NOT NULL,
cc VARCHAR2(2) NOT NULL
TABLESPACE ''|| table_tablespcae_name' );
==> error_log show: ORA-00900: invalid SQL statement
3. I hard coded the exact dynamic from step 2 and assigned to sql_stmt1, ( as commeted out in my code) it WORKED.
Thanks
George

hi,
do the scenario1 but you have to substitute the schema_name and table_space name with your actual string before calling the dynamic sql.
ei.
sql_stmt1 := replace(sql_stmt1,'schema_name',schema_name);
sql_stmt1 := replace(sql_stmt1,'table_tablespcae_name',table_tablespcae_name);
BEGIN
EXECUTE IMMEDIATE sql_stmt1;
EXCEPTION
WHEN OTHERS THEN
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1 , 400);
INSERT INTO error_log VALUES ( SEQ_error_log.nextval, sql_stmt1, v_errm, DECODE(v_code, -1430, 'IGNORE', 'CHECK') );
END;
Cheers,
J

Similar Messages

  • Could you please help me make this query less complicated

    could you please help me make this query less complicated
    select t1.R_OBJECT_ID
    from dm_relation_sp a, ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID
    union all
    select t3.R_OBJECT_ID
    from ddt_resolution_sp t3
    where t3.R_OBJECT_ID in (select t2.child_id
    from dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    union all
    select t4.R_OBJECT_ID
    from ddt_resolution_sp t4
    where t4.R_OBJECT_ID in(
    select t3.child_id from dm_relation_sp t3
    where t3.parent_id in (
    select t2.child_id
    from asud_fsk.dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    and t3.relation_name = 'RESOLUTION_RELATION')
    union all
    select t5.R_OBJECT_ID
    from ddt_resolution_sp t5
    where t5.R_OBJECT_ID in
    (select t4.child_id
    from dm_relation_sp t4
    where t4.parent_id in(
    select t3.child_id from dm_relation_sp t3
    where t3.parent_id in (
    select t2.child_id
    from asud_fsk.dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    and t3.relation_name = 'RESOLUTION_RELATION')
    and t4.relation_name = 'RESOLUTION_RELATION')
    Edited by: user13025450 on 29.04.2010 16:23

    Hi,
    Welcome to the forum! You'll find that there are many qualified people (such as Tubby) willing to help you. Will you do what you can to help them? In order to simplify the query you posted,someone will first have to understand what it does, what the tables that it uses are like, and what tools you have to work with (that is, what version of Oracle, and any other software you are using). To actually test their ideas, people will need versions of your tables.
    Many people, if they spent enough time, might be able to figure out roughly what you are doing, make some tables themselves and test a solution. You can help with all of that. I assume you already know what the appliction is, and what this particular query is supposed to do: you don't have to figure out any of that, you just have to say it. You know what all your tables are, what the datatypes of all the columns are, and what kinds of data are in the tables: you don't have to guess at any of that.
    Describe what you're doing. Think about it: how do we know that
    SELECT  NULL
    FROM    dual;doesn't do what you want?
    Post CREATE TABLE and INSERT statements for a little sample data.
    Post the results that this query is supposed to produce from those results. (Is it producing the right output now? Then it should be easy to post the correct results.)
    Describe, as well as you can, how the present query is doing it.
    Format your existing code, so it's easy to see what the different branches of the UNION are, and what the main clauses are in each one.
    When posting formatted text (code or results) type these 6 characters
    \(all small letters, inside curly brackets) before and after each formatted section, to keep this site from compressing the spaces.
    Say what versions of Oracle (e.g. 10.2.0.3.0) and any other relevant software you are using.
    I know it's a lot of work, but it really helps. You can do it as well (probably better) than anyone else, and if you're unwilling to do it, why should anyone else be willing?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    Goto > Settings > Safari... Enable Cookies > Always
    Good luck!

  • So, I've taken my panasonic printer back to the shop and exchenged it for a Canon MF-4430. Alas... the generic drivers do not make it print. Is it possible to get drivers to make this canon printer work with my lovely Mac Book Pro Snow Leopard, 6.8?

    So, I've taken my panasonic printer back to the shop and exchenged it for a Canon MF-4430. Alas... the generic drivers do not make it print. Is it possible to get drivers to make this canon printer work with my lovely Mac Book Pro Snow Leopard, 6.8?

    I could not find a MF-4430 at the Canon site. Are you sure the model is correct? They have a MF4450. The Mac drivers are here:
    http://www.usa.canon.com/cusa/support/consumer/printers_multifunction/imageclass _series/imageclass_mf4450#DriversAndSoftware
    If you are sure you have a MF4430, look around the canon site for the drivers.

  • Please help me make this work-through easier!

    just started a project and figure motion would be best suited to acheive what i'm attempting:
    take a time-lapse shot of a beautiful background with three picture frames in the foreground
    take 100-200 scanned pictures and over the course of 3-4 mins slowly fade each pic in/out of each picture frame
    it's my idea for showcasing a "slide show" type of project.
    i can get the gist of how to make this happen, but it seems there should be a faster way. for example, is there any way to copy and paste the attributes of an object, for example, the position, and "four corner" properties? this way i could simply bring in a pic, copy, and paste, play with fading, and move on

    pre-produce your 3 movies by creating  movies, made of your stills incl. dissolves
    add movie 'into' frame, crop, rotate, distort to make it fitting in
    repeat for 2 other movies
    done
    no need for M5, could be accomplished in FCPX alone ....

  • Solve this Dynamic sql problem

    hi i am sending the table and the contents in the table and what i want from the table.
    SQL> descr sswms_rule_components;
    Name Null? Type
    RULE_COMPONENT_ID NOT NULL NUMBER
    RULE_COMPONENT_CODE NOT NULL VARCHAR2(30)
    RULE_COMPONENT_NAME NOT NULL VARCHAR2(100)
    ENABLED_FLAG NOT NULL VARCHAR2(1)
    DB_TABLE VARCHAR2 (100)
    DB_COLUMN VARCHAR2 (100)
    DB_FUNCTION VARCHAR2(100)
    WHERE_CLAUSE VARCHAR2 (2000)
    FROM_CLAUSE VARCHAR2 (2000)
    The table contains the following data
    db_table
    sswms_shipment_lines
    wsh_carrier_ship_method --- the data inside the db_table column is a table
    db_column
    Ship to
    Carrier_id
    Where_clause
    Oe_order_headers_all.header_id = sswms_shipment_lines.order_header_id
    From_clause
    Oe_order_headers_all, sswms_shipment_lines -- the data inside the From_clause is a table
    Now my requirement is to build a dynamic sql in forms 6i.when I click the build sql it should update the sql
    So --- I have to write a procedure --
    Select db_table || . || db_column || ‘’ || group_key
    ---group_key is an alias
    From db_table, From_clause
    --- Here the logic should be
    1. I should remove the commas from the “FROM_CLAUSE” column and check for duplicate values
    2. i should check for duplicate values for the “DB_TABLE “ column
    3. I should compare both the FROM_CLAUSE and DB_TABLE column for DUPLICATE VALUES
    4. After doing this I should add the result to the “FROM” in the select statement
    5.The table name should not be repeated from the "FROM"
    I am expecting the code and a positive reply from you.

    I'm waiting for the code the last 10 minutes and none arrived. What's happening? Developers, do my work, please! (ironic sentence)

  • Help With SUBSTR in dynamic SQL statement

    Following is the dynamic SQL statement.
    EXECUTE IMMEDIATE 'UPDATE table_name pml
    SET pml.'|| con_fields.field ||' = SUBSTR(pml.'||con_fields.field||' ||'' ''||
    (SELECT pml1.'||con_fields.field||'
    FROM table_name pml1
    WHERE pml1.grp_id = '||los_concats.grp_id ||'
    AND pml1.row_id = '||los_concats.row_id||'
    AND pml1.loser_flg = ''Y''),1, '||con_fields.max_length||')
    WHERE pml.grp_id = '||los_concats.grp_id ||'
    AND pml.loser_flg IS NULL ';
    what it does is that it updates a particular field. This field is concatenated by a field of a similar record.
    My problem is with SUBSTR function. Since I am concatenating fields I do not want the field to be updated greater than max_length on that field, the reason why I use SUBSTR. the select query inside SUBSTR works alright with one of the AND condition in a WHERE clause not present. When I add that additional condition it gives me this error.
    ORA-00907: missing right parenthesis.
    Is there any way to get around this problem. Does SQL has other than SUBSTR function which can limit the character length.
    Appreciate it.

    The other alternative I thought about was to do this first
    EXECUTE IMMEDIATE 'SELECT pml.'||con_fields.field||'
    FROM table_name pml
    WHERE pml.grp_id = '||los_concats.grp_id||'
    AND pml.row_id = '||los_concats.row_id||'
    AND pml.loser_flg = ''Y''
    ' INTO v_concat_field;
    write into the variable v_concat_field and then use it into the previous script.
    But on this I get SQL Command not properly terminated, I don't get it Why?
    Donald I tried with your suggested script. It works fine with one of the conditions eliminated. I don't understand what the error trying to say?
    Thanks

  • Help on Execute Immediate Dynamic Sql

    Hi all
    when i run the following Pl/SQL,nothing is happening
    I want to pass array to following procedure
    DECLARE
    SQL_STMT      VARCHAR2(1000);
    BEGIN
    SQL_STMT  := 'Select '|| '''populate_table_test(''' || '|| chr(39)||id_name||chr(39)||' ||''','''||'|| chr(39)||attribute1||chr(39)||' ||''','''||'|| chr(39)||attribute2||chr(39)||' ||''');'''||' from table_test1';
    dbms_output.put_line(sql_stmt);
    execute immediate sql_stmt;
    Exception when others then
    dbms_output.put_line(sqlerrm);
    end;
    SQL> ed
    Wrote file afiedt.buf
      1  Select 'populate_table_test('|| chr(39)||id_name||chr(39)||','||
      2  chr(39)||attribute1||chr(39)||','|| chr(39)||attribute2||chr(39)||');' from
      3* table_test
    SQL> /
    'POPULATE_TABLE_TEST('||CHR(39)||ID_NAME||CHR(39)||','||CHR(
    populate_table_test('AAA','AA','AA');
    populate_table_test('AAA','AA','AA');
    CREATE
      TABLE TABLE_TEST1
        "ID_NO"      NUMBER(10,0)     ,
        "ID_NAME"    VARCHAR2(10 BYTE),
        "ATTRIBUTE1" VARCHAR2(10 BYTE),
        "ATTRIBUTE2" VARCHAR2(10 BYTE)
    Insert into TABLE_TEST1 (ID_NO,ID_NAME,ATTRIBUTE1,ATTRIBUTE2) values (null,'AAA','AA','AA');
    Insert into TABLE_TEST1 (ID_NO,ID_NAME,ATTRIBUTE1,ATTRIBUTE2) values (null,'AAA','AA','AA');
    commit;
    CREATE TABLE TABLE_TEST
    (ID_NO NUMBER(10) ,
    id_NAME VARCHAR2(10) ,
    ATTRIBUTE1 VARCHAR2(10),
    ATTRIBUTE2 VARCHAR2(10)
    select * from "TABLE_TEST";
    CREATE OR REPLACE TYPE T_TYPE IS OBJECT (
    id_NAME VARCHAR2(10),
    ATTRIBUTE1 VARCHAR2(10),
    ATTRIBUTE2 VARCHAR2(10)
    Create or replace  type TB_T_TYPE as varray(200) of  T_TYPE ;
    CREATE OR REPLACE
    PROCEDURE POPULATE_TABLE_TEST (EXAMPLE IN TB_T_TYPE) AS
    begin
    FOR I IN 1..EXAMPLE.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ID_NAME);
    DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE1);
    DBMS_OUtPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE2);
    insert into TABLE_TEST(id_name,attribute1,attribute2)
    values (treat(example(i) as T_TYPE).id_NAME,
    treat(example(i) as T_TYPE).ATTRIBUTE1,
    treat(example(i) as T_TYPE).ATTRIBUTE2
    end loop;
    end; Select 'populate_table_test('|| chr(39)||id_name||chr(39)||','||
    chr(39)||attribute1||chr(39)||','|| chr(39)||attribute2||chr(39)||');' from
    table_test
    Edited by: user1849 on Nov 30, 2011 12:40 PM
    Edited by: user1849 on Nov 30, 2011 1:18 PM

    user1849 wrote:
    Hi all
    when i run the following Pl/SQL,nothing is happeningRemember to issue the SQL*Plus command
    SET  SERVEROUTPUT  ONbefore running it; otherwise, you won't see the output from dbms_output.
    >
    I want to pass array to following procedureIs this a procedure or an anonymous PL/SQL block?
    If it's a procedure, post the entire procedure, starting with CREATE [OR REPLACE] PROCEDURE...
    Never write, let alone post, unformatted code. Indent the code to show the scope of BEGIN, LOOP, etc.
    DECLARE
    SQL_STMT      VARCHAR2(1000);
    BEGIN
    SQL_STMT  := 'Select '|| '''populate_table_test(''' || '|| chr(39)||id_name||chr(39)||' ||''','''||'|| chr(39)||attribute1||chr(39)||' ||''','''||'|| chr(39)||attribute2||chr(39)||' ||''');'''||' from table_test1';
    dbms_output.put_line(sql_stmt);
    execute immediate sql_stmt;
    Exception when others then
    dbms_output.put_line(sqlerrm);
    end;
    /Only use an EXCEPTION handler when you can improve on the default error handling. The default is to print an error message, so there's no point in you explicitly doing the same.
    Why do you need dynamic SQL? Post the output results you want to get from the sample data you posted.
    Given that you do need dynamic SQL, why can't you use bind variables, rather than including the values as literals?
    Given that you have to use literals, use Q-notation for strings that include single-quote characters.
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements003.htm#sthref337
    For example:
    ...     SQL_STMT  := Q{'Select  populate_table_test ('}'
              || id_name
              || Q'{','}'
              || attribute1
              || Q'{','}'
    SQL> ed
    Wrote file afiedt.buf
    1  Select 'populate_table_test('|| chr(39)||id_name||chr(39)||','||
    2  chr(39)||attribute1||chr(39)||','|| chr(39)||attribute2||chr(39)||');' from
    3* table_test
    SQL> /
    'POPULATE_TABLE_TEST('||CHR(39)||ID_NAME||CHR(39)||','||CHR(
    populate_table_test('AAA','AA','AA');
    populate_table_test('AAA','AA','AA');
    CREATE
    TABLE TABLE_TEST1
    "ID_NO"      NUMBER(10,0)     ,
    "ID_NAME"    VARCHAR2(10 BYTE),
    "ATTRIBUTE1" VARCHAR2(10 BYTE),
    "ATTRIBUTE2" VARCHAR2(10 BYTE)
    Insert into TABLE_TEST1 (ID_NO,ID_NAME,ATTRIBUTE1,ATTRIBUTE2) values (null,'AAA','AA','AA');
    Insert into TABLE_TEST1 (ID_NO,ID_NAME,ATTRIBUTE1,ATTRIBUTE2) values (null,'AAA','AA','AA');
    commit;
    Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.
    Is that the best sample data for testing? Wouldn't it be better to have at least one row that was not the same as all the others?
    CREATE TABLE TABLE_TEST
    (ID_NO NUMBER(10) ,
    id_NAME VARCHAR2(10) ,
    ATTRIBUTE1 VARCHAR2(10),
    ATTRIBUTE2 VARCHAR2(10)
    select * from "TABLE_TEST";
    CREATE OR REPLACE TYPE T_TYPE IS OBJECT (
    id_NAME VARCHAR2(10),
    ATTRIBUTE1 VARCHAR2(10),
    ATTRIBUTE2 VARCHAR2(10)
    Create or replace  type TB_T_TYPE as varray(200) of  T_TYPE ;
    CREATE OR REPLACE
    PROCEDURE POPULATE_TABLE_TEST (EXAMPLE IN TB_T_TYPE) AS
    begin
    FOR I IN 1..EXAMPLE.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ID_NAME);
    DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE1);
    DBMS_OUtPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE2);
    insert into TABLE_TEST(id_name,attribute1,attribute2)
    values (l_t_seq(i),
    treat(example(i) as T_TYPE).id_NAME,
    treat(example(i) as T_TYPE).ATTRIBUTE1,
    treat(example(i) as T_TYPE).ATTRIBUTE2
    end loop;
    end; You're trying to INSERT 4 values into 3 columns. Did you mean to say "insert into TABLE_TEST( *id_no,* id_name,attribute1,attribute2)"?
    What is l_t_seq? Post complete test scripts that people can run to re-create the problem and test their ideas.

  • I just bought the book Christine, by Stephen King. I didn't realize that it's in German, which of course I don't know. I don't want my money back, just an English copy. Can anyone help me make this happen?

    I just bought the book Christine, by Stephen King. I didn't realize that it was in German. I don't want money back, only an English copy. Can anyone help me with this?

    Is the English-language version available in your country's store and if so is it the same price ? You will need to try contacting iTunes Support, either via the 'report a problem' link from your purchase history : log into your account on your computer's iTunes via the Store > View My Account (Store > View My Apple ID on iTunes 11) drop-down menu option and you should then see a Purchase History section with a 'see all' link to the right of it ; click on that and you should see a list of your purchases ; find that book, click the arrow to the left of it, click the 'Report a Problem' button :
    and then the 'Report a Problem' link on its line :
    and fill in the details (iTunes support should reply within, I think, about 24 hours).
    Or if the 'report a problem' link doesn't work (it's been taking some people to this site on a browser instead of showing a form in iTunes) then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • I need help to make this menu?

    This is normal menu, but i have only use Flash for any times,
    i don't know how to make this menu with Action Script in Flash.
    http://i238.photobucket.com/albums/ff189/viczon/Take.jpg
    Please help me! My menu with 2 level, the first cross-bar above
    include Home, Introduce, Products,... and if rovoller on it,
    example as if i rovoller on Product button, will have appear
    products's name below. Thank for help, this menu is more important
    for me to do now, if can please do in Flash and send .fla file for
    me! Thank you..

    Please Help me! I Need it now. Please..

  • Help in solving this pl/sql block

    Hi
    Could some one help me in solving my problem
    i want some data to be extracted by a sql its not fetching it so i prefered to write a pl/sql block for it ...
    the block is as follows
    begin
    cursor opunit is
    select code from fmg_operating_units;
    cursor pak_code is --- those are the 3 codes which i require
    select 'BNL' from dual
    union select 'HNA' from dual
    union select 'HNL' from dual;
    cursor data1(opunit,pak_code) is
    select mas.name ,
    cl.id ,
    opup.oun_code ,
    fmg_phone_no(mas.id),
    clpk.pak_code ,
    clpk.id
    from fmg_op_unit_positions opup,
    fmg_clients cl,
    fmg_client_paks clpk,
    fmg_masters mas,
    fmg_policies po,
    fmg_policy_items pi
    where mas.id=cl.mas_id
    and cl.id=clpk.cli_id
    and clpk.oup_id=opup.id
    and opup.oun_code = opunit
    and clpk.id=po.ctp_id
    and po.id=pi.pol_id
    and pi.current_status='AC'
    and clpk.pak_code = pak_code;
    loop opunits
    loop pak_code
    open data1
    fetch data1(opunit,pak_code) ;
    end loop;
    end loop;
    could some one help me in extracting the data and put it on the CSV file ...
    i would be very thank full to you if some one take some time to full fill this task..
    thanks in advance

    Declare
         cursor opunit is
              select distinct code
              from fmg_operating_units;
         cursor pak_code is --- those are the 3 codes which i require
              select 'BNL' codes from dual
              union
              select 'HNA' codes from dual
              union
              select 'HNL' codes from dual;
         cursor data1(opunit,pak_code) is
              select mas.name ,
                   cl.id ,
                   opup.oun_code ,
                   fmg_phone_no(mas.id),
                   clpk.pak_code ,
                   clpk.id
              from fmg_op_unit_positions opup,
              fmg_clients cl,
                   fmg_client_paks clpk,
                   fmg_masters mas,
                   fmg_policies po,
                   fmg_policy_items pi
              where mas.id     =     cl.mas_id
              and cl.id     =     clpk.cli_id
              and clpk.oup_id =     opup.id
              and opup.oun_code =      opunit
              and clpk.id     =     po.ctp_id
              and po.id     =     pi.pol_id
              and pi.current_status=     'AC'
              and clpk.pak_code =      pak_code;
    begin
         FOR opunits IN opunit LOOP
              FOR pak_codes IN pak_code LOOP
                   OPEN data1;     
                        fetch data1(opunits.code,pak_codes.codes) ;
                        EXIT WHEN data1%NOTFOUND;
                        < Rest of your code here > -- You can insert processed data into a temp table &
                                       -- extract data from that table afterwards via select statement
                                       -- & saving the data in a .cvs file extension.
                   CLOSE data1;
              END LOOP;
         END LOOP;
         <Some more code here if applicable>
    EXCEPTION
         <Exception handling code section here>
    END;

  • Can someone please help me make this Navigation bar in Javascript please

    Hi I love this Navigation bar :   http://en.wordpress.com  I have struggled trying to find tutorials or anything just to try and make it, If someone could make it, I would LOVE IT! I am finding it way to hard just to find help. So please could someone kindly help me out.   Thank you so much!

    What exactly is it you like about that element? It's not really a navigation element, it's just a single link in a <header> tag -
    <header class="wpcom-header" role="banner">
                        <div>
                                  <h1 class="wpcom-title"><a href="//en.wordpress.com/">WordPress.com</a></h1>
                                  <nav id="wpcom-navigation" class="main-navigation" role="navigation">
                                            <h3 class="menu-toggle">Menu</h3>
                                            <div class="menu-main-container">
                                                      <ul id="menu-main" class="nav-menu">
                                                                <li id="nav-signin"><a class="nav-highlight" href="#home-signin">Sign In</a></li>
                                                      </ul>
                                            </div>
                                  </nav>
                        </div>
              </header>
    It's styled with CSS to look the way it does.

  • Needs help to make the inquery form works

    Hello there,
    I have created an inquery form to collect data, but I have
    problem getting the data to my email account. (I used php)
    Can someone shows me how or debug my file? Your help will be
    greatly appreciated. I am more willing to send you my file.
    http://www.laubertecreatives.com
    Thanks in advance,
    matt

    >
    > Sorry that I have confused you with the processing php
    file, I am very new to
    > php. Anyhow, what I want to process is to send all the
    data collected to my
    > email address, and at the same time, to display a Thank
    You page.
    Okay- after asking twice i'm going to assume that there isn't
    any php
    scripting to process the form? And you asking how to process
    the form with
    php, instead of asking why your php isn't working?
    Second assumption:
    the contactus_action.php is the contactus.htm page saved
    with a .php file
    extension and it doesn't have any php code in it?
    {this is what i've been trying to narrow down onto}
    Here's a couple of quick options-
    Go to
    http://www.kaosweaver.com
    -->Extensions-->KaosMail
    Install it. Open the form page. follow the instructions. It
    will write the
    scripting for you.
    http://www.boaddrink.com
    -->phpformmail
    It's a generic reusable script that can give more options
    For more indepth info:
    http://apptools.com/rants/mailto.php

  • Plz help to make this query......very urgent

    I ve two tables <br>
    <br>
    First one is <b>grn_dtl</b> containing following fields     <br> <br> <br>
    <u><b>
    item_code        ent_dt       qty    doc_no </u></b><br>
    11001318        09/09/2003   5    56300501 <br>
    11001318        11/09/2004        9    56300502 <br>
    11001318        12/05/2005       2    56300503 <br>
    11001319        22/06/2004        0    56300504 <br>
    11001320        09/06/2005        0    56300505 <br>
    11001320        11/08/2004        8    56300506 <br>
    11001320        30/05/2005       4    56300507 <br>
    11001320        21/06/2003       1    56300508 <br>
    11001321        25/09/2004       1    56300509 <br>
    11001321        15/07/2004       1    56300510 <br>
    11001321        01/08/2004       2    56300511 <br>
    11001322        02/06/2004       1    56300512 <br>
    11001322        22/06/2004        2    56300513 <br>
    11001323        12/09/2004        1    56300514 <br>
    11001323        08/05/2004        4    56300515 <br>
    11001323        17/08/2004        5    56300516 <br>
    11001323        28/06/2004        2    56300517 <br>
    <br><br>
    second one is <b>item_mst</B> containing following fields     <br>
    <br>
    <u><b>          
    item_code         description         leadtim   kanbandate</u></b><br>
    11001318           aaaaaaaaaaa            15             22/04/2004<br>
    11001319           aaaaaaaaaaa           15             02/12/2004<br>
    11001320           aaaaaaaaaaa           15             14/07/2005<br>
    11001321           aaaaaaaaaaa           15              23/02/2004<br>
    11001322           aaaaaaaaaaa           15             05/10/2004<br>
    11001323           aaaaaaaaaaa           15             17/05/2004<br>
    11001324           aaaaaaaaaaa           15             27/12/2004<br>
    11001325           aaaaaaaaaaa           15             07/08/2004<br>
    <br><br><br><b>
    From the above two tables I want the combine SQL query which will display item_code its description ,kanbandate from item_mst table and will also display the minimum ent_dt of each corresponding item_code alongwith the qty and doc_no.the item_code should not be repeated .<br>
    I want to run the query from sql query analyzer</b><br><br>
    the result should be like this<br><br>
    <b></u>item_code  desc              ent_dt      qty    doc_no</b></u>
    <br>
    11001318       aaaaaaaaaaa        09/09/2003        5        56300501<br>
    11001319       aaaaaaaaaaa        22/06/2004       0        56300504<br>
    11001320       aaaaaaaaaaa        21/06/2003       1        56300508<br>
    11001321       aaaaaaaaaaa        15/07/2004        1       56300510<br>
    11001322       aaaaaaaaaaa        02/06/2004        1        56300513<br>
    11001323       aaaaaaaaaaa        08/05/2004        4       56300515<br>
    <br>
    <br>
    plz help me out ASAP
    null
    Message was edited by:
    aanchal_2008

    can you try this,
    SELECT DISTINCT im.item_code,
    im.descR,
    gd.ent_dt,
    gd.qty,
    gd.doc_no
    FROM item_mst im,
    grn_dtl gd
    WHERE im.item_code = gd.item_code (+)
    AND NOT EXISTS (
    SELECT 'later detail'
    FROM grn_dtl gd2
    WHERE gd2.item_code = gd.item_code
    AND gd2.ent_dt > gd.ent_dt)
    ITEM_CODE DESCR ENT_DT QTY DOC_NO
    11001318 aaaaaaaaaaa 2/12/2005 6 563005
    11001319 aaaaaaaaaaa 6/22/2004 0 563005
    11001320 aaaaaaaaaaa 6/9/2005 0 563005
    11001321 aaaaaaaaaaa 12/5/2005 5 563005
    11001322 aaaaaaaaaaa 6/22/2004 2 563005
    11001323 aaaaaaaaaaa 9/12/2004 1 563005
    11001324 aaaaaa
    11001325 aaaaaa
    8 rows selected

  • How can i make this stored procedure work

    Im using MSSQL 2000 im trying to write a stored procedure which first checks if a certain day
    is already stored if not store the day and the owner and return something to show if it was stored
    or not
    create procedure dbo.pickDay @day datetime, @owner varchar(255), @number tinyint
    AS
    IF EXISTS
    (SELECT day FROM calendar
    WHERE [date] = @day)
    INSERT INTO calendar([date], owner, number)
    VALUES (@day, @owner, @number)
    RETURN 1
    ELSE
    RETURN 0
    GO
    Thank you all for your time

    i used sybase so the syntax i give you may not work ...
    create procedure dbo.pickDay (@day datetime, @owner varchar(255), @number tinyint)
    AS
    BEGIN
    IF EXISTS (SELECT day FROM calendar WHERE [date] = @day)
    INSERT INTO calendar([date], owner, number) VALUES (@day, @owner, @number)
    RETURN 1
    ELSE
    RETURN 0
    END
    GO
    hope that'd help,
    marvinrouge

Maybe you are looking for