Alpha Video Training
Results 1 to 14 of 14

Thread: Any SQL Gurus?

  1. #1
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Any SQL Gurus?

    Hi all,
    I have an Oracle Database with around 20 tables with up to 100 columns in each. I am not allowed to link to it or copy it over and import the contents to Alpha. That's too easy!
    Is there a way - using SQL - of reading a table and finding out which columns have any data in them? I really do not care what data, just the fact that there is data present.

    To my simple mind,

    Get table
    Read column 1
    If any field in the column isn't blank write column name
    Read next column while more columns exist

    Should do it.

    I know it's a long shot and I'm trying to learn SQL but it seems a bit too superficial. Either that or I'm employing the wrong people!

    Ted

  2. #2
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Any SQL Gurus?

    Ted,
    I am not that well versed in SQL but if you are not allowed to link to the SQL table then how are you going to be able to read the table or see anything at all? Not possible in my mind. I'm thinking that this might have been a slip-up in what you actually wanted to say....maybe a rephrase would help clarify.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  3. #3
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Any SQL Gurus?

    Mike, I cannot link through Alpha, nor can I export the data from Oracle into Alpha.

    I can connect to the Oracle database through TOAD, so I'm after a SQL solution outside of the Alpha solution.

    The reason for posting the thread here is that I know a lot of the contributors have a whole ton of experience and might be able to help.

  4. #4
    Member
    Real Name
    Mark Liermann
    Join Date
    Jun 2000
    Location
    Wisconsin
    Posts
    141

    Default Re: Any SQL Gurus?

    Quote Originally Posted by Ted Giles View Post
    Mike, I cannot link through Alpha, nor can I export the data from Oracle into Alpha.

    I can connect to the Oracle database through TOAD, so I'm after a SQL solution outside of the Alpha solution.

    The reason for posting the thread here is that I know a lot of the contributors have a whole ton of experience and might be able to help.
    Do you have the ODBC driver installed for Oracle ? I believe TOAD has native support for Oracle built in. For Alpha, you will need to have an ODBC driver installed to access any databases within Oracle. See link below for the proper driver version.

    http://www.oracle.com/technology/sof...dbc/index.html

  5. #5
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Any SQL Gurus?

    This probably should have read that I am not allowed to link through to the Oracle database, nor am I allowed to import the data from Oracle to Alpha.
    That is why I need the SQL to examine the Oracle tables.
    Last edited by Ted Giles; 12-10-2008 at 11:50 AM. Reason: further info

  6. #6
    Member
    Real Name
    Mark Liermann
    Join Date
    Jun 2000
    Location
    Wisconsin
    Posts
    141

    Default Re: Any SQL Gurus?

    Quote Originally Posted by Ted Giles View Post
    This probably should have read that I am not allowed to link through to the Oracle database, nor am I allowed to import the data from Oracle to Alpha.
    That is why I need the SQL to examine the Oracle tables.
    If you are not allowed to use ODBC or OLE DB, etc., to access the Oracles tables, then it is impossible to use SQL to examine the tables. SQL relies on an established connection "link" to the database (BTW, TOAD "links" to the tables, just using a built-in driver.)

    ODBC links can be set-up as Read Only, if there are concerns about data corruption. They can also set up user credentials for you that only allow READ ACCESS....
    Last edited by sparkey; 12-10-2008 at 12:11 PM.

  7. #7
    Member
    Real Name
    Olga
    Join Date
    Jun 2008
    Posts
    94

    Default Re: Any SQL Gurus?

    Hi Ted,

    I don't know which TOAD version you are using, but latest versions usually allow to save Oracle tables contents to MS Excel files. If you are using late enough version you can save oracle tables contents as CSV files and then perform import to A5 database from them.

    Hope it can help.

    Regards,
    Olga

  8. #8
    Member
    Real Name
    mvilla25
    Join Date
    Dec 2008
    Location
    LA
    Posts
    58

    Default Re: Any SQL Gurus?

    I have SQL and Toad for SQL
    if you can send a txt or xls file, we can import to a sql table to read.

  9. #9
    Member
    Real Name
    JoAnn Ristau
    Join Date
    Jul 2001
    Location
    Texas
    Posts
    188

    Default Re: Any SQL Gurus?

    Hi Ted,
    I'm working on a script that might work for you, and will post it if I get it to work. First, are you running Oracle eBusiness Suite? Do you want to include system tables? Thanks.

  10. #10
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Any SQL Gurus?

    Thanks for this.

    Good luck. Glad you understand my problem.

    To answer the other questions, from Sparkey, all I need is the SQL to do the job. I'll sort out the connection and running the SQL later. I really don't need assistance with the ODBC.

  11. #11
    Member
    Real Name
    Mark Liermann
    Join Date
    Jun 2000
    Location
    Wisconsin
    Posts
    141

    Default Re: Any SQL Gurus?

    Quote Originally Posted by Ted Giles View Post
    Thanks for this.

    Good luck. Glad you understand my problem.

    To answer the other questions, from Sparkey, all I need is the SQL to do the job. I'll sort out the connection and running the SQL later. I really don't need assistance with the ODBC.
    I guess I didn't read your question completely. I see you are looking for a solution outside of Alpha. My bad.

    Check out http://www.w3schools.com/sql/default.asp

    SELECT * FROM Customer
    WHERE LastName IS NULL


    Look for the SQL Nulls menu item under advanced SQL for what I believe you will need.
    Last edited by sparkey; 12-10-2008 at 05:44 PM.

  12. #12
    Member
    Real Name
    JoAnn Ristau
    Join Date
    Jul 2001
    Location
    Texas
    Posts
    188

    Default Re: Any SQL Gurus?

    That will take awhile, especially if they're running EBS, since it has about 70,000 tables!

  13. #13
    "Certified" Alphaholic NoeticCC's Avatar
    Real Name
    Andrea Gill
    Join Date
    Nov 2007
    Location
    Golcar, West Yorkshire, UK
    Posts
    2,070

    Default Re: Any SQL Gurus?

    Since this is an Oracle-specific issue and has nothing to do with Alpha, you need to try and google some Oracle and pl/SQL tutorials. There may well be ways of getting listings the way you need but you'd be much better off searching resources related to Oracle.

  14. #14
    "Certified" Alphaholic
    Real Name
    Peter Wayne
    Join Date
    Apr 2000
    Posts
    1,728

    Default Re: Any SQL Gurus?

    I'm not sure I understand Ted's question, but if the question is, how to use SQL to see if a table is empty or has any data, then one solution is

    SELECT count(*) from tablename;

    which will return 0 if the table is empty, or the number of rows if the table has data.
    Is that the question?

    An alternative that might work faster is
    SELECT * from tablename WHERE rownum=1;

    which will also return nothing if the table is empty, or the first row of data if the table has anything in it. I don't have Oracle to test against so I don't know how quickly Oracle does a count(*).
    Last edited by Peter.Wayne; 12-11-2008 at 08:11 AM.

Similar Threads

  1. Many many SQL gurus help
    By jpellard in forum Web Application Server v7
    Replies: 0
    Last Post: 02-22-2007, 05:09 PM
  2. Access & FileMaker gurus -Retail Pkg
    By Jeannette Cook in forum Alpha Five Version 5
    Replies: 5
    Last Post: 10-30-2003, 06:03 PM
  3. ODBC Access - SQL 6.5 or SQL 2000
    By Dale Kromminga in forum Alpha Five Version 5
    Replies: 8
    Last Post: 10-20-2003, 01:42 PM
  4. Need an opinion from the Xdialog Gurus
    By Mario Prieto in forum Alpha Five Version 5
    Replies: 2
    Last Post: 09-01-2003, 08:39 AM
  5. Network Gurus attn:
    By Edward F. Schulz in forum Alpha Five Version 4
    Replies: 20
    Last Post: 05-31-2002, 09:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •