Adding Description On Lookup Table?
Aug 17, 2012Ive got a look up table and i want it to display text instead of just the ID number, how would i do that? so for example if
1 = Hello
2 = Bye
it would display "Hello" instead of "1"
Ive got a look up table and i want it to display text instead of just the ID number, how would i do that? so for example if
1 = Hello
2 = Bye
it would display "Hello" instead of "1"
I have 2 tables, TABLE1 AND LOOKUP_TABLE. The requirement is to insert the distinct (AREA,CITY) from
TABLE1 into LOOKUP_TABLE, where LOOKUP_TABLE.LOOKUP_ID = LOOKUP_SEQ.NEXTVAL;
-- Test Case
DROP SEQUENCE lookup_seq;
CREATE SEQUENCE lookup_seq START WITH 1;
DROP TABLE table1;
CREATE TABLE table1
[code]...
Expected data in LOOKUP_TABLE
LOOKUP_ID AREA CITY
--------- --------- -------
1 area1 city1
2 area2 city2
3 area3 city3
4 area4 city4
5 area5 city5
Currently this is what I'm doing.
INSERT INTO lookup_table SELECT sl_no, area, city FROM table1;
DELETE FROM
lookup_table a
WHERE
[code]...
Is there a better way of doing this, using a single insert statement?
I have two tables:
create table units (id number primary key , agent number,
constraint agnent_fk foreign key (agent) references agent_lookup (id) )create table agent_lookup (id number primary key , agent_name varchar2 (40))INSERT INTO AGENT_LOOKUP (ID, AGENT_NAME) VALUES (1, 'X1');
INSERT INTO AGENT_LOOKUP (ID, AGENT_NAME) VALUES (2, 'X2');
INSERT INTO AGENT_LOOKUP (ID, AGENT_NAME) VALUES (3, 'X3');INSERT INTO UNITS (ID, AGENT) VALUES (100, 1);
INSERT INTO UNITS (ID, AGENT) VALUES (101, 2);
INSERT INTO UNITS (ID, AGENT) VALUES (102, 3);I want to make units table uses user_lookup table instead of agent_lookup table; where user_lookup contains the same names that exist on agent_lookup, but with different IDs.
create table user_lookup ( id number primary key , user_name varchar2 (40))INSERT INTO USER_LOOKUP (ID, USER_NAME) VALUES (10, 'X1');
INSERT INTO USER_LOOKUP (ID, USER_NAME) VALUES (20, 'X2');
INSERT INTO USER_LOOKUP (ID, USER_NAME) VALUES (30, 'X3');So, I need to update the table units and SET the value of Agent to the ID column of the user_lookup table .
I thought of this, but sure it will not work:
update units ut set ut.agent = (select u.id from user_lookup u where agent_lookup.agent_name = u.user_name )
where ut.agent = agent_lookup.id
i need to get values from lookup table dynamically,i am getting the missing keyword error.
create or replace procedure xyz(cur1 OUT SYS_REFCURSOR)
AS
vsql varchar2(2000);
CURSOR CURSOR1 is SELECT DQS_SRC_COL_NM,LDIC_SEQUENCE FROM look_up WHERE LDIC_SOR ='friend';
BEGIN
[code]....
I've been successfully setting up text indexes on multiple columns on the same table (using MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a one-to-many data collection table (with a FK to a lookup table), and I need to search columns across both of these tables. Sample code below, more of my chattering after the code block:
CREATE TABLE SUBMISSION
( SUBMISSION_ID NUMBER(10) NOT NULL,
SUBMISSION_NAME VARCHAR2(100) NOT NULL
);
CREATE TABLE ADVISOR_TYPE
[code]...
I've looked at DETAIL_DATASTORE and USER_DATASTORE, but the examples in Oracle Docs for DETAIL_DATASTORE leave me a little bit perplexed. It seems like this should be pretty straightforward. I'm trying to avoid creating new columns, and keeping the trigger adjustments to a minimum.
for functions like SDO_GEOM.RELATE, do the return values like "COVEREDBY", are those values/definitions defined in the database somewhere? For instance a table containing all the values and a description of each?
View 4 Replies View RelatedI use APEX 4.2.0. In Tabular form, I have column of Select list type. This list has too many values and the end user must choose all these values along the tabular form rows. In other words, If the LOV consists of X, Y , Z, The End user should add three rows and choose a unique value for each row.
The problem is : This LOV is supposed to have too many values. What comes to mind is:
1- Whenever the end user picks a value, this value should disappear from the LOV of the second row ? But I have no clue how to do it?
OR
2- Whenever the end use picks a value, I should notify him/her about the remaining values that he should pick . But I have no clue how to do it ?
At the end the purpose is to make the user aware that he still has some rows to add ( values to choose ... )
I simplified the issue in simple example here:
[URL]......
workspace: somefeto
user: test
pwd: test
I created a table but I want to add the Unique check to it as I forgot to apply it to the table when I created it.Is it possible to make the field Unique after having created the table or do I have to drop the table and re-create it?
View 3 Replies View RelatedI want to add column to table which has huge amount of data and fill with data from another table. What is the best way to do it? Is it faster to use CTAS instead of ALTER TABLE ADD COLUMN?
View 2 Replies View RelatedI want to have sum of Time Stamp Values in a Table. i.e. Group by Query
example : Select Name, Sum(Timestamp column) from Emp group by name;
OR
I have Time values in character column of a table. i.e. Table TT column t1 char(5) values '03:02'
Above mentioned values in more than one line, i want to get the sum of all the values and it should be a time value.
How can I create a calculated field in one sheet to lookup a corresponding value in another sheet?
e.g. I have a person ID in one worksheet, and I want to look up the email address from a matching Person ID in another worksheet
Ive got loads of new entries that need to be entered into a table if they're not in there already.
Is there a quick way of doing this rather than having to add the entries manually using some kind of tool rather than using manual sql statements(would take a very long time since theres 800 new entries).?
I have requirement on table type. without using bulk or %rowtype is there any possible to create table type with two or more columns.
I got with single column,but I am unable to create with multiple columns.
DECLARE
TYPE T1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
T T1;
CNT NUMBER:=0;
BEGIN
FOR I IN 1..100 LOOP
CNT:=CNT+1;
[code]....
below query.
1) How to add a new column to the existing table's particular position, instead of atlast.
2) I created a table without mentioned the datatype size as below Create table dummy (name char, age number). Then what is the default size will be allocated for those column's?
are there a table/view that lists all process with description like the DICT does for the data dictionary views?
I wanna know for example the description of J001 or Q001 process for example.
I am looking for oracle query to replace repeating description with -DO-. Sample Data is:
CREATE TABLE SCOTT.ITAX
(
VDATE DATE,
[Code].....
VDATE DESCRIPTION ITAX AMOUNT
--------- -------------------------------------------------- ---------- ----------
14-NOV-12 CANOLA OIL 3 3500
25-NOV-12 CANOLA OIL 3 2500
10-DEC-12 CANOLA OIL 3 3300
01-NOV-12 CANOLA SEES 3 5600
10-NOV-12 CANOLA SEES 3 5500
01-DEC-12 CANOLA SEES 3 5400
6 rows selected.
Required Output is:
VDATE DESCRIPTION ITAX AMOUNT
--------- -------------------------------------------------- ---------- ----------
14-NOV-12 CANOLA OIL 3 3500
25-NOV-12 -DO- 3 2500
10-DEC-12 -DO- 3 3300
01-NOV-12 CANOLA SEES 3 5600
10-NOV-12 -DO- 3 5500
01-DEC-12 -DO- 3 5400
i have created a table called table2,with only one column as text,
SQL> select regexp_replace(text,'[:]',chr(10)) text from table2;
TEXT
--------------------------------------------------------------------------------
1
amar
11-jan-2011
15000
2
manju
22-feb-2011
20000
and i have to get output like this,
TEXT
--------------------------------------------------------------------------------
ID
1
NAME
amar
DATEOFJOINING
11-jan-2011
SALARY
150000
is it possible to get output like above?
I have two tables emp and dept
sql>select emp_id from emp;
emp_id
------
123
345
6782
32
[code].....
I would like to search all the employee id's which are present in description column of dept.
My Query is :
select id,descr,application from release
the above query fetches records as
1 testing D
2 upload H
i have to display my third column with full description which is stored in another table as select descr from app where code = application; I have to display this descr in the above result set instead of D,H.
how to provide the description and parameters of job which calls package on database
package name is some 'xxxxx'
we need to find the job which call the package 'xxxxxx'.
I have created ".sql" script in Unix and I am trying to execute the script at SQL prompt. But I am getting the following error message after getting the output.
ORA-02019: connection description for remote database not found
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.3.0 - 64bit Production With the Partitioning, OLAP and Data Mining options
I created database link from bala1 database of bala user with the following command.
CREATE DATABASE LINK maddy CONNECT TO P10 IDENTIFIED BY secret554
USING 'MADDY.WORLD';
my aim is to create a dblink to access 'maddy' database objects from bala1 database.
I gave select * from v$database@MADDY.WORLD in bala user and it throwed error.
ORA-02019: connection description for remote database not found
i want to create a new partition for version 2
existing table is as below
create table test
(
name varchar2(100),
version NUMBER(12)
)
[Code]....
I am having the following table and values.
A | B
=====
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
I need an output in following
A | B | C
=========
1 | 1 |
2 | 2 | 3 --> 1+2
3 | 3 | 6 --> 3+3
4 | 4 | 10 --> 6+4
5 | 5 | 15 --> 10+5
I mean add the first row of column b with second row of column ==> this output need to show in column c
again this output need to add with third row of column b .......
any sql commands / keywords for this
how do I add a column to an existing table which when rows are added to the table this column will have the same default value?
alter table thetable add (new_column_name varchar2(100) default bbubu);
I've been trying to write some code to add a column if it does not exist as the code will be run numerous times and will be parameterized in other software to run across multiple tables.
Here is what I have made so far:
DECLARE
COLEXISTS integer;
vCmdStr varchar2(4000);
[Code]....
I can't figure out where the invalid character is.
I have a table with zip codes and their plus four values. For ex: zip code of 10000, which has corresponding plus four values of 001, 002, 003, and 008, 009, 010. The issue is just that--a zip code can have sequential plus four values, and then it will skip several potential plus four values, and then start again. I would like to assign a low plus 4 value and high plus four value to a zip code, keeping in mind that the plus four values are not always sequential. So, it would be similar to this:
zip plus4 low plus4 high
10000 001 003
10000 008 010
I had created a table which have 100s' of entries in it.
create table reg_user
(
USERNAME VARCHAR2(50),
PASSWORD VARCHAR2(20)
)
***
[Code]..
1. In this table, how to update the Nth row, how can I do it
2. Now I need to add USERID in this table,which will get value from 1 to max no. of rows. I do not want to drop the table and again re create it adding USERID or update each row manually. Is there any other way to add USERID and have IDs from 1 to max IDs.
I have DB on cluster and it set to active/active. ASM disk currently using raw device and connect to SAN storage. So i want to add new ASM disk on current environment.
Does oracle have this doc? What i can see from their said just show adding new ASM to new installation. Does it same as adding new ASM disk to current system? Does it success on implementation?
select bill_no from bill_mst is showing 25 records.
select bill_no from bill_mst order by 1 is showing 5 records.