Given a working example in T-SQL:
SELECT *, ROW_NUMBER() OVER (ORDER BY name ) as row_id
FROM
[schemaName].[Zoo]
If I keep * selector it throws following error ORA-00923: FROM keyword not found where expected
.
Is there a way to keep * selector, and make it work in oracle pl/sql? (currently I could achieve wanted result only by mentioning all column names)
Try this:
SELECT a.*, ROW_NUMBER() OVER (ORDER BY name ) as row_id FROM schemaName.Zoo a
Here a is alias for table schemaName.Zoo. This will generate all columns from the original table, with row_id column added at the end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With