Alter table inside a procedure

In one of my packaged procedure i am altering a table and then compiling the whole schema. those two statements are given below:
EXECUTE IMMEDIATE 'alter table t_credit_book_entry add key_dummy varchar2(28 char)';
dbms_utility.compile_schema(schema => 'DM01_TRANS');When i call this packaged procedure, it took 30 minutes to complete. During the execution, i identified one wait event called "labrary_cache_pin" for which wait time was increasing. Then i have removed these 2 lines from procedure and tried to call it like below, it took only 3 minutes.
EXEC my_pkg.proc('CR');
alter table t_credit_book_entry add key_dummy varchar2(28 char)
EXEC dbms_utility.compile_schema(schema => 'DM01_TRANS');
I tried it several times with the same result. Can anybody tell me, why its happening like this and what is the functionality of "library cache pin"?

You are right but in my current requirement this column is needed for intermediate processing and after processing i am making it to unused.
And my issue was solved by calling the following inside the procedure (which will compile only invalid objects):
dbms_utility(schema=>'DM01_TRANS',compile_all=>FALSE);In my previous approach it was going for a recursive call and ideally should run for-ever. Then I doubt, how it has finished in 30 minutes!!!

Similar Messages

  • Creating tables inside stored procedures

    is there a limitation as of how many tables i can cerate inside my stored proc using:
    execute immediate('CREATE TABLE xxx AS select * from yyy.... ?
    i have a stored proc that creates couple tables with the method shown above. but the compiler complains for the second create table zzz as select * from .... any idea why?
    I am attaching my procedure just in case:
    CREATE OR REPLACE
    procedure retail_cif_prep as
    begin
    begin
    execute immediate('drop table cif_retail');
    execute immediate('drop table cif_retail_wrong_ccsno');
    exception
    when others then
    null; -- or log errors other than -942 (table doesn't exist)
    end;
    execute immediate('CREATE TABLE cif_retail AS select * from cst where cstfnflag=1 and cstdatoc!=''00000000'' order by cstno');
    execute immediate('CREATE UNIQUE INDEX cif_retail_clustered ON cif_retail(CSTNO)');
    delete from cif_retail where CSTNAM='';
    execute immediate('CREATE TABLE cif_retail_wrong_ccsno AS select * from cif_retail where cstccsno not in (100, 110, 130, 900)');
    delete from cif_retail where CSTNO in (select CSTNO from if_retail_wrong_ccsno);
    end;

    Agree with 3360, this sort of things should be done beforehands.
    Basically what's happening is when you try and compile your procedure the delete statements are referencing your two tables, but I'm guessing these tables are yet to be created on the database and therefore the procedure won't compile without them.
    A dirty workaround is to put your delete statements inside execute immediate commands too.
    Then sit back, make a cup of coffee and have a good think about why on earth you are writing such poor code.

  • SAP HANA - How to run alter table statement in HANA procedure?

    I am trying to run alter table statement in a procedure. HANA gives error saying
    SAP DBTech JDBC: [257] (at 1338): sql syntax error: ALTER TABLE is not allowed in SQLScript: line 36 col 8 (at pos 1338)
    How to run alter table statements in procedure?
    Thanks,
    Suren.

    Hi Rich Heilman,
    Thanks for your response.  I have tried with dynamic SQL. I am trying to add partitions to a non portioned table.
    EXECUTE IMMEDIATE 'ALTER TABLE ' || :SCHEMA_NAME || '.TARGET_TABLE PARTITION BY RANGE (TARGET_TYPE_ID) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION VALUE = 4, PARTITION OTHERS)';
    Execution fails with error
    Could not execute 'CALL PARTITION_TARGET_TABLE('SUREN_TEST')' in 1.160 seconds .
    [129]: transaction rolled back by an internal error:  [129] "SUREN_TEST"."PARTITION_TARGET_TABLE": line 53 col 3 (at pos 2173): [129] (range 3)
    Any reasons for this error?
    Thanks,
    Suren.

  • CONNECT and ALTER statements in a Procedure. COPY command in SQL*Plus

    Hi people,
    Is it possible to use the SQL commands, "CONNECT" and "ALTER TABLE" in a procedure, function or trigger?
    In one of my audit procedures, I need to connect to a financial database (FROM the applications database), and then proceed to alter a number of tables based on certain data. I'm sure I've done it before, but I can't remember how! Isn't there a command such as "EXEC_SQL" or something?
    Another question:
    I need to copy a table from one database ("OPS$TSLIVE") to another ("TRACKER"). Here is an excerpt of my code, as well as an error! I've never had this error before!
    JOHANN> copy from ops$tslive/pwd@cds to tracker/pwd@tracker create new_alerts using select * from alertcodesfile;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    select * from alertcodesfile
    Error in SELECT statement: ORA--1002: Message -1002 not found; product=RDBMS; facility=ORA
    Please help!
    Kind regards,
    Johann.

    You are refering to 'execute immediate' (>=8i). As far as I know it is not possible to do connects. Alter table perhaps, if it is in the local database (try it). If you want to perform dml in a remote database, create a database link and use that to perform you dml on. a DB link can also be used to call a remote procedure (That perhaps does the alters for you). Try it.
    The oracle doc says this about ORA-1002:
    ORA-01002 fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out of sequence.
    A successful parse-and-execute call must be issued before a fetch. This can
    occur if an attempt was made to FETCH from an active set after all records have
    been fetched. This may be caused by fetching from a SELECT FOR UPDATE
    cursor after a commit. A PL/SQL cursor loop implicitly does fetches and may
    also cause this error.
    Action: Parse and execute a SQL statement before attempting to fetch the data.It looks like a bug, ask Oracle support.
    L.

  • How can i create a Global Temporary Table inside a Stored Procedure....

    Hi...
    I need to create a Global Temporary Table inside a Stored
    Procedure....
    I have no idea how to do that....
    Please....if u can send me a sample, send to me....
    Thanks a lot

    To create a global temporary table inside a stored procedure,
    the minimal syntax would be:
    CREATE OR REPLACE PROCEDURE procedure_name
    AS
    BEGIN
    EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE table_name'
    || '(column_name NUMBER)';
    END procedure_name;
    As Todd stated, it would probably be better to create the global
    temporary table outside of the procedure:
    SQL> CREATE GLOBAL TEMPORARY TABLE table_name
    2 (column_name NUMBER);
    Table created.
    You can also specify things like ON COMMIT PRESERVE ROWS or ON
    COMMIT DELETE ROWS.
    It may be that there is something else, like a PL/SQL table of
    records or a cursor, that would suit your needs better. It is
    difficult to guess without knowing what you want to do with it.

  • Using ALTER SESSION inside a stored procedure.... not a good idea?

    Hi,
    I have two stored procedures, both of which are used to query a database to find a particular book, based on ISBN. One sproc searches our main product catalogue and the other searches our suppliers feed catalogues. The stored procedures are called from a C# application via a search tool and the user is able to search on either our catalogue or our suppliers. The appropriate procedure is called based on the users choices.
    However, the following behaviour is observed
    I search for an ISBN (is a varchar2 field, as isbn's may contain an X if the checksum digit equates to 10) on a feed, so uses the FEED SPROC. The book is found and returned to the app in about 0.5 seconds. I can repeat this as often as i like on different books etc. always works fine.
    I then do the same search but against our own catalogue, so uses our CATALOGUE SPROC. Again the book is found quickly, and the search can be repeated with the same results.
    If i then go back and run our FEED SPROC then the search time increases to about 3 minutes !
    Both the feed and our catalogue is in the same database, although different schema's the connections will be pooled through our app server.
    I can repliacte this every single time. I think i have narrowed doen the cause of this behaviour to a few lines of code in our CATALOGUE SPROC:
    -- store values
    select value into v_vch_NLS_COMP from nls_session_parameters nsp where nsp.parameter = 'NLS_COMP';
    select value into v_vch_NLS_SORT from nls_session_parameters nsp where nsp.parameter = 'NLS_SORT';
    -- Ensure case insensitivity throughout
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_COMP = LINGUISTIC';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_SORT = BINARY_CI';
    do other stuff
    -- restore session variables
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_COMP = ' || v_vch_NLS_COMP;
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_SORT = ' || v_vch_NLS_SORT;
    If i remove this code then all is well, so i am assuming that using ALTER SESSION inside a stored procedure is the cause of the problem as it would be changing the execution plan of the FEEDS SPROC in some manner? Any ideas? I know i can just rewrite the sproc to avoid using this coding, but wanted to understand if i am doing something wrong by using ALTER SESSION in this manner?
    Any pointers would be appreciated.
    John Thompson
    Software Architect,
    play.com
    Edited by: user7186902 on 27-May-2009 03:51

    Hello (and welcome),
    It may be a case of having to create a linguistic index to facilitate the queries once you set these session level parameters, i.e..,
    CREATE INDEX idx_01 ON tab ((NLSSORT(col1, 'NLS_SORT=BINARY_CI'))It would appear that the setting of those parameters is invalidating index searching on the current indexes.

  • Create table statement inside a procedure.

    Hi,
    I'm trying to write a procedure creates some tables. The procedure has not arguments. I have written it in this way:
    CREATE OR REPLACE PROCEDURE MIGRAZIONE
    IS
        var varchar2(2000);
    BEGIN
    --INIZIO tabella dominio spr_klers_bor_borsa
    CREATE TABLE SPR_KLERS_BOR_BORSA34
      ID           VARCHAR2(4 BYTE)                 NOT NULL,
      DESCRIPTION  VARCHAR2(80 BYTE)
    CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
    (ID)
    LOGGING
    TABLESPACE FIN_DATA
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    NOPARALLEL;
    ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
      CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
    PRIMARY KEY
    (ID)
        USING INDEX
        TABLESPACE FIN_DATA
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       2147483645
                    PCTINCREASE      0
    --FINE tabella spr_klers_bor_borsa
    END MIGRAZIONE;When I compile I receive this message:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    What does it mean?
    How can I solve?
    I have tried to change the procedure in this way:
    CREATE OR REPLACE PROCEDURE MIGRAZIONE
    IS
        var varchar2(2000);
    BEGIN
    --INIZIO tabella dominio spr_klers_bor_borsa
    var := 'CREATE TABLE SPR_KLERS_BOR_BORSA
      ID           VARCHAR2(4 BYTE)                 NOT NULL,
      DESCRIPTION  VARCHAR2(80 BYTE)
    CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
    (ID)
    LOGGING
    TABLESPACE FIN_DATA
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    NOPARALLEL;
    ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
      CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
    PRIMARY KEY
    (ID)
        USING INDEX
        TABLESPACE FIN_DATA
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       2147483645
                    PCTINCREASE      0
    execute immediate var;
    --FINE tabella spr_klers_bor_borsa
    END MIGRAZIONE;And when I compile the version above I receive:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    How can I solve?
    Thanks all, bye bye.

    Here you have to user dynamic sql for create table, cerate index etc.
    like
    CREATE OR REPLACE PROCEDURE MIGRAZIONE
    IS
        var varchar2(2000);
    BEGIN
    --INIZIO tabella dominio spr_klers_bor_borsa
    var := 'CREATE TABLE SPR_KLERS_BOR_BORSA
      ID           VARCHAR2(4 BYTE)                 NOT NULL,
      DESCRIPTION  VARCHAR2(80 BYTE)
    Execute immediate var;
    var := 'CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
    (ID)
    LOGGING
    TABLESPACE FIN_DATA
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    NOPARALLEL' ;
    Execute immediate var;
    var := 'ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
      CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
    PRIMARY KEY
    (ID)
        USING INDEX
        TABLESPACE FIN_DATA
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       2147483645
                    PCTINCREASE      0
    execute immediate var;
    --FINE tabella spr_klers_bor_borsa
    END MIGRAZIONE;YOu can specify all the ddl statements in one execute immediate.
    Edited by: s_2 on Oct 17, 2008 6:59 PM

  • PLS-00327 when updating table from a remote table inside a PLSQL procedure

    Hi,
    Inside a PL/SQL procedure,I want to update a table from a remote table :
    begin
    UPDATE rachel1 set NEW_TEN_CODE =
    (SELECT NEW_TEN_CODE FROM rachel@REFI
    WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
    end;
    I receive the error :
    PLS-00327: "RACHEL" is not in SQL scope here
    When I extract the update from the procedure and I run from SQL (without begin ... end), it works :
    SQL> UPDATE rachel1 set NEW_TEN_CODE =
    2 (SELECT NEW_TEN_CODE FROM rachel@REFI
    3 WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
    So, why doesn't the update work inside the PL/SQL procedure ?
    What have I to do ?
    I need to run this command inside the procedure.
    Regards,
    Rachel

    Hi,
    Yes, the owner of the procedure have select on RACHEL@REFI.
    My oracle version is : 8.1.7.4.
    In fact, I've resolved the problem by doing :
    begin
    UPDATE rachel1 set NEW_TEN_CODE =
    (SELECT NEW_TEN_CODE FROM rachel@REFI
    WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE);
    end;
    Regards,
    Rachel

  • How Create a Global Temporary Table inside a Stored Procedure?

    Hi...
    I need to create a Global Temporary Table inside a Stored
    Procedure....
    I have no idea how to do that....
    Please....if u can send me a sample, send to me....
    Thanks a lot

    there are many ways to do this..
    one u can use dbms_utility package to run ddl statements like
    for ex:
    declare
    t varchar2(200):='order_no';
    v number;
    begin
    --dbms_utility.exec_ddl_statement('select '||t||' into '||v||'
    from
    --ordermaster where rownum=1');
    dbms_utility.exec_ddl_statement('create table cvt(t number)');
    dbms_output.put_line(v);
    end;
    but the actual method(recommended) involves a bit coding using
    dbms_sql package you will find examples on technet or metalink
    to use this package..
    I hope this helps
    Narendra

  • Why can I not see a table I own inside a procedure

    I have a procedure owned by user X as follows:
    create or replace  procedure ztm_get_debug_level is
      vc_pkg_name  system_parameter.name%TYPE := 'DEBUG_LEVEL_PKG_BASE_KEYS';
      vn_error     services.debug_log_level.debug_level_id%TYPE := 30;
      v_debugLevel   system_parameter.number_value%TYPE;
      function get_owner return varchar2 is
        cursor c1 is
        select owner from all_tables where table_name = 'SYSTEM_PARAMETER';
        v_Ret_Val VARCHAR2(30);
      BEGIN
        OPEN C1;
        FETCH C1 INTO v_Ret_Val;
        CLOSE C1;
        RETURN v_Ret_Val;
      END;
    begin
      DBMS_OUTPUT.PUT_LINE('AAAA - ' || get_owner);
      select s.number_value
      into   v_debugLevel
      from   system_parameter  s
      where  s.name = vc_pkg_name;
      DBMS_OUTPUT.PUT_LINE('BBBB');
    exception
      when no_data_found then
        NULL;
      when others then
       DBMS_OUTPUT.PUT_LINE('p_get_debug_level.WHEN OTHERS');
       raise;
    end;
    Table system_parameter is owned by user X.
    When I execute I get:
    TESTSSG.SUBSCRIPTION.87> exec ztm_get_debug_level
    AAAA - X
    p_get_debug_level.WHEN OTHERS
    BEGIN ztm_get_debug_level; END;
    ERROR at line 1:
    ORA-00942: table or view does not exist
    ORA-06512: at "SUBSCRIPTION.ZTM_GET_DEBUG_LEVEL", line 32
    ORA-06512: at line 1
    When I run the query outside the procedure as user X I get a row.
    Any ideas?
    FYI, there are no public sysnonyms.
    DB version: 11.2.0.3.0
    Thanks,
    Thomas

    Thanks Frank,
    SYSTEM_PARAMETER is a table owned by X.  If I qualify the select statement by adding the owner it works, but of course I do not want to do that.  Here is the DDL for creating SYSTEM_PARAMETER:
    create table SYSTEM_PARAMETER
      name         VARCHAR2(256) not null,
      date_value   DATE,
      number_value NUMBER,
      string_value VARCHAR2(512),
      comments     VARCHAR2(512)
    alter table SYSTEM_PARAMETER add constraint PK_SYSTEM_PARAMETER primary key (NAME);
    Again, if I rewrite the procedure to the following (only difference is the red X.), it works:
    create or replace  procedure ztm_get_debug_level is
      vc_pkg_name  system_parameter.name%TYPE := 'DEBUG_LEVEL_PKG_BASE_KEYS';
      vn_error     services.debug_log_level.debug_level_id%TYPE := 30;
      v_debugLevel   system_parameter.number_value%TYPE;
      function get_owner return varchar2 is
        cursor c1 is
        select owner from all_tables where table_name = 'SYSTEM_PARAMETER';
        v_Ret_Val VARCHAR2(30);
      BEGIN
        OPEN C1;
        FETCH C1 INTO v_Ret_Val;
        CLOSE C1;
        RETURN v_Ret_Val;
      END;
    begin
      DBMS_OUTPUT.PUT_LINE('AAAA - ' || get_owner);
      select s.number_value
      into   v_debugLevel
      from   X.system_parameter  s
      where  s.name = vc_pkg_name;
      DBMS_OUTPUT.PUT_LINE('BBBB');
    exception
      when no_data_found then
        NULL;
      when others then
       DBMS_OUTPUT.PUT_LINE('p_get_debug_level.WHEN OTHERS');
       raise;
    end;
    This procedure exists in 4 other environments where there are no issues.  It can't be a privileges issue as the table is owned by user X and as you can see by the lookup (which was added for debug) against ALL_TABLES the owner is clearly X.  So, why can X not select from it's own table unless we include the owner?
    Thanks,
    Thomas

  • Can't have alter table in SP ?

    I tried to create a procedure
    CREATE OR REPLACE PROCEDURE sp_disablefk
    is
    begin
    Alter Table ACCOUNTDETAIL
    Disable constraint SYS_C0022265;
    end;
    It returned me a message Encountered symbol Alter when expecting .....
    However, when I place same statement in Execute Immediate statement, also inside of procedure, it creates and executes it without problems.
    Can I still have it straight inside of SP, without Execute Immediate ? This constraint is FK referensing PK in another table.
    Thanks

    It is true for any DDL statement (which includes CREATE/DROP, of course).
    By naked DDL he meant that DDL statements can not be placed within PL/SQL block just on their own (like other SQL statements - SELECT, INSERT, UPDATE etc...).
    They need to be wrapped inside EXECUTE IMMEDIATE or for older Oracle versions using DBMS_SQL package.

  • How to call procedure inside a procedure and need to sore the value in a variable?

    HI ALL,
    i am usung oracle 11g.
    here is my package and procedure
    i want  to call get_email_details this procedure inside the process_email_master and want to keep the value inside a varible in master procedure
    create or replace
    PACKAGE        ms_gen_process_email
    as
       type email_type is record(subject                            varchar2(4000 char),
                                 email_body                       varchar2(4000 char),
                                 to_receipent                    varchar2(4000 char),
                                 cc_receipent                     varchar2(4000 char));
        type email_type_table is table of email_type;
       procedure process_email_master(
          p_metric_name     IN   VARCHAR2,
          p_current_stage   in   varchar2,
          p_action          in   varchar2,
          p_pid             in    number,
          P_OBJECT_ID       in    varchar2
          --p_emai_master     out   p_email_type_table
       PROCEDURE get_email_details (
          p_metric_name     IN   VARCHAR2,
          p_current_stage   in   varchar2,
          P_ACTION          in   varchar2,
          p_email_type_table1 out email_type_table
    END ms_gen_process_email;
    create or replace
    PACKAGE BODY        ms_gen_process_email
    as
        procedure process_email_master(
          p_metric_name     IN   VARCHAR2,
          p_current_stage   in   varchar2,
          p_action          in   varchar2,
          p_pid             in    number,
          p_object_id       in    varchar2
          as
          begin
          null;
           EXCEPTION
          WHEN OTHERS
          then
             null;
          end process_email_master;
       PROCEDURE get_email_details (
          p_metric_name     IN   VARCHAR2,
          p_current_stage   IN   VARCHAR2,
          P_ACTION          in   varchar2,
          p_email_type_table out email_type_table
       as
       BEGIN
          select subject, email_body, to_receipent, cc_receipent
           bulk collect into p_email_type_table
                    from ms_gen_email_config_detail
           WHERE email_key = (
                    SELECT email_key
                      FROM ms_gen_email_config
                     WHERE metric_name = p_metric_name
                       AND action = p_action
                       and current_stage = p_current_stage
          for i in p_email_type_table.first..p_email_type_table.last loop
          dbms_output.put_line(p_email_type_table(i).subject||p_email_type_table(i).email_body||p_email_type_table(i).to_receipent||p_email_type_table(i).cc_receipent);
          end loop;
       EXCEPTION
          WHEN OTHERS
          THEN
             NULL;
       END get_email_details;
    END ms_gen_process_email;
    but i am getting this error
    Error(15,31): PLS-00201: identifier 'P_EMAIL_TYPE_TABLE' must be declared
    Regards
    Damby

    If you need to call a procedure which has yet to be defined in your package, you can use forward declaration...
    That means that you declare the procedure/function before the place it's going to be called (typically people do this at the top of the package) without providing a body for the code...
    PACKAGE BODY        ms_gen_process_email as
       PROCEDURE get_email_details
          p_metric_name     IN   VARCHAR2,
          p_current_stage   IN   VARCHAR2,
          P_ACTION          in   varchar2,
          p_email_type_table out email_type_table
       ); -- Forward declaration of get_email_details procedure
        procedure process_email_master(
          p_metric_name     IN   VARCHAR2,
          p_current_stage   in   varchar2,
          p_action          in   varchar2,
          p_pid             in    number,
          p_object_id       in    varchar2
          as
          begin
          null;
           EXCEPTION
          WHEN OTHERS
          then
             null;
          end process_email_master;
       PROCEDURE get_email_details
          p_metric_name     IN   VARCHAR2,
          p_current_stage   IN   VARCHAR2,
          P_ACTION          in   varchar2,
          p_email_type_table out email_type_table
       ) as

  • How to change default value in a table using ALTER TABLE

    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    Any help will be needful for me
    Thanks and Regards

    user598986 wrote:
    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    ALTER TABLE  test
    MODIFY (indicator DEFAULT 'I'); 
    Incidentally, INDICATOR is a keyword in Oracle, so you may have problems using it as a column name. If so, you'll have to enclose the column name in double-quotes, and be careful to use capital letters inside the quotes.
    Edited by: Frank Kulash on Aug 26, 2009 11:42 AM

  • Updating a temporary table thru a procedure

    Hi, let's say i have a reference table named LP_TEST.  From this table I get records and insert them into a temporary table named LP_TEMP.  After inserting the records, i run a procedure named CALC_AREA, which is used to update a certain column AREA in table LP_TEMP (putting values into the column AREA from NULL).  Inside my procedure CALC_AREA, i have a commit.  After running the procedure, I query the value of AREA from LP_TEMP table but it seemed that the column AREA was not updated.  However, i did the same exact thing but instead of using a temporary table, i used a regular table named LP_TEMP_TEST.  In this, table, i get an output for column AREA.
    What is the problem with my temporary table?  I have ON_COMMIT, PRESERVE ROWS and NO_CACHE set on my temporary table.  Does update table in a procedure run on temporary tables?  I am using Form Builder 10.1.2.0.2.  Please help.  Thanks

    Is your procedure by any chance declared as an autonomous transaction? Also are you 100% sure your update statement *really* updates data in your temp table? I'd fire up the debugger to make sure of that...
    cheers

  • Create table as in procedure vs SQL*Plus between 2 utf8-db's

    I have a 9.2.05 db with charset UTF8 and Polish characters in it. When I extract a table to another 9.2.05 db with UTF8 charset using create table x as selcect * ...
    When I run it in SQL*Plus everything works just fine but when I do the create table as from inside a procedure the national characters are converted to western characters and the length of the record are shorter. Why? How do I get the procedure to work as SQL*Plus does. /Göran

    This sounds strange. Could you show the code of the procedure? Could you double-check that your db link points to the right database? Could you add:
    SELECT VALUE INTO <variable1>
    FROM NLS_DATABASE_PARAMETERS
    WHERE PARAMETER='NLS_CHARACTERSET'
    SELECT VALUE INTO <variable2>
    FROM NLS_DATABASE_PARAMETERS@<dblink>
    WHERE PARAMETER='NLS_CHARACTERSET'
    to your procedure and output the contents of the PL/SQL <variable1> and <variable2>, e.g. using DBMS_OUTPUT, to verify the character sets of the databases?
    -- Sergiusz

Maybe you are looking for

  • COPA - Split of Value from condition type into different value fields

    Dear All, Customer is having several free schemes to customer the same is set up by SD and Cost of free goods is attached to One Z condition type, this flows along with Main product as characteristic. So we have Main product cost in VPRS and Scheme c

  • Call of Duty: Ghosts, Save $20 Plus Free Onslaught DLC

    Pick up Call of Duty: Ghosts for Xbox One or PS4 this week, 4/6/14 to 4/12/14, to save $20 and get a get a free download of Call of Duty: Ghosts Onslaught!  Onslaught includes four unique multiplayer maps, an all-new dual purpose assault rifle/sniper

  • How to get a relative filepath using Java?

    Hi, I'd like to write a custom application for something I'm doing at work. Basically, I need to find the relative filepath from one file to another. Like, if I start in a subdirectory of directory A with file abc.htm, I want to use Java find the rel

  • Cell contents in the condition of SUMIFS

    the function SUMIFS(sum-values, test-values, condition, test-values..., condition...) i am not able to use cell contents for the "condition" (=C2) because it says syntax error. anyone can help on this? best regards, Paulo

  • New Hard drive installation difficulties in MacBook pro 15"

    I have a MacBook Pro 15" mid 2010. I was having difficulties with it getting slow, and the hard drive reaching out of capacity. I did get the following: - 2* 204pin, DDR3 1066MHz of 4GB each - HGST travelStar hard drive 1TB 5400RPM, 8MB cache, SATAII