PL/SQL :: Unable To Fetch And Display Records?

Aug 21, 2013

I am using Oracle 11g

The procedure is compiled without any errors.

The select statement retrieves records well when executed at SQL promt.

But the same records are not displayed in this procedure by fetch from cursor.

The last message in the procedure 'completed' is also displayed.

create or replace procedure disp_rec(vid IN varchar2, vfeat IN number)
is
cursor c1 is select gid, listagg(vindex, ',') within group (order by tid) idx from ridrecords where idarpt=vid and feattype=vfeat group by gid;
type vg is table of number;
type vi is table of varchar2(3500);

[Code]....

View 19 Replies


ADVERTISEMENT

Fetch Records In Single Select Query And Display

Mar 15, 2011

I have 3 tables, Emp(Emp_id,emp_name),dept(dept_no,dept_name),emp_dept(emp_id,dept_no). Emp tabl ehas some 20 employes id who belongs to different departments.There are few employee who belongs to multiple departments as well. I want to fetch records of emp_id, emp_name, dept_no in the following format.

Name id dept_no
Ram 101 10
20
30
Ani 201 10
20

View 1 Replies View Related

Fetch Multiple Value From A Column And Display It As A Row

Apr 19, 2011

I need to fetch the data from a particular column and display it as a row of data.

For example,

Table

Col1 col2 col3
1 6 10
1 7 11
1 8 12
2 6 18
2 7 null
2 8 19

Data should be diplayed using col 2 as partition as below

col1 col3 col3 col3
1 10 11 12
2 18 null 19

Note: I have also referred to this link [URL]....

View 1 Replies View Related

SQL & PL/SQL :: Bind Variables / Unable To Fetch Value

Sep 8, 2011

CODE
Select
Nvl(Sum(DbAmt),0), Nvl(Sum(CrAmt),0)
From FnTrantt A
Where A.GrpCode=:1 And
A.CmpCode=:2 And';
A.DiviCode=:3 And';
A.SubDiVCd=:4 And';
A.FinYear>=''0001'' And';
A.VchDate Between :5 And :6' And
A.GlCode In :7;
[code]....

In The Above mentioned Code, am using bind variables, In variable no. 7 in passing character string ('05124','05125')I am not able to fetch the value,

View 3 Replies View Related

Forms :: How To Fetch Records When Tab Page Changes

Jun 13, 2011

I have created two tab pages.when i change tab then it should be display automatically all the records in that tab without pressing any.

View 1 Replies View Related

SQL & PL/SQL :: Fetch Records Based On 2 Status

Jan 25, 2013

create table test_exp (oid number, ioid number, status varchar2(20));

Below are the insert statements.

Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 100, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 101, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 102, 'CANCELLED');
Insert into TEST_EXP (OID, IOID, STATUS) Values (2, 103, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (3, 104, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (4, 105, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (4, 106, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (5, 107, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (5, 108, 'CANCELLED');
[code]...

Now my problem is we should fetch the data based on the below rules

If an OID contains 2 IOIDs for which there is a NEW and DISCO status attached, then fetch the 2 records
If an OID has only 1 of these status, then ignore the same
If an OID has none of the 2 status, then ignore the same.

The expected output will be like below:

OID|IOID|STATUS
1 |100 |NEW
1 |101 |DISCO
4 |105 |DISCO
4 |106 |NEW

View 4 Replies View Related

PL/SQL :: Fetch Records From Employee Table

Oct 28, 2012

I am having one table Employee. Employee table having 50 records. I want to fetch 5 records every timeone the query is executed. But it should be like below.

1-5 records
6-10 records
11-15 records
16-20 records
46-50 records

Any one can give the query.

View 5 Replies View Related

Forms :: Unable To Fetch Data Using Control-blocks

Dec 24, 2010

I have created two non base table text items(from date, to date) and if values are not entered from front end i.e. null then hadrcoded in pre_query trigger to default values.But even i enter values dynamically from front end and when ever i press fetch button ,it is taking default values i.e. it is not accepting values what i have entered.

View 6 Replies View Related

SQL & PL/SQL :: Fetch Records Based On Status Priority

Dec 20, 2012

I have a table with below syntax and insert statements.

-- Table creation
-----------------------
create table order_test (oid number,
orderno number,
ordername varchar2(100),
orderstatus varchar2(50),
orderseq number);
----------------------------------
-- Insert statements

[Code]....

The Output looks like below

OID|ORDERNO|ORDERNAME|ORDERSTATUS|ORDERSEQ
1 |100 |ORD1 |INPROGRESS |1
7 |100 |ORD1 |START |4
3 |100 |ORD1 |START |2
4 |100 |ORD1 |INPROGRESS |3
6 |101 |ORD2 |CANCELLED |3
2 |101 |ORD2 |INPROGRESS |2
5 |101 |ORD2 |COMPLETE |1
8 |102 |ORD3 |COMPLETE |1
9 |103 |ORD4 |CANCELLED |1
10 |103 |ORD4 |CANCELLED |2

Now, the below rules should be applied to get the output..

1) If status is same, then fetch max(seq) record
2) If status is different, then apply below priority to fetch the records

Start - Priority 1 (High)
In Progress - Priority 2
Cancelled - Priority 3
Complete - Priority 4 (Lowest)

Means, the output for each order should look like below.

OID|ORDERNO|ORDERNAME|ORDERSTATUS|ORDERSEQ
3 |100 |ORD1 |START |2
2 |101 |ORD2 |INPROGRESS |2
8 |102 |ORD3 |COMPLETE |1
10 |103 |ORD4 |CANCELLED |2

how to do it.

View 1 Replies View Related

Client Tools :: Several Short Fetch To Retrieve Records

Dec 28, 2010

I have a big database, I want to retrieve its records in several tries; first I use "select * from dbname where rownum <1000" but for 2'th try how can I get next 1000 records but not previous records?

View 1 Replies View Related

Query To Fetch Records Between Two Dates For Fixed Timings

Sep 28, 2011

I got a issue with a query to fetch records between two dates for fixed timings

Date
From 29-09-2011 to 04-10-2011
Time
From 00:00:00hrs to 08:00:00hrs

I tried the below queries, it doesnt work
select a.detectorid,sum(b.totalvolume),a.updatetime,a.averagespeed from traffic_data a left outer join volume_data b on a.traffic_id=b.traffic_data_id
where pollinterval=1 and detectorid=�AIDC_0154� and updatetime between to_date(�29-aug-2011:00:00:00�,�DD-MON-YYYY:HH24:MI:SS�)

[code]...

View 1 Replies View Related

PL/SQL :: Query To Fetch Parent Records Only If No Child With Particular Status?

Sep 16, 2012

I need to fech parent records only when no child record with status 'N' exists. There are only two possible values for status column of child table 'Y' / 'N'.

Below are table structures and insert statements for data.

CREATE TABLE MASTER
(
COL1  NUMBER,

[Code]....

COMMIT;Query I framed is below

select * from master where exists (select null from child where child.col2 = master.col1
group by child.col2 having count(distinct col3) =1 )

Output in above case would be 3 as for 1 there's one record with status as 'N' and for 2 there's no child record. I am on 10g.

View 2 Replies View Related

SQL & PL/SQL :: Oracle 9i - Block Logic To Fetch Records From Table And Compare

Dec 26, 2011

the following proble.The emp table is having 14 records.

SELECT * FROM emp ORDER BY empno;

EMPNOENAMESALDEPTNO
7369SMITH80020
7499ALLEN160030
7521WARD125030

[code]...

The emp table is having 10 records.

SELECT * FROM emp_10 ORDER BY empno;

EMPNOENAMESALDEPTNO
7369SMITH80020
7499ALLEN160030
7521WARD125030
7566JONES200020

[code]...

I have written the following PL/SQL block logic tofetch the records from the emp table and compare the records with emp_10 table to perform insert if the records are newelse to perform update the existed records in the emp_10 table.

DECLARE
CURSOR tranche_balance_cur
IS
SELECT empno,
ename,
sal,

[code]...

Execution scenario 1:

I have commented insert and update statements in that case I got the following out put.

Inserted Records4
Updated Records10

As per the logic it's giving the correct output because the cursor is fetching 14 records in that already 10 records are existed in emp_10 tableand 4 are new records.so that it's showing the count for inserted records as 10 and updated records as 4.

Execution scenario 2:
I have uncommented insert and update statements in that case I got the following out put.

Inserted Records13
Updated Records1

As per the logic it's not giving the correct output.

I tried with using TRIM function in the comparision logic to avoid spaces.

TRIM(emp_10.empno) = TRIM(tranche_balance_rec.empno)
AND TRIM(emp_10.ename) = TRIM(tranche_balance_rec.ename)
AND TRIM(emp_10.sal) = TRIM(tranche_balance_rec.sal)
AND TRIM(emp_10.deptno) = TRIM(tranche_balance_rec.deptno)

View 10 Replies View Related

Forms :: Fetch Single Record From Multiple Records Based On Condition

Jan 27, 2012

I have made a travel booking system which comprises of 3 forms

1)Travel Booking form
2)Reservation Form
3)Cancellation Form

Under one booking number i can add multiple users in which they can have there multiple travels.

Users can cancel there individual travels under a prescribe booking number which on doing the Cancel flag turns to 'Y'.

What i want is, If a user is cancelling his/her travel under any booking number then while retriving the records in Travel Booking form, the travels which are cancelled should not be in enable mode.

For one user there can be 4 travels out of which 2 are cancelled, how can i track only those records whoes cancel flag is set to Y. some logic to find it out. Else can i use :system.cursor_record. If yes, How to use it for this system.

View 9 Replies View Related

PL/SQL :: How To Display All Records In A Table

Oct 3, 2013

how to display all the records in a table ,i am passing the table name as in param to the procedure/function suppose if i pass emp table name it will display 14 rec, if i pass dept it will display 4 records.

View 3 Replies View Related

Query To Display Records In Particular Order

Feb 8, 2007

I need to write a query to sort the records in a particular order,

Say if I group the records by Dept number
Dept no Name
10A
10G
10f

20B
20K

30I
30M
30R
30Y

I need to write a query that will make this records listed like

Dept No Name
10A
20B
30I

10G
20K
30M

10F
20null
30R

10null
20null
30Y

View 1 Replies View Related

How To Display Unmatched Records In Two Tables

Feb 28, 2008

I want to display all records from table 1 (even the null values) that do not match records in Table 2. Below I am creating both tables and I am posting the result query I need.

------------------------------------
CREATE TABLE temp_table1
(
name VARCHAR2(12 BYTE),
last_name VARCHAR2(12 BYTE),
STATE VARCHAR2(2 BYTE),
BIRTH_DATE DATE
);

CREATE TABLE temp_table2
(
name VARCHAR2(12 BYTE),
last_name VARCHAR2(12 BYTE),
STATE VARCHAR2(2 BYTE),
BIRTH_DATE DATE
);

[code].....

The result query need to have 5 rows as shown below

NAME LAST_NAME STATE BIRTH_DATE
------------ ------------ ----- ---------------------
john smith MA 12/1/1979
null null AZ null
null null CT null
null null MA null
null null CT null

View 5 Replies View Related

Forms :: Display All Records Of DB In A Table?

Dec 29, 2012

i want to display all the records of my database in a table with scrollingexample if i have 3records in my DB so a table must have 3records too !!!this is my code :

DECLARE
Cursor cur IS
SELECT numb_ph AS phone,
name_emp AS name

[code]...

but the problem 's all records of my DB are display in one record (to view another record i use the scrolling ..

View 31 Replies View Related

SQL & PL/SQL :: How To Display Data Without Duplicate Records

Nov 16, 2011

how to display the data which is shown below without duplicate records in compid and compname and all policy_id's should be there while excuting this query iam getting this data.

select distinct comp_id as compid,
comp_disp_name as company,
plcy_id as policyid,

[Code]....

output
-----------------
compid compname policy_id policy_name

19734 Save the Children 9013 GPA
19734 Save the Children 9012 GMC
20097 JMT 9486 GTL
10890 Steelco Gujarat Ltd. 9727 CAR
17330 Golden Jubilee Hotels Limited 8915 CGL
23117 NBHC 9093 GMC
17542 Heinz India 10693 Fire
19821 KSK Fabricators 10341 D&O
3769 Jones Lang Lasalle India 9199 WC
19821 KSK Fabricators 10340 WC

View 10 Replies View Related

Forms :: Before / While Changing - Display All Records?

Jun 22, 2011

I have created two tabs tab1 & tab2. after changed(not while changing/before changing)) into tab2 all records should be display.

I have written execute_query in when-tab-page-changed.but that is before/while changing.i want after entered in tab2 it should be display.

View 1 Replies View Related

Forms :: Display Records Of Two Tables In One Form

Mar 27, 2013

want to display records of two tables in in one form.I have 2 tables. tab1 and tab2

columns in tab1 are code, desc, part, onhand_qty AND
columns in tab2 are code, room_no, row_no, rack, shelf, qty, remarks.

Common column in both the tables is code.

i want to display all the columns of both the tables where tab1.code=tab2.code ,and tab1.onhand_qty is not equal to SUM of tab2.qty

View 1 Replies View Related

SQL & PL/SQL :: Display The Records Of Financial Year Wise?

Jul 20, 2011

i hav the following records i need to display the records of financial year wise (i.e april year-1 to mar year) here there are no records for months 9,10(september and october)

what i want is 0 to be displayed over there in the below table

s.no key id yyyymm ce1 ce2 ce3 t ihu pf mi pwd F
920110600000156431372010043424541500065457709539XXXXXXXXXXU
10201106000001565313720100534245415000009539XXXXXXXXXXU
11201106000001566313720100634245415000009539XXXXXXXXXXU
12201106000001567313720100738555415000009539XXXXXXXXXXU
13201106000001568313720100836445415000009539XXXXXXXXXXU
1420110600000157131372010110000009539XXXXXXXXXXU
15201106000001572313720101276881082200001888009539XXXXXXXXXXU
1620110600000157331372011010000009539XXXXXXXXXXU

View 2 Replies View Related

Performance Tuning :: Display All Records From TAB_ONE

Jul 8, 2010

My query formation is like below..

*Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi*

SELECT T1.COL1,T1.COL2,
T1.COL3,T2.COL2,
T3.COL1,T3.COL2,
T4.COL1,T4.COL3,
<CASE statements and calculations results - Some Amount1>,
<CASE statements and calculations results - Some Amount2>
[code]..........

First I need to display all the records from TAB_ONE which contains more than 10million records. If you see there are columns like AMOUNT_ONE,AMOUNT_TWO which has got some complex calculations and that is based on some other calculations and which in turn and goes on.... Like this I have some ten amount columns. Finally these records has to be inserted into a new table.

To get this I have written nested inline queries to calculate these AMOUNT columns but since considering the huge amount of records, it takes more than 8 hours for inserting this into a new table.

View 7 Replies View Related

Forms :: Unable To Display A Message When Record Status Is Changed?

Jun 2, 2010

I have one requirement.i.e I want to display 'Do you want to save the changes you have made?[YES/NO]' message when record status is changed.In my form if i enter some value to the actual qty(db item) and press 'x' button it does't prompting 'Do you want to save the changes you have made?' message.

For displaying this message i have written following code in the APP_CUSTOM body:

IF (wnd = 'XXMZ_MRS_DET')
THEN
lv_wnd_stat := get_window_property('XXMZ_SUMMARY',VISIBLE);
if lv_wnd_stat = 'TRUE' THEN
IF :SYSTEM.form_status = 'CHANGED' THEN
CLEAR_BLOCK(ASK_COMMIT);
ELSE

[code]....

if i write above code in the app_custom body it's prompting the above message.But if i click 'YES' it does't save the records?

How can i save the records when i click 'yes'?

View 3 Replies View Related

Forms :: ORA-24374 / Define Not Done Before Fetch Or Execute And Fetch

Mar 24, 2011

FRM-40501: ORACLE error: unable to reserve record for update or delete.

ORA-24374: define not done before fetch or execute and fetch

My master-detail form has single canvas. For both blocks, master and detail, two tables joined together in each. One table to be updated, second table has some info for reference (query only).

I am getting these errors when in detail block the item from LOV is selected for existing record. This does not happen for new record inserted in detail block.

View 1 Replies View Related

OO4O And Wizards :: How To Fetch Columns In Cursor Using FETCH

Nov 1, 2012

create or replace PROCEDURE newprocedur(outname OUT VARCHAR2,outroll OUT NUMBER) AS

CURSOR c1 IS
select Name,Rollno,Section from emp;
BEGIN
Open c1;
fetch c1 into outname,outroll;

Here out of 3 columns in cursor is it possible to fetch only two columns using FETCH like i did above?

View 1 Replies View Related

Forms :: Display All Records One By One As User Click On Next Record Button

Jul 13, 2010

I have created one tab canvased form

On first tab I am taking input (search criteria)
on that input i am trying to display all records one by one as user click on next record button....

for that i used when-tab-page-change trigger for first record display and it display correctly.but for further record what should i need to write on next_record command button so all record i can see one by one.

View 1 Replies View Related

Forms :: Unable To Insert Records

Oct 7, 2012

I am getting this error FRM 40508 in inserting data to any table through forms 11g.

eg:

my test table having two columns : id and name

i wrote a simple insert statement insert into test values (:id, :name);
commit;

when i run the application and insert the values, it shows the above error.

when I use the display errors , it shows that there is a violation : ora - 00001 (duplicate values)

however, there is no such value in the database.

The same scenario is repeating with every table I have.

I thing more, when I use the commit_form only without using any manual insert statement, then everything goes well. But with manual insert it all fails.

View 3 Replies View Related

Forms :: Display Checkbox Selected Records In One Column Of Form / When Push Button Is Pressed

Jul 2, 2011

how to display check box selected records in one column of form when push button is pressed.

View 1 Replies View Related

Forms :: Unable To Insert Checkbox Checked Records?

May 23, 2011

I have a multi-record block with a check box(:B_ASTHEAD.CB_CHECK) for each record. user can select the record by clicking on the check box. when checked, value is 'Y' and when unchecked, value is 'N'.

when user clicks on 'OK' button (when button pressed trigger), the records which are selected(Checkbox) must be posted to the database table.

L_last_Rec number;
L_first_Rec number;
L_AST COP_DETL.AST%TYPE;
BEGIN

[Code]....

The issue here is , check box selected records are not getting inserted into table when OK button is clicked and i could see that all checked checkboxes become unchecked immediately . But if i comment the --"if :B_ASTHEAD.CB_CHECK = 'Y' then " part, then insert works , but inserts all record.

Insert only checkbox selected records.

View 11 Replies View Related







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