Using data dictionary in PL/SQL

What people think about using data dictionary in PL/SQL witch supposed to be used for a long time (selects, type declarations and so on)?
Oracle does not guarantee data dictionary names will be same forever.
Is it a good idea to restrict the using of this in the Development standards?

The reason I open this thread I am trying to improve the Development Standards
My attempt was to restrict using SELECT FROM Data Dictionary if it is possible.
Here are examples, what I trying to figure out
SELECT SYS_CONTEXT ('USERENV', 'DB_NAME')
  FROM DUAL;
or
SELECT VALUE
  FROM gv$parameter
WHERE NAME = 'db_name';
SELECT SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMAID')
  FROM DUAL;
or
SELECT user#
  FROM SYS.user$
WHERE NAME = USER;
I am not asking ‘Can I...?’ I am asking ‘What people think?’
Probably, it is not an issue.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Windows are weired in Reports- Data Dictionary Reports- PL/SQL- .......

    When I go to Reports->Data Dictionary Reports-> PL/SQL->Search Source Code I get a window where I can not enter anything and moreover nothing is clearly visible.
    Also same is happening for option Reports->Data Dictionary Reports-> PL/SQL->Progam Unit Arguments.

    The parameters default to NULL (the NULL check box is ticked) - to be able to enter a value, you need to first uncheck the NULL check box. You get the same thing with bind variables when running statements in the SQL Worksheet.
    I think it would be much better if typing anything into the parameter value field automatically deselected the NULL, but it doesn't do that.

  • Add multiple entries to dropdown list without using data dictionary

    Hi,
    By default when we use a data dictionary element for dropdown list, all the possible values are listed in the dropdown. However when no data dictionary element is used for the dropdown list, it behaves like a parameter with a single line.
    I would like to know if it is possible to not use the data dictionary element and still have multiple lines in the dropdown.
    Thanks in advance.
    Shamia

    Check the below program :
    *report zxyz.
    report zxyz.
    Table diclaration
    tables: tvdir.
    Selection screento table View
      selection-screen skip 2.
      parameter p_tabnm(30) as listbox visible length 30 obligatory.
      selection-screen skip 1.
      selection-screen begin of block s1 with frame title text-001.
      parameter: p_radio1 radiobutton group g1,
                 p_radio radiobutton group g1.
      selection-screen end of block s1.
    Add values to list box
    at selection-screen output.
      type-pools: vrm.
      data: name  type vrm_id,
            list  type vrm_values,
            value like line of list.
      name = 'P_TABNM'.
      refresh list.
      value-key = 'V_024'.
      value-text = text-002. "'V_024-Purchasing Groups'.
      append value to list.
      value-key = 'V_T024D'.
      value-text = text-003. "'V_T024D-MRP Controllers'.
      append value to list.
      value-key = 'ZT604'.
      value-text = text-004. "'T604-Commodity Codes'.
      append value to list.
      value-key = 'T179'.
      value-text = text-005. "'T179-Product Hierarchies'.
      append value to list.
      value-key = 'TVM1T'.
      value-text = text-006. "'TVM1T-Business Manager'.
      append value to list.
      value-key = 'TVM2T'.
      value-text = text-007. "'TVM2T-Division manager'.
      append value to list.
      value-key = 'TVM3T'.
      value-text = text-008. "'TVM3T-Director'.
      append value to list.
      value-key = 'V_TVV2'.
      value-text = text-009. "'V_TVV2-Customer Group 2'.
      append value to list.
      call function 'VRM_SET_VALUES'
           exporting
                id     = name
                values = list.
    start-of-selection.
    Get flag of corresponding table view
      select single tabname flag from tvdir into tvdir
                    where tabname = p_tabnm.
    Set flag of corresponding table view
      if p_radio1 eq 'X'.
        if tvdir-flag ne 'X'.
          update tvdir set: flag  = 'X'
                     where tabname = p_tabnm.
        endif.
      endif.
      if p_radio eq 'X'.
        if tvdir-flag eq 'X'.
          update tvdir set: flag  = ''
                       where tabname = p_tabnm.
        endif.
      endif.
    Execute View/Table
      call function 'VIEW_MAINTENANCE_CALL'
        exporting
          action                               = 'U'
          view_name                            = p_tabnm
       exceptions
         client_reference                     = 1
         foreign_lock                         = 2
         invalid_action                       = 3
         no_clientindependent_auth            = 4
         no_database_function                 = 5
         no_editor_function                   = 6
         no_show_auth                         = 7
         no_tvdir_entry                       = 8
         no_upd_auth                          = 9
         only_show_allowed                    = 10
         system_failure                       = 11
         unknown_field_in_dba_sellist         = 12
         view_not_found                       = 13
         others                               = 14.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Reset flag of corresponding table view
      update tvdir set: flag  = tvdir-flag
                    where tabname = p_tabnm.
    Thanks
    Seshu

  • Using Data Compression on Microsoft SQL 2008 R2

    We have a very large database which keeps growing and growing. This has made our upgrade process extremely troublesome because the upgrade wizard seems to require close to 3 times the database size of free space to even start.
    As such, we are considering activating DATA COMPRESSION on the PAGE level in Microsoft SQL Server 2008 R2. This technology is native to the SQL Server and compresses the rows and the pages so that they do not take up more space than necessary.
    Traditionally each row take up the space of the maximum of all the fields even though only part of a field is filled with data.
    [Blog about Data Compression|http://blogs.msdn.com/b/sqlserverstorageengine/archive/2007/11/12/types-of-data-compression-in-sql-server-2008.aspx]
    Our idea is to use this initially on the Axxx tables (historic data) to minimize the space they take by using for example:
    ALTER TABLE [dbo].[ADO1] REBUILD PARTITION = ALL
    WITH (DATA_COMPRESSION = PAGE)
    On a test database we have seen tables go from 6GB of space to around 1,5GB which is a significant saving.
    MY QUESTION: Is this allowed to do from SAP point of view? The technology is completely transparent but it does involve a rebuild of the table as demonstrated above.
    Thanks.
    Best regards,
    Mike

    We are using Simple recovery model, so our log files are pretty small.
    Our database itself is about 140GB now and it keeps growing.
    We've also reduced the history size to about 10 versions.
    Still, some of our tables are 6-10GB.
    Some of the advantages of data compression is to also that it improves disk I/O at the cost of slightly higher CPU, which we are pretty sure our server can handle.
    Mike

  • Not able to use date with time in sql query

    Hi,
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id,b.creation_date
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between to_date('21-10-2013 9:19:48','DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    If I execute this query in toad it is giving me proper results.This query populates the results between the two date with time.
    But I am facing issue when I am using this query in the procedure. The procedure is as below.
    If I use the same query in the procedure I am getting wrong output.
    CREATE OR REPLACE procedure xx_prog_upd_annualized_amt(errbuf out varchar2, retcode out varchar2)
    as
    cursor c1 (l_date in varchar2)is
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between  to_date(l_date,'DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    v_date varchar2(100);
    v_total_days number;
    v_annualized_amount number;
    begin
    begin
    select max(fcr.actual_start_date) into v_date
    from fnd_concurrent_programs_vl fcp
    ,fnd_concurrent_requests fcr
    where fcp.concurrent_program_id = fcr.concurrent_program_id
    and fcp.user_concurrent_program_name like 'Renewed Annualized Amount Updation';
    exception
    when others then
    fnd_file.put_line(fnd_file.log,'Invalid date');
    end;
    fnd_file.put_line(fnd_file.output,v_date);
    fnd_file.put_line(fnd_file.output,sysdate);
    fnd_file.put_line(fnd_file.output,'***************Start of Program***************');
    fnd_file.put_line(fnd_file.output,'***************Hi***************');
    For i in c1(v_date) loop
    SELECT
             1
           + 30 * TRUNC (MONTHS_BETWEEN ( TO_DATE (i.end_date, 'DD-MON-YYYY'),  TO_DATE (i.start_date, 'DD-MON-YYYY')))
           + LEAST (EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')), 30)
           - LEAST (EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')), 30)
           + CASE
                WHEN EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')) < EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')) THEN 30
                ELSE 0
             END
              daysbetween into v_total_days
      FROM dual;
      fnd_file.put_line(fnd_file.output,i.contract_number);
      fnd_file.put_line(fnd_file.output,v_total_days);
      If v_total_days < 360 then
      v_annualized_amount := (360*i.price_negotiated)/v_total_days;
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = v_annualized_amount
      where cle_id = i.cle_id;
       fnd_file.put_line(fnd_file.output,v_annualized_amount);
        fnd_file.put_line(fnd_file.output,i.cle_id);
        elsif v_total_days >= 360 then
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = i.price_negotiated
      where cle_id = i.cle_id;
      end if;
    end loop;
    commit;
    fnd_file.put_line(fnd_file.output,'***************End of Program***************');
    null;
    end;

    SureshM wrote:
    Hi Purvesh,
    Apologize for not giving the sufficient information.
    max(fcr.actual_start_date) = here I am getting date with time (for eg :9/4/2012 6:47:49 PM)
    Datatype for this column is date.
    This actual start date I am storing in varchar2 variable and then converting this value to date with time.
    My requirement is to pick the rows between the two timestamps which I am unable to do in the procedure.
    Regards
    Suresh
    YOu are losing the Time information while fetching the data into a VARCHAR2 variable. change the datatype of v_date to DATE and get rid of the TO_DATE logic in cursor and simply use v_date variable.
    Message was edited by: PurveshK misread.

  • Using Data Modeler in Oracle SQL Developer

    Hi,
    Can anyone help me to learn the DataModeler in Oracle SQL Developer?

    You should post your question in the SQL Developer Data Modeler forum. This is the Oracle Forms forum.
    Craig...

  • Query to obtain tables in SH schema using data-dictionary views/tables.

    Hi,
    I have just installed Oracle 10g Database. Logged on to SQL Plus by scott (changed the password as prompted).
    I want to see the tables in SH schema (which comes by default with Oracle 10g database).
    The problem, I am facing is:
    I can see the schema name: SH in the result of the below query:
    SELECT * FROM ALL_USERS
    but, nothing is returned in the result of the below query:
    SQL> SELECT OWNER FROM ALL_TABLES WHERE OWNER='SH';
    Result: no rows selected.
    Why is this happening?
    What will be the correct query to obtain tables present in SH schema ?
    Thanks in Advance & Regards,
    Deeba

    conn /as sysdba
    SQL> select table_name from dba_tables where owner='SH';
    I think the user SCOTT have no privilege to see SH schema tables through all_tables view.
    Thanks

  • Using data dictionary

    Hi everyone,
    I am a new user to Oracle 10g XE.
    I would like to know if there is any way for me to list the size of each object in my current schema follow by the object name.
    Any advice / help would be appreciated.
    Regards

    Hello,
    You may use the following query:
    connect <schema_user>/<password>
    select segment_name, segment_type, bytes/(1024*1024) "MB"
    from user_segments
    order by bytes desc;It will list all the Segments (Tables, Index, ...) belonging to the current Schema from the largest one to the smallest one.
    The View user_segments has also a column tablespace_name which can give you the name of the Tablespace where the Segment is stored.
    Hope this help.
    Best regards,
    Jean-Valentin
    Edited by: Lubiez Jean-Valentin on Feb 20, 2011 9:37 AM

  • Result_cache and data dictionary views

    Hi,
    Are there any special considerations when caching the results of a function which uses data dictionary views to determine it's results?
    This question has popped because I have a such a result_cached function for which the result_cache objects are not getting invalidated even when the underlying data dictionary views have changed and the function gives 'stale' values in it's output. Adding the relies_on clause has not helped either.
    Here is what I am trying to do:
    The function accepts table name as its input and tries to determine all the child tables using the sys.dba_constraints view. The results are returned in a pl/sql table and are cached so that the subsequent calls to this function use the result_cache.
    Everything works fine for the parent/child tables which have been created before the creation of this function. All the results are correct.
    The problem starts when a new child table is added to an existing parent table.
    The v$result_cache_objects view shows the result of this function as 'Published' and the output of the function does not show the newly created child table.
    Same is the case when an existing child table is deleted; the function continues to return it in the output as it is pulled from the result_cache.
    Oracle version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    >
    Restrictions on Result-Cached Functions*
    To be result-cached, a function must meet all of these criteria:
    * It is not defined in a module that has invoker's rights or in an anonymous block.
    * It is not a pipelined table function.
    * It does not reference dictionary tables, temporary tables, sequences, or nondeterministic SQL functions.
    For more information, see Oracle Database Performance Tuning Guide.
    * It has no OUT or IN OUT parameters.
    * No IN parameter has one of these types:
    o BLOB
    o CLOB
    o NCLOB
    o REF CURSOR
    o Collection
    o Object
    o Record
    * The return type is none of these:
    o BLOB
    o CLOB
    o NCLOB
    o REF CURSOR
    o Object
    o Record or PL/SQL collection that contains an unsupported return type
    It is recommended that a result-cached function also meet these criteria:
    * It has no side effects.
    For information about side effects, see "Subprogram Side Effects".
    * It does not depend on session-specific settings.
    For more information, see "Making Result-Cached Functions Handle Session-Specific Settings".
    * It does not depend on session-specific application contexts.
    >
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/subprograms.htm#LNPLS698

  • Table has no tablespace in the data dictionary

    I have seen this twice now, and still don't know what causes it. Does anyone know what would cause a table to have a null value for tablespace_name in user_tables or all_tables?
    Thanks,
    Sam

    Info Temporary table will not be stored in data dictionary.
    Ex :
    Sql > Create global temporary table x (i number);
    And now run this and look at the result set !
    Sql > select table_name,tablespace_name form user_tables ;
    null

  • How to run sql scripts using batch file for a web dynpro data dictionary

    Hi,
    I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
    I further require to make the scripts independent of the database name,so that it can be run at any client environment.
    Your help will be appreciated and rewarded.

    See shoblock's answer
    call sql script from unix
    masterfile.sql:
    @file1 &1
    @file2 &2
    @file3 &3
    @file4 &4
    then just call the master script:
    sqlplus userid/password @masterfile <p1> <p2> <p3> <p4>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL remote query and data-dictionary

    Hi,
    We are considering the implementation of SAP Business One 2005. I've installed a demo version but in order for it to continue to support some business functions I need to perform a number of SQL queries against the data. Unfortunately I'm having difficulties in getting the answer from our reseller.
    Does anyone know the answers to the following question. I'd very much appreciate some help.
    1) Is there a data-dictionary document showing which tables perform which roles and the associated joins/associations.
    2) Is it 'advised' to open the SAP datasource directly to perform a SELECT query to obtain the results or should a third-party tool be used?
    3) Do I need the SDK if I want to perform direct SELECT queries or if I want to automate posting invoices to SAP? We have competent programmers in the company - I believe they use VB6 and VB.net.
    4) Is there an example if I simply wanted to query all suppliers within SAP? (e.g. SELECT NAME FROM Supplier_tbl...etc..etc)
    Any help would be very much appreciated - it's a huge application and I'm struggling a little.
    Many thanks,
    Gavin Russell.

    Gavin,
    The forum that you have posted your questions in is or questions related to the SAP Business One Integration for SAP NetWeaver.  Your questions seem to be along the line of general data access to SAP Business One.  You should typically post those types of questions in the SAP Business One Discussion Forum or the SAP Business One SDK Discussion Forum.
    As to your questions ...
    1.  The definition of the SAP Business One table schema is part of the SAP Business One SDK Help Center documentation.  You simply need to install the SAP Business One SDK Help and you will have it.  There is not a "data dictionary" other than this documentation.
    2.  Typically any direct access to SAP Business One data using SQL is discouraged as if data corruption occurs as a result of it, the environment would not then be supported by SAP.
    3.  If you want to push data into SAP Business One, as stated, direct access to the Business One database is forbidden.  You would use the SAP Business One SDK for this.
    4.  You can use the SAP Business One Query Manager/Wizard in the SAP Business One product which in essence is performing SQL type SELECTS for data on Business One tables.
    HTH,
    Eddy

  • New To SQL Developer Data Modeler - Data Dictionary Report

    I am new to Data Modeler and I am currently learning what I can do and can't with it. Is there a way to generate a "Data Dictionary" report? We would like a report we can distribute that describes all tables and columns with descriptions and comments. We used to use an old version of Power Designer and we could do this from the data model we created. Is it possible to do something like this from SQL Developer Datas Modeler?

    Hi,
    Saxon is just an option, you don't need it by default.
    Could be permissions problem. What are you working on i.e. OS? What java version do you use?
    Even though you have specified directory for the reports do you have permissions to write there?
    Report generation directories priority is:
    1. Custom directory if specified in Settings->Data Modeler->Default Reports Directory
    2. /datamodeler/reports/
    3. User home directory
    You must have permissions somewhere on these directories. On the other hand you are saying that report_data.xml is generated so you have permissions.
    Okay. Now I saw a bug in 710. When you click "Generate report" there are progress dialogs and result dialog, but if you meanwhile click somewhere or change focus, these dialogs are hiding below main "Reports" dialog i.e. you are not seeing them. If you use Alt+Tab the result dialog will popup. This bug is fixed in the next release.
    So you must see either result dialog or error dialog at the end of report generation. If not check with Alt+Tab if it is not hidden somewhere below and if there is no such dialog close the DataModeler and check the log file for some error.
    There is SQL Developer Data Modeler 3.3 Early Adopter Available.
    http://www.oracle.com/technetwork/developer-tools/datamodeler/downloads/datamodeler-33-ea-1869055.html
    Above issue is fixed there and report is opening automatically.
    Edited by: Dimitar Slavov on Nov 29, 2012 11:53 PM

  • Data Modeler EA1:  Importing SQL Server Data Dictionary issue

    I am using the Data Dictionary Import Wizard to import the Schema of a SQL Server 2005 database (JDBC connection has "SQL Server 2005" as the Type) into the Oracle SQL Developer Data Modeler. In step 4 of the import, under the "Import to:" section, there is only SQL Server 2000 available in the drop down.

    Database Name: Microsoft SQL Server
    Database Version 10.00.2531
    I assumed that a SQL Server 2008 DB would be handled as a SQL Server 2005 DB (that is until 2008 is supported). Currently the db is not using any SQL Server 2008 specific features.
    In Oracle Developer Data Model 2, the tables with xml data type would not import. This time, those tables did import.

  • SQL for data dictionary report

    Hi, anyone know what SQL I would need to run to to get a basic data dictionary listing? ie I'd like to know:
    table_name, column_name, column_type, length, precision, nullable etc
    Also a nested sub-query to get each tables constraints, indexes etc
    Thanks,
    Andrew

    The tables you'll need are user_table, user_tab_columns, user_indexes, user_ind_columns (maybe user_ind_expressions to if you use function based indexes), user_constraints and user_cons_columns.
    Personally, I find that calling DBMS_METADATA.GET_DDL for the object(s) is easier most of the time.

Maybe you are looking for

  • Where to keep the java class file which is being used from a form?

    Hi, Actually I am developing a form which has a bean area and the data will be displayed in the bean area in the form of grid. And I will register this form with apps and will run the from Oracle apps. I want to know that there is a java class file t

  • Cant lookup created queue

    I have a problem looking up queues that I'm creating with: com.sun.messaging.Queue myDQueue = new com.sun.messaging.Queue(); as per the documentation. I can see the nwly created queues in my message queue Admin Console but can find them again with :

  • Why do i get this error trying to access Hokuyo URG LiDAR on myRIO?

    Hi,  I am trying to use a Hokuyo URG -04LX-UG01 LiDAR on a myRIO. I read that i should try to communicate with the device in MAX but then i got the error shown in the picture. I've tried this https://decibel.ni.com/content/docs/DOC-35698 but it wont

  • Where are my PP CC User Titles?

    I have just installed PPCC 2014 and have copied all the standard preset directories over from PPCC, so I have all the system presets etc... But I cannot find all my USER presets for titles I made in PPCC - to copy over to the presets folder in PPCC20

  • I upgraded to OS X Mavericks. I am not happy with it. How do I delete it? Thanks

    I recently downloaded OS X Maverecks. I am not happy with it. How do I delete it and go back to my original setup? Thanks