Pull All Degrees Into Table Based On Which Institution Is Selected?

Mar 26, 2013

I'm trying to pull all the degrees into a table based on which institution is selected. If institution is 'AAA' or 'BBB' then pull ACAD_PLAN, DESCR by ACAD_PROG where ACAD_PROG >= some value and <= some other value.

If institution is 'CCC' then pull ACAD_PLAN, DESCR by institution regardless of ACAD_PROG.

Something like

INSERT INTO table
SELECT
'value_a'

[Code].....

I don't have this formatted right cause it keep telling me missing keywords.

View 1 Replies


ADVERTISEMENT

Forms :: How To Populate City Based On Selected State

May 14, 2010

I'am having a query regarding population of a list item based on another selected list item that is whenever i select the state from the combo box all the city's under that state should be automatically populated.

View 4 Replies View Related

SQL & PL/SQL :: Pull In Last Loaded Data From Staging Table To Target Table?

Mar 9, 2011

I have a staging table and a target table. How do I pull in last loaded data from staging table to target table?

View 4 Replies View Related

Pull 3 Newest Articles In News Table

May 3, 2007

I need to pull the 3 newest articles in a news table. Here's a list of rows including dates:

 SQL> SELECT newsid, dateadded, ROWNUM from news ORDER BY dateadded DESC;
NEWSID DATEADDED     ROWNUM
---------- --------- ----------
        61 02-MAY-07         17
        47 01-MAY-07          9
        46 01-MAY-07          8
        45 01-MAY-07          7
        44 01-MAY-07          6
        43 01-MAY-07          5
        42 01-MAY-07         12
        41 01-MAY-07         11
 [code]....
       
This seems like such a basic thing to do.

View 6 Replies View Related

Forms :: Create View Based On Values Selected In Forms

Jun 7, 2013

I am working on a simple form which will get the user to fetch required columns of employee master.

For that i have created a form which will display the column names and select option. When user clicks on query, the form will display the selected columns in a block. After going thru if required the user can download it to excel.

As of now I do not have filtering option. For this I thought of creating view based on the selection and then fetch records from the view and display it in form.

To achieve this I would like to know How I create or replace a view dynamically based on values selected. I remember doing this sort of thing long back, but could not recollect it.

View 3 Replies View Related

Select Multiple Images Using Department Field In Spriden Table To Pull Needed Id Numbers

Jan 29, 2009

I have an Oracle 10g database, on the App Serv I have an image file that has 20,000 .jpg files that has an id number as each image name.I have successfully queryed the image file and posted one image to my web page matching the image id number.
sample:

select substr(spriden_last_name,1,20)||', '||
substr(spriden_first_name,1,20)||' '||
substr(spriden_mi,1,1) stname,
'<img src = "/images/&1..JPG" width="400" height="400"/>' pic
from spriden
where spriden_id = '&1'
/

the &1 is the matching id number that is input from the user.My task now is to select multiple images using a department field in the spriden table to pull the needed id numbers.I have not been successful in the proper format to pass the id number to the <img src field.

View 4 Replies View Related

SQL & PL/SQL :: Selected Number Of Rows From A Table

Aug 3, 2011

Can we select table's rows of 5 to 15, like

select * from emp
where rowid <=5;

It is through an error when i used the below method.

select * from emp
where rowid >=5 and rowid <=15;

View 4 Replies View Related

Forms :: How To Insert Value Of Selected Radio Button In Database Table

May 10, 2010

Suppose There are Four options in a Radio Group. From this whichever option I select using the Mouse that option must be Inserted in the Database table field.

How to do this Using Radio Buttons.

Also If I want to select more than One Option Then I use Check Box. For this Also When I select two or three options simultaneously then these values must be Inserted in the Database Table Fields.

View 1 Replies View Related

SQL & PL/SQL :: Number Casting To Pull Name

Feb 1, 2012

I have two tables. How I can cast Book Collection_ID number to Book_Name?

Select A.BookCollection_ID from Bookpart A, BookName B where A.BookPart_ID = B.BookPart_ID

OutPut
1,2

Expected OutPut
ToyBook,FunBook

We need to separate 1,2 and extract Book_NAME from Book Part table.

i.e 1 as ToyBook and 2 as FunBook ?

1.CREATE TABLE BookPart (
BookPart_ID INTEGER NOT NULL,
LIMIT_MAX VARCHAR2 (255),
BookCollection_ID INTEGER,
PRIMARY KEY (BookPart_ID )

2.CREATE TABLE BookName (
BookName_ID INTEGER NOT NULL,
BookPart_ID INTEGER,
Business_ID INTEGER,
Book_NAME VARCHAR2 (255),
PRIMARY KEY (BookName_ID )

View 17 Replies View Related

SQL & PL/SQL :: Pull Records With Specific Criteria

May 9, 2013

I want to start by saying I am brand new to SQL. I have an access database linked to my oracle and am trying to query a very specific set of data and I can't seem to narroe it down. I have 244,000 lines in the DB and I'm trying to find items on a specific trype of vendor agreement. I may have the same item on multiple agreements. ex 1-, 1a-, 2-,2a-,3-,3a-,4-,4a-,5-,5a-,6-,6a-,7-,7a-,8-,8a-.

each item by agreement is on it's own line.
ex.

item ven_agrmt_ref
233 1a-xxx
233 4-xxx
233 4a-xxx
255 4a-xxx

I need to find a way to select just items that appear on a 4- or 4a- and no other agreement reference. The query I did so far pulls all of the 4- and 4a- agreements but will also pull items,like #233 in the example above, but not showing the 1a- agreement. I need it to overlook that item eventhough it does appear on the agreement I am looking for but also has an agreement I am not. the statement I am using right now is:

SELECT item, ven_item, ven_agrmt_ref, base_cost, vendor
FROM "all items by agreement"
WHERE ven_agrmt_ref >= '4'
ORDER BY item

View 3 Replies View Related

Application Express :: Pull The Next Value From Query?

Oct 9, 2013

I am having trouble trying to pull the next value from a query based on a where clauseThe query I am using is:

Declare nextID NUMBER(22);BEGINselect lag(ref_contact_id, 1,0) OVER (ORDER BY ref_contact_id)into nextID from (select ref_contact_id,lead(ref_contact_id, 1,0) OVER (order BY ref_contact_id) as "NextNbr", lag(ref_contact_id, 1,0) OVER (order BY ref_contact_id) as "LastNbr"from (select rc.ref_contact_id from REF_CONTACT rc  order by FIRST_NAME ))where ref_contact_id = 793 ;END;  The returned value is 0.

I understand why but not how to pull the next value base on a particular ref_contact_id. 

View 1 Replies View Related

PL/SQL :: Query Pull Only Fields That Contain Data

Aug 9, 2012

In the database we use for transfer articulation, there are numerous tables delivered with the product. The institution decided not to use certain fields, and all instances of those fields have no data. In other words, there might be a field in the table called INSTCD, but no records in the table have ever inserted any data into that particular field. In the table there are thousands of records, and we don't necessarily know which of the fields have never been used (no list has been retained and no one who initially was involved in the decisions is available to ask), as there are multiple fields in each table. How can I write a query that pulls only the fields in the table that contain data. In the example below, the SHRTRIT table contains a field called ACTIVITY_DATE, but there is no data in any record in that particular field, so I don't want it to show up on the output. In this particular case, I KNOW not to pull this field in a SELECT, but in a case where there might be 130,000 records and I DON'T know if a field has records in it, how could I do that?

if the question I'm asking doesn't make sense and I'll attempt to word it better.

create table SHRTRIT
(
SBGI_CODE     VARCHAR2(6)     NOT NULL,
SBGI_DESC     VARCHAR2(10),
ACTIVITY_DATE     VARCHAR2(10)
)

[Code]....                                                                                                                                                                            

View 9 Replies View Related

Pull Status With Max-date In Case Statement?

Aug 28, 2013

I need to pull most recent status from a table with date field in the case statement.

status date
1 08/28/2013
2 05/12/2-13
3 02/11/2013

I need the status result of 1 (i.e most recent) and have to do in case statement only. Not interested in the date field in the final result.

View 1 Replies View Related

PUSH Versus PULL Tables Between Two Instances?

Oct 19, 2010

I want to move data between two instances and recommended we create a local database link to PULL data from remote database located here (supplier on site) but they want to PUSH data to us. I thought you could only PULL data over a database link but then read the link [URL] where PUSH is considered ? I was going to use standard creatas like create table A as select * from table A@<remote_db_link> which works well and fast ( tried and tested) but some are saying they think PUSH quicker/better ?

we do have data "PUSH" already but this does not use a db link - effectively it calls a local proceedure here and passes a row of data and is slow ie for a 1000 row table to be pushed to us we have our local proceedure called 1000 times.

I have always suggested a PULL with db_link as the fastest method - any proof OR info on a fast PUSH method ( that is quicker than PULL ) ? can you REALLY push ?

View 2 Replies View Related

SQL & PL/SQL :: Pull Data Into A Cursor Then Split Into 3 Different Tables?

May 3, 2010

I'm needing to pull data into a cursor, then split this data into 3 different tables, each having the same number of rows and a select number of columns from the original. i can pull the data, but then i can only access it one row at a time via FETCH, then i can't load into the 3 new CURSORS one row at a time.

View 11 Replies View Related

SQL & PL/SQL :: Prompt To Pull Year Worth Of Data

Dec 30, 2011

I am writing a query where I'd like to pull one year's worth of data. Ideally I want to prompt for the END DATE and have the query go back in time one year from that date.

Here is what I've got after doing some research online... but It's not quite working for me.

select *
from mrtcustomer.profile
where reg_type = 'B'
and contact_type = 0
and active_ind = 'Y'
[code].....

View 4 Replies View Related

SQL & PL/SQL :: Load 10 Million Rows In Table From Another Table Based On Multiple Joins

Sep 24, 2010

We have to load 10 million rows in a table from another table based on the multiple joins. How much tablespace size we allocate to the table and for performance point of view how much should be the SGA size.

View 11 Replies View Related

Forms :: How To Pull Off Report From Builder 6i Within Specific Date(s)

Sep 9, 2011

SQL Plus version Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.1.0 Production
Forms Version : 6i
Reports Version: 6i
O/S : Microsoft Windows Xp professional Version 2002 Service Pack 3

With regards to the above version description here is my query. I have a form which calls report it accepts various parameters like date between, appeal and so on . I want the report to be restricted to the date parameter as passed by the user.Here is my coding which runs report

Declare
Pl_id ParamList;
where_cond varchar2(2500);
Begin
------------Appeal------------------
if
upper(ltrim(rtrim(:appeal)))<> 'ALL' then
where_cond:= where_cond ||'and tbl_donation.appeal_code='||ltrim(rtrim(:blk_ihelp.appeal_code));
else
where_cond:= where_cond||' and tbl_donation.appeal_code is not null';
end if;

-------------Date Option----------------
if
:date_option is not null then
if
:date_option = 'BETWEEN'then
where_cond:=' and tbl_donation.donation_date between '''||ltrim(rtrim(:fdate))||''' and ''' ||ltrim(rtrim(:tdate))||'''';
else
where_cond:=' and tbl_donation.donation_date '||:date_option||''''||ltrim(rtrim(:fdate))||'''';
end if;
end if;

--------------Country-------------------
if
upper (ltrim(rtrim(:country))) <> 'ALL'then
where_cond:= where_cond||'and tbl_donation.country_code='||ltrim(rtrim(:blk_ihelp.country_code));
else
where_cond:= where_cond||'and tbl_donation.country_code is not null';
end if;

-------------Contact Code---------------
if
:contact_code is not null then
if
:contact_code = 'BETWEEN'then

[Code]....

View 1 Replies View Related

PL/SQL :: Join Between Table With User Based Content And Base Table

Jul 30, 2012

I stumbled about some weird 11gR2 behavior (running on AIX).When I performed a join between a table with user based content (parts belonging to an sourcing scope) and a base table (parts available) whereas the parts have to fulfill a special regular expression, it showed that the same query is faster when using outer join than inner join (about 0.7sec vs. 20sec; which makes me believe that regexp_like works wrong when involved in an inner join).

i tried the same statement with a standard like (but not fulfilling the same condition).This time performance was as expected (inner join outperforming outer join).

Oracle version information
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE     11.2.0.2.0     Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
[code]...

I can see it, the execution plan for the "inner join" doesn't show so much more costs than the one for the outer (but why at all is does an inner join cost more?) ...The execution plan for both "not like" is the same and (surprisingly ;-) ) similar to "outer-regexp".

I hope sample data are not needed as there would be needed a lot...this is the second time I came across the "plan worse but execution time better" phenomenon.

View 10 Replies View Related

PL/SQL :: Update Table Based On The Value Of Another Table

Apr 21, 2013

Using Oracle 11g SOE R2...

I used to have two tables to store details of PROPERTIES e.g UNIT_COMMERCIAL , UNIT_RESIDENTIAL. I need to combine both of them into one table called UNIT. I moved the data to the new table, but now I am stuck how to update the values of the child table which called MARKETING.

---

Now, I have two tables:

MARKETING (ID   NUMBER  PK , OLD_UNIT_ID NUMBER FK ...)
UNIT (NEW_ID  NUMBER  PK , OLD_UNIT_ID  NUMBER  ... )

I need to update the value of OLD_UNIT_ID in Marketing table to be equal to NEW_ID in the table of UNIT. As you can see the values of OLD_UNIT_ID in both tables are the same.

I used this statement

update ( SELECT  distinct  M.UNIT_ID , U.OLD_ID , U.ID FROM MARKETING M INNER JOIN UNIT U ON (M.UNIT_ID = U.OLD_ID))  set unit_id = idBut I got this error:

ORA-01732: data manipulation operation not legal on this view??

View 8 Replies View Related

SQL & PL/SQL :: Update Table Based On Another?

Oct 20, 2010

Actually I need update statement some thing like below scenario...

I explained my problem cleary in attached PDF since i cannot format text well here..

View 5 Replies View Related

Partitioned Table Based On Field

Nov 27, 2012

I have partitioned the table based on field.But when I am selecting by Partition or by the field I am getting Explain plan as Table Access full.I am pasting the sql and Explain Plan here. The table has two partition by BOOKING_DT_WID. One less than 20100801 and other less than 99991231.

CODESELECT * FROM WC_BOOKING_SALESREP_F WHERE BOOKING_DT_WID >= 20100801;
SELECT * FROM WC_BOOKING_SALESREP_F  PARTITION(SALESREP_LESS1_99991231);
Here is the Explain Plan for the same.
CODESELECT STATEMENT  ALL_ROWSCost: 1,501  Bytes: 293,923,641  Cardinality: 809,707                  
    4 PX COORDINATOR              
[code]....

How do I know if the sql is doing partition prune.

View 1 Replies View Related

SQL & PL/SQL :: Table Search Based On Column Value?

Aug 25, 2010

in one of the data base some of the column values are TE. i wanted to serch in what are the tables this TE values are present. so m running the below function

CREATE OR REPLACE FUNCTION find_in_schema(val VARCHAR2)
RETURN VARCHAR2 IS
v_old_table user_tab_columns.table_name%TYPE;
v_where VARCHAR2(4000);
v_first_col BOOLEAN := TRUE;

[code]....

but v_where := v_where || ' or ' || r.column_name || ' like ''%' || val || '%''' is giving me numaric or value error when i run as select find_in_schema('@TL') from dual; so how can i go ahed with the serch ?

View 2 Replies View Related

SQL & PL/SQL :: Update Based On Other Table Records?

Nov 4, 2009

CREATE TABLE "SCOTT"."SEATALLOTMENT"
("YEAR" NUMBER(4,0),
"COLLEGECODE" CHAR(4 BYTE),
"COURSECODE" CHAR(3 BYTE),

[Code].....

Now i want to UPDATE reducing the AVAILABLE column by 1 in COURSESEATS table based on common columns collegecode,coursecode for a ROW inserted into SEATALLOTMENT table ,i am confused to what approach i have to follow whether its a procedure or a trigger

CASE:

Here in this case as i insert a row with krcl,cse as college code and course code respectively into seatallotment table the available column in courseseat table for the respective row with mentioned common column must become 59 from 60

View 5 Replies View Related

SQL & PL/SQL :: Find Out Table Name Based On Column Name

Jul 28, 2011

i need an sql query or procedure to find out table name based on the column name..

View 4 Replies View Related

Update A Column Based On Another In Same Table

Apr 1, 2012

I am trying to update a column based on another column in the same table (student table) and a column from another table (school table)

Code is:

update student_table
set student_code =
(select l.student_code
from school_table l, student_table n
where l.school = n.schoolname)

I get the following error ORA - 01427 Single-row subquery returns more than one row.

View 1 Replies View Related

SQL & PL/SQL :: Partition Creation Based On Other Table Values

Feb 12, 2013

i am trying to create Procedure which will create the partitions based on the other table date values one per each day.

CREATE OR REPLACE PROCEDURE PARTITION_TEST(PART_DATE_TABLE IN VARCHAR2, TABLE_NAME IN VARCHAR2,SCHEMA_NAME IN VARCHAR2)
AS
V_PART_NM VARCHAR2(20);
V_PART_CNT NUMBER;
V_DATE DATE;
V_SCHEMA_NAME VARCHAR(15);

[Code]..

It is not creating the partitions and even not giving any errors.

View 4 Replies View Related

SQL & PL/SQL :: View With Column Based On Row Values Of Another Table

Apr 13, 2011

I have table with values :

PROV_IDMEASURE_IDPERCENTAGE
Z0000221P114 45
Z0000135P115 68

For the column all possible values are ( P102,P101,P103 etc toP124). I want to create a view ( if possible ) from the above with data output as :

PROV_ID P101 P102 P103 ............................P124
z000234 23 45 60 72

basically this view has columns based on the previous tables column ( MEASURE_ID) values and the values will be corresponding value in column Percentage.

View 2 Replies View Related

PL/SQL :: Change Table Name Dynamically Based On Parameter

May 10, 2013

I am new to PL/SQL, worked mostly on SQL server, I have to change the table name dynamically based on the parameter.and used a ref_cursor to display the results in a report. when I execute it throws me an error.

create or replace procedure test1 (
p_eod_date IN VARCHAR2,
p_link IN NUMBER,
c_rec IN OUT SYS_REFCURSOR)
[code]....

View 10 Replies View Related

PL/SQL :: Update Column Based On Sum Of Data From Another Table

Apr 17, 2013

We had two tables.

Table 1: matusetrans

ITEMNUM Location Quantity transdate
AM1324 AM1 2 12-4-12
AM1324 AM1 2 15-5-12
AM1324 AM1 3 10-6-12
AM1324 AM1 4 5-1-13

[Code]....

Table 2: Inventory

ITEMNUM STORELOC lastyear currentyear
AM1324 AM1 need sum(quantity) here need sum(quantity)
AM1324 AM2 need sum(quantity) here need sum(quantity)

We have to update the last year and current year columns with sum of quantities for each item from matusetrans table based on date at different location in Inventory table.

we had nearly 13,000 records(itemnum's with different location) in inventory table in DB we have to update entire records.

How to write an sql queries to update lastyear and currentyear columns with sum of quantities based on itemnum and location in Inventory table

Edit/Delete Message

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved