Debugging code

Hi all
I need to know the best practices for writing SELECT with the DEBUG directive

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE    11.1.0.7.0      Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
By example, for this SELECT
SELECT *
  FROM USER_OBJECTS
 WHERE -- REAL CONDITION
            OBJECT_NAME LIKE '%1%'
            -- DEBUG CONDITION
            --OBJECT_NAME LIKE '%2%'
;
I wrote this query:
WITH IS_DEBUG AS (SELECT 'NO' IS_DEBUG FROM DUAL)
SELECT *
  FROM USER_OBJECTS A, IS_DEBUG
 WHERE                                                                                                                      
       -- Real Condition
       (IS_DEBUG = 'NO' AND OBJECT_NAME LIKE '%1%') OR 
       -- Debug Condition
       (IS_DEBUG = 'YES' AND OBJECT_NAME LIKE '%2%');
Is there a more professional approach? Something like #ifdef...

Thank you all,

Riccardo

Oh,.

It is:

This is called conditional compile+ if you change the session before compiling your package...

Good bye
DPT

SQL> ALTER SESSION SET plsql_ccflags = 'MY_DEBUG:0';

Session altered.

SQL>
SQL> CREATE OR REPLACE PROCEDURE mytest IS
  2    counter  NUMBER;
  3  BEGIN
  4    DBMS_OUTPUT.put_line (   'MY_DEBUG = .'
  5                          || TO_CHAR ($$my_debug)
  6                          || '. -->');
  7  END;
  8  /

Procedure created.

SQL>
SQL>    EXEC MYTEST;
MY_DEBUG = .0. -->

PL/SQL procedure successfully completed.

SQL>
SQL>    ALTER SESSION SET plsql_ccflags = 'MY_DEBUG:1';

Session altered.

SQL>    EXEC MYTEST;
MY_DEBUG = .0. -->

PL/SQL procedure successfully completed.

SQL>
SQL> CREATE OR REPLACE PROCEDURE mytest IS
  2    counter  NUMBER;
  3  BEGIN
  4    DBMS_OUTPUT.put_line (   'MY_DEBUG = .'
  5                          || TO_CHAR ($$my_debug)
  6                          || '. -->');
  7  END;
  8  /

Procedure created.

SQL>
SQL> EXEC MYTEST;
MY_DEBUG = .1. -->

PL/SQL procedure successfully completed.

SQL>

Edited by: T.PD the 06.05.2011 11:25

Tags: Database

Similar Questions

  • GPU (Graphics Chip unit)-debugging codes

    When you download an update from third party (and of course out of the room) my mac showed white screen when I went to check on it.   After turn off and restart - Console showed cycle debug GPU - with a bunch of debugging codes and no way to interpret them.

    I think the screen saver may have caused the problem - to eventually try to start - at the same time my connection may have got it wrong - 2 things is going after the same resource at the same time.

    I use Opera as I'm on Snow Leopard with no way to get to the later versions of apple because they will not sell custom media commands.

    What model Mac Pro?

    What graphics card is installed?

    Maybe the graphics card has failed.

  • DBG1012: Debug deployment errors, can't run debug code

    DBG1012: Debug deployment errors, can't run debug code

    I got this error when im trying to load the data from different database...

    I myself DWH database with the option "target warehouse"... n HR database with the option "data source"...

    I tried to load HR table to table DWH... n im already ensure that both databases have this table...

    n This is my debug data:

    Analysis of card to debug...
    Retrieving the connection of Control Center information...
    Connecting to the Control Center schematic...
    The character set of the Control Center schema checking...
    Configuration of the sources and targets...
    Card validation...
    Correlated Commit is DISABLED.
    Generate debug package...
    Deployment of debug temp tables...
    Deploying debug package...
    ***********************************************
    Messages of debug code deployment:
    LINE 16, COLUMN 10:
    PL/SQL: ORA-00942: table or view does not exist
    LINE 11, COLUMN 3:
    PL/SQL: SQL statement ignored
    End of messages of debug code deployment
    ***********************************************
    Mapping debugger error:
    oracle.wh.service.sdk.mapping.debugger.WBMappingDebuggerException: DBG1012: Debug deployment errors, can't run debug code.

    What should I do?

    THX 4 your attention...

    LINE 16, COLUMN 10:
    PL/SQL: ORA-00942: table or view does not exist

    Take the generated deployment script.
    and focus on line 16.

    Make sure table name e\whether that it hit in the database.
    If read access is provided if it is in the different database.
    Check the line number of the package body.

  • Debugging code QML

    Hi all

    Is it possible to attach the debugger with java code written script file QML stunts for Blackberry 10 developing

    Concerning

    This page describes how to set up debugging QML, but I don't know if it works in current Development Kit:

    https://developer.BlackBerry.com/Cascades/documentation/Getting_started/tools/debugging.html

  • Debugging code inside the library of the ADF

    Hello

    I use JDeveloper 11.1.2.1

    I created the library of the ADF with general code for my project.
    Is it possible to tracking within this library code ADF from a project that use this library for debugging this project?

    Anatolii

    Hello

    A library contains the class files, you must have the source of debug and trace.

    For more information about debugging:

    http://download.Oracle.com/docs/CD/E12839_01/Web.1111/b31974/web_testdebug.htm

    Hope this will help.

    -Prasad

  • How to debug code source ADF

    Hello

    Please let me know how to join the code source ADF Faces to JDeveloper and how to debug?

    Kind regards
    Kiran

    It is available within our Oracle intranet.
    You can me ping at Oracle and I'll give you the link where to download it from.
    NB: you will get a straight answer using our internal forums or mailing lists.

    I costs nothing to your business unit, but if ever we meet, it will probably cost you a drink ;)

    You will find advice on the configuration and use of the source to debug applications in the developer's Guide to Fusion for the ADF ADF:

    [31.7.1 with Code Source ADF with the debugger - URL: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_testdebug.htm#CEGFGHJC]
    31.7.2 How-to Set Up the ADF Source Library user - URL: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_testdebug.htm#BABFBCED
    and
    31.7.3 How to add the ADF source library to a project - URL: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_testdebug.htm#sthref2595

    Kind regards

    Didier

  • Is there a way to debug code DataVisualization?

    I try to write my own rendering axis engine and find it very difficult to obtain after the calculations of the gutter.  I désarchivés the data visualization source to view it, but it's too complex for me to understand easily.  Is it possible to debug against that source, then I try to scroll the axis rendering calculations and hopefully understand how to fix my own?

    Thank you.

    If you download the stable version 4.0.0.13875, you will find the DMV source in

    frameworks/projects/datavisualization and the CFC in the frameworks/libs who

    must have debug information.

    The DMV code is now Open source with Flex 4.

  • < CLOSED > USSD / Test Mode / Debug Codes

    EDITED POST - DELETED DATA

    I'm sorry, but you can't post it here. For many of these codes can brick a phone - most of this is not intended for most users.

    Do not post similar articles.

  • Tokens signature and debugging code

    I worked on an application using Cascades. I signed the app and it loaded on my Z10 and it works very well. If I then delete the token of debugging on the phone, the application runs is no longer.

    I thought that the debugging tokens were only necessary to run unsigned applications.

    What should I do to get the application to run without a token of debugging on the phone?

    Start by importing a signed Release Build (file > export and then BlackBerry > Release Build)...

    Then in Explorer under BAR packages, right-click on your .bar file and choose BlackBerry tools > install

  • How low-level format using the code debugging?

    original title: how to low-level format using the debug code? can someone give a code

    How low-level format using the code debugging? can someone give a code

    Hi microcontrol.

    ·          What is the number and the model of the hard disk that you use?

    Your question does contain all the required information necessary for us to help you. Please provide more relevant information to continue troubleshooting as a result.

    The Microsoft article below may help if you use a disk Western Digital or Seagate.

    Using DEBUG to start formatting

    http://support.Microsoft.com/kb/60089

    I hope this helps!

    Halima S - Microsoft technical support.

  • How to start BF537 target to run independent code

    I ran debug code on my BF537 target successfully, but I'm not sure how to deploy or download the code that runs boot up w / no JTAG attachment?  I've been running in start mode 6 (TWI host slave mode).

    I tried to delete the debug Option in the compile Options and then to deploy to target.  Change the Startup Mode to 0 (external memory) & 1 (Flash memory), but that did not work?

    What Miss me?

    EDIT: I'm in LabView 2009.

    Any idea is appreciated!  In my view, this should be simple enough?

    Thank you

    Stranman,

    I'm sorry - the instructions to generate the start-up code for Blackfin processors are indeed different.  They are reproduced here:

    Programming the EZ - KIT for ADSP - BF537 Flash memory Lite

    Kevin S.

    Technical sales engineer

    National Instruments

  • Debug vs out - why should I use one over the other

    Hi all

    I have always understood that in the preparation for the final release software and delivery that this should be done using the Release configuration. It's the way that other companies offer their software, so it just makes intuitive sense to me. However, I recently came across a project developed and published all of their modules in software using the build configuration Debug, and reasoning that gave me was that it makes debugging easier when troubleshooting problems after release. Now we intend to use this software for a new project, and I don't know that I am ready to support this reasoning. Beyond reason "because I said!", there are several reasons why I think this isn't a good idea:

    1. it is slower to run debugging code. but for what we use for (drivers and utilities for the most part) it is negligible.

    2. There is a potential for malfunctions due to debug code that results in errors or be out of date.

    3. There could be differences between the debug and release configurations (no not the least of which is the use of the _CVI_DEBUG_ macro to include the additional debugging code).

    4 if I remember correctly, to debug properly, the source code must also be available; and for me, this is a big fat no-no giant for a production environment.

    So, beyond reasons I quoted above, and assuming that they are all valid, can anyone provide additional reasons for or against this practice? Any comments would be extremely helpful! Thank you!

    -Jack

    Hello Jack,.

    It is indeed surprising that the company has decided to ship built in the debug configuration.

    Here are some more reasons other debug versions offering isn't a good practice:

    1. The Debug versions are slower due to lack of optimizations.

      1. The compiler tends to optimize the code in release builds, to make it more faster and perform better on specific platforms (it can also slightly obfuscate the code).
      2. The useless instructions or data are deleted in release builds.
    2. Less memory is used by the source code when running in release builds.
    3. The Debug versions may contain debug information stored in the executable/binary file itself. This debugging information is stores the data on the source code, the names of variables and others. This allows not only the code to run more slowly, but it also exposes internal information (this can probably still provide proprietary information to your users).
    4. Debug builds usually initialize variables and data with 0. This means that programmatic errors are usually hidden by the present.
    5. Debug builds are usually (much) bigger than the trade and slower versions.

    There are other alternatives to shipped debugging binary and perform diagnostics on them:

    1. Newspapers: The embedded application can produce newspapers in the special files/folders or the Windows event log. You can also ask your customers to allow facilities to record special in your application, if the problem can be reproduced consistently and provide the log output for you, for further analysis.
    2. Dumps can be analyzed using the same map files for release builds. Crash address usually refers to a location near a function entry point, you can track your mapping files. When you build your binary files in release configuration, the compiler can also generate the map files that you need.

    In addition, as ebalci said, you must make sure that test you your Release version carefully, before shipping.

    Kind regards

    -Johannes

  • A Question about debugging...

    Hi all

    I have a question about debugging - specific probes. Is it possible to link and save the values on a wire (with a probe) which is a loop for the loop counter (or even a secondary value)?

    When I'm debugging code to a state machine that I often more easy to wire to the top of the State and the value, I am interested in a cluster, and then use 'generation antenna' and a registry change to add this element to each loop. I could also do this by indexing just out of the loop too.

    Once execution completes etc that I can look at the table (either using an indicator or a problem) to see what has happened to the value to each State/loop. And often, I know exactly where my code was wrong.

    My question is: is there a way to do this using regular probes without having to build an array? So, for example, I probe a digital wire and get a table of responses rather than just the last value on the wire?

    Thank you

    Dave

    I found this nugget that does exactly what I want - it's a custom probe developed by Darren.

    This post on the Exchange of ideas gives to think it should be at least provided with the package LV either integrated in the dev environment. Well worth voting for!

  • Debugging a dll DIAdem vc?

    Hi all

    I want to debug a vc dll which is used in the script of DIAdem. I recorded the dll in the tiara. My main goal is to debug the code for vc ++ since the tiara, once the function in the dll in vc is has occurred in the script of DIAdem. My version of diadem is 9.1 and vc is 6. I gave the application target in visual studio to be tiara and tried to run in debugging, but debugging does not have vc code.

    If someone met the same before letting me know the steps of this process. The dll that I use is a GPI extension DLL

    With respect,

    SKB

    Hello

    Thanks for the reply. These steps helped me in debugging code.  Thank you for the timely assistance.

    With respect,

    SKB

  • How detect you whether release or debug using compiler preprocessor directives?

    Hi - I want to detect if the user has set the ICB to compile standard as a release or a debug code during compilation.  Are there simple preprocessor conditionals to test this?

    Thank you

    Gareth

    Hey Gareth.

    The predefined macro _CVI_DEBUG_ will be defined for debug builds.  "" You can see the list of all macros predefined by going to Options "Compiler Options" Predefined Macros.

    NickB

    National Instruments

Maybe you are looking for

  • Where is the folk, people?

    I can't believe that there is no related folk genre for parts of radio and Apple's music playlist.  I suspended my spotify account while I am trial Apple music, but the possibility to try everything easily lists of different genres, as you can in spo

  • After the XP disk cleanup, now put into hibernation and sleep are no longer available

    Doing a cover of 'non-destructive' solved the problem!

  • Unfamiliar wireless on my PC

    I use Norton Internet Security, which has a map of network security.  I checked the details on this card and made an interesting discovery.  The map showed a Wistron Corp. wireless adapter. That said, I am not using a router at the moment.  I checked

  • WRE54G cannot connect to the configuration page

    I use WRE54G and I can't connect to the device.  I have connected to my computer via a cat5 cable, but I can always connect to the Setup page.  Right now I'm getting a solid light.  I tried to connect to the unit when it shows the kept my "no interne

  • Accuracy of lifelog

    I found lifelog is not very precise, for example, I see that I ride my bike and for real, I didn't ride my bike, etc... How fo you think about it?