Quantcast
Channel: Toad for Oracle Forum - Recent Threads
Viewing all 4385 articles
Browse latest View live

RE: Creating Unit Tests

$
0
0

it's not a DBA edition issue, it's a version issue.  This feature was added in v12.8 (about 2 years ago).


RE: Creating Unit Tests

Creating Unit Tests

RE: Line Numbers for PL/SQL code

$
0
0

Hi Tom,

it seems that when I get an email from ToadWorld, some of it is missing. I hadn't seen your questions etc after the line that mentions the WHERE clause. Strange!

Anyway, your CREATE TYPE allows you to execute the command CREATE TYPE while in your sandbox, this is not the same as defining a type in PL/SQL, so it is not going to be relevant.

The error mentions the WHERE clause, as you pointed out, so that's WHERE we need to be looking. (Pun intended!)  Once you run the code with debugging on, you will be able to see the table and columns it is processing, as well as the query it generated. I suspect that if you copy and paste the query into a Toad editor, logged in as the same user, than you may well see what's wrong if you F9 it.

Use the "format code" button in the editor when you have selected the code just pasted, to format it into something nice.

Cheers,

Norm.

RE: Line Numbers for PL/SQL code

$
0
0
Hi Norm,
 
> Try running it with debug set to y and see what query is being generated. That might give a clue.
 
I thought I had tried running it in debug mode before, without seeing anything, but I tried again this morning. It appears as if the code bombs out on a table in our DEV environment that I do not have in my test sandbox environment. Earlier, on 4/21, while discussing my modified Tom Kyte code run as an anonymous block, you made the comment:
   
“However, your observation is correct, I didn't mention that the use of UPPER() as supplied by Tom K, would result in incorrect results if and only if, your friendly local "low-life" has indeed created tables with lower or mixed case names.”
   
I think the new errors I am experiencing in our DEV environment might be a gift from our friendly local “low-life”!
To recap, the errors I observed in DEV, but not in my test sandbox, include the following:
   
ORA-00920: invalid relational operator
ORA-06512: at "APDBMS_SOR.NORMSEARCH", line 129
ORA-06512: at line 1
   
I copied the SQL statement that was generated, and formatted it. The first error I observed is located here:
 
Error1.gif
 
Not only are there mixed case column names, but this particular column includes a damn space!  Who does *&^%$# like that these days?
After fixing this error, I started getting new errors on every column that included mixed case. I can fix them one-by-one, by adding double quotes.
 
My question: Is your Normsearch procedure tolerant of the lack of proper naming conventions from friendly local low-lifes? My guess is that it may not have protections for what some idiots can do when naming columns and tables.
 
Thank You,
Tom
 

RE: Line Numbers for PL/SQL code

$
0
0

Evening Tom,

Looks like your local low-life has gone "below and beyond" anything I've ever seen or come across before, spaces in a table name, sheesh! (Insert unprintable profanity here!)

Regarding the code, I thought I'd already double quoted all the column names,  but I obviously had not. A quick fix:

Change these lines, just after the select from all_tab_columns, ...

loop

               vColumns := vColumns || ' when ' || y.column_name ||

               q'< like sys_context('userenv','client_info') then >' ||

To the following. I haven't been able to test this, I'm away from my work, desk, pc and I'm actually in bed! So please test yourself...

loop

               vColumns := vColumns || ' when "' || y.column_name ||

               q'<" like sys_context('userenv','client_info') then ">' ||

I've added a double quote just after 'when' and before the single quote, as well as adding one just after the text "q''<" at the start of the second line plus another at the end of that line, nearly. That should wrap the column names correctly with no additional spaces.

HTH.

RE: Line Numbers for PL/SQL code

$
0
0

Sorry, ignore the double quote added at the end of the second line of the loop, it's already there in the lines I didn't copy and paste. There should not a a double quote before the text >' ||.

RE: Line Numbers for PL/SQL code

$
0
0
Hi Norm,
 
I think I got your recommended changes added correctly. I ended up with this:
   
            loop
 
                vColumns:= vColumns||' when "'|| y.column_name||
            -- vColumns := vColumns || ' when ' || y.column_name ||
            -- q'< like sys_context('userenv','client_info') then >' ||
               q'<" like sys_context('userenv','client_info') then >'||
               q'< '>'|| y.column_name||q'<'>';
                vWhereClause:= vWhereClause||' or '|| y.column_name||
                               q'< like sys_context('userenv','client_info') >';
               
                if(vDebug)then
                   dbms_output.put_line('    COLUMN: '|| y.column_name);
               endif;
               
            endloop;
  
However, the script failed in my test sandbox environment, which includes a new table that only a low-life would appreciate. Here is a quickie script to create this table and insert one row:
 
CREATETABLE"Mixed Case Madness"
  (
    PROGRAM                         VARCHAR2(50BYTE),
    "PROgramTest"                   VARCHAR2(50BYTE),
    "Comments WITH fugly spaces"VARCHAR2(50BYTE)
  );
 
insertinto"Mixed Case Madness"
(PROGRAM,"PROgramTest","Comments WITH fugly spaces")
values('Hickory','Dickery','Dock');
commit;
 
select*from"Mixed Case Madness";
 
select*fromtable(normSearch.textSearch('TGW7078','Dock', pDEBUG=>'Y'));
 
 
-- drop table "Mixed Case Madness" purge;
  
   
The output of running a search with the debug switch looks like that shown below.
It looks like the column names are properly quoted in the SELECT clause, but the table name and the columns are not properly quoted in the FROM or WHERE clauses:
      
           Result1.jpg
     
   
After adding the indicated double quotes, this query runs correctly:
  
          Result1_withQuotes.gif
 
 
Tom
 

RE: Line Numbers for PL/SQL code

$
0
0
I think I got it now, using the clues you provided earlier!  Yahoo!!
  
I changed this line in the “Build the SQL” section:
  
            -- Build the SQL...
            vSQL:='select distinct '|| vColumns||
                    ' else null end cname from '|| vOwner||'."'||
                    x.table_name||'"'|| vWhereClause||')';
                    
--          vSQL := 'select distinct ' || vColumns ||
--                  ' else null end cname from ' || vOwner || '.' ||
--                  x.table_name || vWhereClause || ')';
     
   
And this line, in the loop that builds the vWhereClause statement:
  
                vWhereClause:= vWhereClause||' or"'|| y.column_name||'"'||
                               q'< like sys_context('userenv','client_info') >';
--              vWhereClause := vWhereClause || ' or ' || y.column_name ||
--                             q'< like sys_context('userenv','client_info') >';
  
    
   
In limited initial testing, it seems to work. My new "Mixed Case Madness" table did not upset the apple cart.
  
   
Tom
 

RE: Line Numbers for PL/SQL code

$
0
0

Morning Tom,

yes, that's pretty much what I did too. 

Looking at the code, mine and Tom Kyte's, there's a "feature"! If a single table has numerous columns with the same text contained, only the first will appear in the output!

For example, Oracle runs this query against my test tables:

SELECT DISTINCT
       CASE
          WHEN 1 = 0
          THEN
             'x'
          WHEN "COL_A" LIKE SYS_CONTEXT ('userenv', 'client_info')
          THEN
             'COL_A'
          WHEN "COL_B" LIKE SYS_CONTEXT ('userenv', 'client_info')
          THEN
             'COL_B'
          WHEN "COL_C" LIKE SYS_CONTEXT ('userenv', 'client_info')
          THEN
             'COL_C'
          ELSE
             NULL
       END
          cname
  FROM "NORMAN"."NORMAN"
 WHERE (   1 = 0
        OR "COL_A" LIKE SYS_CONTEXT ('userenv', 'client_info')
        OR "COL_B" LIKE SYS_CONTEXT ('userenv', 'client_info')
        OR "COL_C" LIKE SYS_CONTEXT ('userenv', 'client_info'));
So, if COL_A and COL_B have the searched for text within, the CASE statement will "short-circuit" after checking COL_A and finding a hit, so it returns only 'COL_A' as the result for this particular table. It will move on to the next table after finding a hit in one column of the current table. This can be seen in the results of running the packaged function and searching for text in bot COL_A and COL_B, all you get out of it is one row - select * from "NORMAN"."NORMAN" where "COL_A" like '%Hello%';
 
Hmmm.
 
 

RE: Line Numbers for PL/SQL code

$
0
0

Hi Norm,

In reply to your message at 27 Apr 2017 8:12 AM:

Looking at the code, mine and Tom Kyte's, there's a "feature"! If a single table has numerous columns with the same text contained, only the first will appear in the output!
  :
  :
So, if COL_A and COL_B have the searched for text within, the CASE statement will "short-circuit" after checking COL_A and finding a hit, so it returns only 'COL_A' as the result for this particular table. It will move on to the next table after finding a hit in one column of the current table. This can be seen in the results of running the packaged function and searching for text in bot COL_A and COL_B, all you get out of it is one row - select * from "NORMAN"."NORMAN" where "COL_A" like '%Hello%';

I have only found that feature with the Tom Kyte code. On the other had, your code did much better for me. Thus far, I have only found tables that include two columns with duplicate values, but your code has indeed shown two complete SQL statements, as expected. I would be willing to share the results of running your code versus the modified Tom Kyte code by private email, but I don't feel comfortable posting those results to a more public forum. I have not tested for > 2 columns duplicated, but if a database is that badly normalized, then we probably have lots of problems!

I do have one more feature creep request for you, if you are up to the challenge. [:D]

How difficult might it be to add the ability to have a new table, populated with the names of tables that you do not want to waste time searching?  For example, we have a number of tables in our production database that include names such as *_BAK, *_BACKUP, *_TMP, etc. I envision creating a query that involves the Oracle Minus operator, so that we subtract these tables from those found by searching the ALL_TABLES table.

Tom

Team coding and merge function not working

$
0
0

Testing out the team coding function and it works well except when it detects the VCS (TFS) is different that the database.  I get the dialog to review the changes, select "merge", click the changes I want to keep, select the "OK" button and then nothing gets updated.  The next time I try to edit the object I end up in the same loop of trying to merge.  Could this be due to not having the DBA model which allows for creating a "sync script" from a schema compare?

RE: 64 Bit Toad and 32 Bit Access

$
0
0

Hi, John.

Thank you so much for your help.  As you pointed out, I had the folder C:\Program Files (x86)\Common Files\microsoft shared\DAO, but I did not have the DAO folder in C:\Program Files\Common Files\Microsoft Shared.  dao360.dll is the only file in the C:\Program Files (x86)\Common Files\microsoft shared\DAO folder.

I copied C:\Program Files (x86)\Common Files\microsoft shared\DAO to C:\Program Files\Common Files\Microsoft Shared\ (still only the one file).  So now it looks like below.  I tested it, and unfortunately, the error persisted.  I also reregistered the dll in the new location (non-x86) location, and still get the error.  This is really bugging me.

I appreciate all your help.

RE: Data Grid Fetch - control limit at schema level

$
0
0

One possibility is the memory setting in Toad Options under Data Grid / Data

RE: Data Grid Fetch - control limit at schema level


Data Grid Fetch - control limit at schema level

$
0
0

Hi,

I have observed that for few schemas, the data fetch limit is 500 rows and for few schemas its 300.
I am in Toad version 12.1.0.22. I could not find parameters "Limit Grid Fetch" or "OCI Buffer Size".
Could you please help to understand where these parameters are defined and how they are differing at schema level?

Thanks,
Ayyappan

RE: Cold Folding "Fold/Unfold" all Editor Option missing?

$
0
0

Check your Toad Options in the Editor section to see if Folding is Enabled.  It may have been turned off.

Cold Folding "Fold/Unfold" all Editor Option missing?

$
0
0

I recently discovered a really handy feature in one of my code editors that enabled me to Fold/Unfold all code folds. Started looking into this in Toad and I see it was a documented feature in release 12.7 according to the 12.7 User Guide, you should be able to right click in the editor and the option would be there. Unfortunately I don't see this available in the latest release, 12.10.0.30. Was it intentionally removed or maybe now controlled with a setting that I haven't found yet? It would be really handy to have, I've been using the /*startfold*/ /*endfold*/ manual comments to work around the default folding behavior and it's very time consuming manually collapsing everything individually. Thanks in advance for any recommendations!

RE: 64 Bit Toad and 32 Bit Access

$
0
0

Ugh, I thought that was going to solve it!   Yes, just one file in that folder.   And mine has the name, size, and timestamp.  hmmm....

For what it's worth, I never registered it in either location.

RE: Row Height in Data Grid on Editor Tab

$
0
0

Right Click in the data grid and select "Reset Columns"

Viewing all 4385 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>