Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:57:09+00:00 2026-06-07T04:57:09+00:00

assuming below table; column name | type id | int date | varchar When

  • 0

assuming below table;

column name | type
id          | int
date        | varchar

When I use

SELECT ROWNUMBER() OVER( ORDER BY TYPE_DATE ) as ROWID,
       TO_DATE( date, 'mm\dd\yyyy' ) as TYPE_DATE,
       * 
FROM TABLE

I always get below error:

SQL0104N an expected token "*" was found following .... <select_sublist>

here are three questions:

  1. Why can’t * be used here?
  2. Why can’t this new column be used in OVER()
  3. How can I get the set of second 10 records, order by a formatted column
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:57:10+00:00Added an answer on June 7, 2026 at 4:57 am

    To answer your first question, it is because you have designated additional columns, and DB2 is unable expand this * to a column list. You can fix this by adding a table identifier FROM TABLE T, and using the exposed identifier to expand the column list SELECT ..., T.*

    As you can see on this chart from the Information Center, you can only have EITHER * OR expressions and exposed-name.*

    >--+-*-----------------------------------------------+---------><
    | .-,-------------------------------------------. |   
    | V                                             | |   
    '---+-expression--+-------------------------+-+-+-'   
        |             | .-AS-.                  | |       
        |             '-+----+--new-column-name-' |       
        '-exposed-name.*--------------------------'       
    

    For two and three, the column can’t access the value of a function in the same SELECT clause by referring to it by its alias. You can push it lower into a sub-select, and then use the OVER() function. You can then get the rows you want by adding a BETWEEN:

    SELECT ROWNUMBER() OVER( ORDER BY TYPE_DATE ) as ROWID, T1.*
    FROM (
        SELECT TO_DATE( date, 'mm\dd\yyyy' ) as TYPE_DATE, T.* 
        FROM TABLE T
    ) T1
    WHERE ROWNUMBER() OVER( ORDER BY TYPE_DATE ) BETWEEN 10 AND 20
    ORDER BY TYPE_DATE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

assuming we have a table like below name | userid | score | datestamp
Assuming that I have the below customer_offer table. My question is: How to select
I have a user defined type as below: CREATE TYPE [Integer_udt] AS TABLE (
Assuming that the larger a database gets, the longer it will take to SELECT
While using the using() {} (sic) blocks as shown below, and assuming that cmd1
There is a table T that contains data as shown below: A B ---------
Assuming this table ParentId ChildId SortOrder --------------------------------- 0 1 0 1 2 1 2
Consider I have a table, like below, that I am trying to populate with
If i have a parameterized SQL statement like this: SELECT * FROM table WHERE
I have the following record definition: -record(contact, {name, email}) Assuming that I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.