Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Variables in SELECT statement

MrGibbageFeb 19 2013 — edited Feb 19 2013
I was given a SQL query to help me develop another query that will need to do something similar. The query I was given I believe is a stored procedure. It is PL/SQL and has a SELECT statement that looks like
SELECT :var1 AS var1
FROM t1
WHERE
:var1 = 1
In the past I have seen where variables can be used in the WHERE clause like
SELECT c1 
FROM t1
WHERE
c1 = :my_column_value
and this makes sense to me. Usually :my_column_value is declared in the DECLARE block of the PL/SQL. In the query I was given, :my_column_value is not declared in any DECLARE blocks (maybe I wasn't given the entire code??). But even if it was, that would be even more confusing because in the DECLARE block it could be assigned one value and then set to another value in the WHERE clause???

The first query doesn't make sense to me and when I run it as plain SQL I get an error like "SP2-0552: Bind variable "var1" not declared. I am guessing that such a syntax is not valid for regular SQL?

The only thing I can gather that the first query does is something along the lines of

SELECT 1 as var1

so it will output a 1 for every row. Not always that interesting of a query, but it is needed sometimes, I know. But I still don't understand this type of assignment.

So what's going on here? I'd be happy to look it up and read about it myself, but I don't know what to search for. Hopefully someone here can point me in the right direction. Thanks :)

Comments

User_OOTEX

OracleExpressInstall.PNG
Will the TNS-04415: File i/o error cause the XE Database installation to hang indefinitely?
Oracle Net Services Configuration:
ProfileException: Could not save Profile: TNS-04415: File i/o error
ListenerException: Could not save listener: TNS-04415: File i/o error
ServiceAliasException: Could not save Service Alias: TNS-04415: File i/o error

Prior to my failed installation attempt the
System > System Properties > Advanced> System Variable
TNS_ADMIN
was already set to a directory that I do not have write access to.
\\AUP-USFFS02.forest.usf.edu\Azure$\IT-DM\oracle\network\admin
will this prevent the XE database from installing?
Do i need to temporarily un-set this system variable for XE to install?

User_OOTEX
Answer

un-setting the TNS_ADMIN system variable was not enough.
Manually removed the entire original failed oracle express installation by following rebellion rider's outstanding video tutorial http://www.rebellionrider.com/how-to-uninstall-oracle-database-18c-by-manish-sharma/
Delete the Environment Variable
Delete the Oracle Database 18c Windows registries
Restart Your System
Delete the Oracle Home User and Groups
Delete The Oracle Database 18c
Re-ran the Oracle Express setup.exe successfully this time. The XE database installed without further issue

Marked as Answer by User_OOTEX · Mar 10 2021
User_IRLFL

Someone has spent more than 4 hours waiting for installer finishes?
Additionally, How heavy is the installation folder? My folder is up to 15 GB and installation does not finish yet

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 19 2013
Added on Feb 19 2013
5 comments
4,367 views