suhinrasheed
asked on
Calling a parameterized data in Oracle query
Hi,
I have a a column in few tables which stores same data for eg.CRTD_USERNAME where I will always be storing a static value eg.'SUHIN'.But I don't want to hard code this value in my Insert script or a select script if I am using insert select columnname format.
Instead I want to store such parameter column data in a separate table and when running my Insert/Select I want to call column of that parameter table so that what ever is the parameterized data at that time maintained in my static table that data is fetched
Could you experts throw some light on how to acheive this
I have a a column in few tables which stores same data for eg.CRTD_USERNAME where I will always be storing a static value eg.'SUHIN'.But I don't want to hard code this value in my Insert script or a select script if I am using insert select columnname format.
Instead I want to store such parameter column data in a separate table and when running my Insert/Select I want to call column of that parameter table so that what ever is the parameterized data at that time maintained in my static table that data is fetched
Could you experts throw some light on how to acheive this
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Angel,
I think you didnt catch my requirement right.
I have a table named TEST1
Columns are
name
EmployeeNo
EmployerName
salary
I have table Test2
Employeeno
Name
Createduser
Creationdate
I want to do an insert like
Insert into test 2 select employeeno,name,'TESTUSER' ,'01-JAN-1 950'' from test1
But I dont want the hardcoding of TESTUSER and the date in the query instead I Want it to be parameterized in some table.
I have manyother tables Where I will be using the Createduser & Creationdate columns and for populating the latte column data in those tables i want to use a common parameter table.Tomorrow if I change the username and date I dont want to change in queries which will be the case if its hardcoded
I think you didnt catch my requirement right.
I have a table named TEST1
Columns are
name
EmployeeNo
EmployerName
salary
I have table Test2
Employeeno
Name
Createduser
Creationdate
I want to do an insert like
Insert into test 2 select employeeno,name,'TESTUSER'
But I dont want the hardcoding of TESTUSER and the date in the query instead I Want it to be parameterized in some table.
I have manyother tables Where I will be using the Createduser & Creationdate columns and for populating the latte column data in those tables i want to use a common parameter table.Tomorrow if I change the username and date I dont want to change in queries which will be the case if its hardcoded
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
that's exactly what I had also in mind, with the difference that I was not aware that you where taking the other values also from a table .
You already have a static value.
Your dat table will not store the static value... You will create a view that will be a join of data table and static table.
So every time a user selects data, he will fire select against the view only.
Having more insight into why you need to have a duplication in the data table will help to figure out better solution.
Hope this helps.
Thanks,
Jaimin Soni