How to to display entire records using PL/SQL(anoyomous block)
Hi All,
I have created a region of type PL/SQL by using rownum, and it wil display few records due to rownum.
But the end user is asking to display the rest of records also using some pagination concept or any other way.
How can we achieve this?
In mean time i have tried to execute the by removing the rownum, then it is throwing the below Query
Error- ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
Thanks,
Ano.
Edited by: Anoo on Mar 19, 2012 12:18 AM
Hi,
Here is the query we are using to dsipaly the records, but the limit we are dsiplaying is only 300.
So the concern is how we can display all records.
DECLARE
list_arr2 htmldb_application_global.vc_arr2;
p VARCHAR2(4000);
v_default_start_date DATE;
j NUMBER :=0;
occurrencies NUMBER(10);
CODESELECT VARCHAR2(7);
BEGIN
IF :P2_SYMBOL_CODE_HIDDEN IS NOT NULL THEN
CODESELECT:=:P2_SYMBOL_CODE_HIDDEN;
ELSE
CODESELECT:='';
END IF;
Select TO_char(SYSDATE-1,'MM/DD/YYYY') into v_default_start_date from Dual;
:P2_START_DATE := v_default_start_date; */
list_arr2 := htmldb_util.string_to_table (:P2_SYMBOL_NAME, ',');
p := 'SELECT SYMB_SARUS_DESCRIPTION,SYMB_CODE FROM ( '
|| 'SELECT '''' SYMB_SARUS_DESCRIPTION,''NA'' SYMB_CODE FROM DUAL ';
p := p
|| ' UNION all SELECT sym.SYMB_SARUS_DESCRIPTION || ''- '' '
|| ' || sym.SYMB_CODE SYMB_SARUS_DESCRIPTION , sym.SYMB_CODE '
|| ' from T_SYM sym ';
IF :P2_ACTIVESYMBOL='ACTIVE ONLY' THEN
p := p || ', ( SELECT distinct DSPS_SYMB_CODE FROM t_dispatch_symbol ' ||
' WHERE dsps_dsp_code IN ( SELECT adsp_dsp_code ' ||
' FROM t_aut ' ||
' WHERE adsp_vend_code=''FTP'' ' ||
')) act_symb ' ||
' WHERE sym.SYMB_CODE=act_symb.DSPS_SYMB_CODE AND ';
ELSIF :P2_ACTIVESYMBOL='INACTIVE' THEN
p := p || ', ( SELECT distinct DSPS_SYMB_CODE FROM t_dis ' ||
' WHERE dsps_dsp_code NOT IN ( SELECT adsp_dsp_code ' ||
' FROM t_aut ' ||
' WHERE adsp_vend_code=''FTP'' ' ||
')) act_symb ' ||
' WHERE sym.SYMB_CODE=act_symb.DSPS_SYMB_CODE AND ';
ELSE
p := p || ' WHERE ';
END IF;
p := p || 'UPPER(sym.SYMB_SARUS_DESCRIPTION) LIKE ';
FOR i IN 1 .. list_arr2.COUNT
LOOP
IF i = 1
THEN
p := p || ' UPPER(''%' || TRIM(list_arr2 (i)) || '%'') ';
ELSE
p :=
p
|| ' AND UPPER(SYMB_SARUS_DESCRIPTION) LIKE '
|| ' UPPER(''%'
|| TRIM(list_arr2 (i))
|| '%'') ';
END IF;
END LOOP;
p := p || ' order by 1 ) where rownum < 310 ';
p := REPLACE(p, '''||''', '||');
IF LENGTH(:P2_SYMBOL_NAME) > 2 AND :P2_HIDD = 'cdf' THEN
htp.p('<table>');
htp.p('<tr bgcolor=white><td width=20% align="left">');
htp.p('<font color="#094991" size="1"> Search By Name</font>');
htp.p('</td>');
htp.p('<td align="left">');
htp.p(APEX_ITEM.SELECT_LIST_FROM_QUERY(3,CODESELECT,p,'onChange="setSymbolCode(this.value);" size=10','NO','','','P2_SEARCHNAME','','Select'));
htp.p('</td>');
htp.p('</tr>');
htp.p('</table>');
END IF;
IF LENGTH(p)<=0 THEN
:P2_SYMBOL_CODE_HIDDEN:='';
END IF;
END;
Thanks,
Anoo.
Edited by: Anoo on Mar 19, 2012 1:10 AM
Similar Messages
-
How to handle Duplication in records using PL/SQL Code
Hi,
I have table
Table name: PM
and with fields wo_no, wo_descr, pm_no, current_date
wo_no is a Primary key.
I am enter data in this table through loop (Many records at a time), when I press a Button. Data is as under in table.
wo_no wo_descr pm_no current_date
1 cleaning the relays 2 12-DEC-04
2 calibration 3 12-DEC-04
Now the problem is that when I again press the button at second time on same time, the following data will be entered as
wo_no wo_descr pm_no current_date
3 cleaning the relays 2 12-DEC-04
4 calibration 3 12-DEC-04
So this is not required, instead of this when I press the button second time a message will appear like duplication of wo_descr, pm_no in same date
I am using form 6i, please send me the code on urgently basis.
Best Regard,
ShahzadUnique key (wo_descr + pm_no + current_date) on PM
and then control the exception WHEN_DUP_VAL_ON_INDEX -
How do I select more records using data blocks, set_block_property
Hi, I am new in oracle forms builder. I want to fetch more then one records using set_block_property and data block. please help me. How do I select more then one data? I don't have any Idea about Oracle
Please Help its urgentWhat is your Forms version? Is your form in "Form" (single record) or "Tabular" (multi-record) layout? You can't use the SET_BLOCK_PROPERTY() built-in to change the number of records that are displayed - this must be done during design through the Forms Builder.
What exactly are you needing to do?
Craig... -
How many Thunderbolt displays can I use with my MacBook Pro using Windows 7 and Parallels
Two. You can daisy-chain two ATD together. Doesn't matter what you're running.
Clinton -
Image display - How do I display an image using an absolute path?
How do I display an image using an absolute path in a compiled WebHelp?
Our developers use RH8 map IDs within our in-house applications to display in a model window created using Telerik Rad Window.
Unfortunately images disappear from these model windows because RoboHelp removes absolute links to [inserted] images and changes them to relative in the compiled WebHelp.
How do we overcome this? Is there a solution in RH8?I have tried again and changed the path in the topic HTML
from : ..\..\HelpTopics\Icon_Search.png
to : \HowDoI\Help_CMS\WebHelp\HelpTopics\Icon_Search.png
I am obviously unable to see it in RH8 as I have removed the relative link so it is "outside" of the project.
This time, on compilation, it has not stripped out the absolute links. The developer was working with me on this last week and we did have any issue in that they did not hold the absolute link. Most odd!
Checking the published help it appears to be working in the application, which is great.
So my apologies for raising the issue but it really did not work last week. -
How to avoid displaying date,time using Enhancement point.
Hi friends,
i have to work on the standard report.
stadard report displays date,time ,reportname on the top of the page. my requirement is not to display date ,time,reportname.
they have used the following code,
WRITE text-001 TO m_line+d_offset(4). " Time
WRITE sy-timlo USING EDIT MASK '__:__:__' TO m_line+d_offset(08).
WRITE text-002 TO m_line+d_offset(05). " Date
WRITE sy-datlo DD/MM/YYYY TO m_line+d_offset(10).
BY using Enhancement point how to achieve my task.
kindly help mePost Author: jsanzone
CA Forum: WebIntelligence Reporting
basham,
You didn't mention which type of DBMS you are using (i.e. Oracle, MS SQL, MySQL, etc), but in a nutshell using MS SQL here is the principle. Your time that is recorded in the records is dependent upon a setting in your RDBMS. For instance, the RDBMS can use the machine time (which would most likely be local time), or it can use the machine time with an offset (to accomodate GMT, for instance). GMT is factored differently based upon your time zone (and time of year, i.e. DST or EST, etc). I'm on the east coast so right now my offset is GMT - 5, so if my time right now is 1457, then GMT is 1957. To get SQL to compute an offset you must take the number of hours to offset and divide by 24 (24 hours in a day) and add that to the record in the database. For instance, to get GMT right now I would use:
select cast(getdate()5/24. as char(12))rtrim(convert(char(12),getdate()5/24.,8))' GMT'
Hope this helps. If you're on Oracle, then the mathematical principles remain the same, just the formatting will be different. -
Check table existence and delete entire records using Server 2005
I am trying to delete the entire record of table after confirmation of Table existence using SQL Server 2005 SP3,
query is as follows -
USE smsDB;
GO
IF (OBJECT_ID('organTable', 'U') IS NOT NULL)
BEGIN
PRINT 'Table Exists'
DELETE FROM organTable;
END
ELSE
BEGIN
PRINT 'Table not Exists'
END
GO
please help to delete the entire table records...
Pl. Mark/Proposed as Answer if found your solution Vote as Helpful if related to your topic. Always Motivate others by performing this Action.You code looks good.
Are you facing any issues? Please explain.
You can even try with truncate table...
IF (OBJECT_ID('organTable', 'U') IS NOT NULL)
BEGIN
PRINT 'Table Exists'
--DELETE FROM organTable;
Truncate Table OrganTable
END
Sir, first of all thanks for reply & giving me your valuable time,
i have learned some of the issues or dependencies with Truncate query, which are as follows -
- Are referenced by a FOREIGN KEY constraint. (You can truncate a table that has a foreign key that references itself.)
- Participate in an indexed view.
- Are published by using transactional replication or merge replication
because my tables exist some of above restrictions, please guide, is it right to use the truncate?
Pl. Mark/Proposed as Answer if found your solution Vote as Helpful if related to your topic. Always Motivate others by performing this Action. -
Question: How to remove prompt in recording using MMAPI
Hi,
we have been developing a softphone using j2me. Our goal is to record voice (using j2me) into a byte array and deliver that as a packet either through bluetooth or wifi. We need to capture voice at a certain interval, stop the capture, deliver, and then capture the voice again.
The problem is this. Everytime i call on record, the phone prompts if i indeed want to record using the MMAPI. I think that this is a security feature but is there any way to bypass it?
--Kyleprivate bool RemoveBlankPage()
Word.Application wordapp
= null;
Word.Document doc
= null;
Word.Paragraphs paragraphs=null;
try
// Start Word APllication and set it be invisible
wordapp
= new Word.Application();
wordapp.Visible
= false;
doc = wordapp.Documents.Open(wordPath);
paragraphs
= doc.Paragraphs;
foreach
(Word.Paragraph paragraph
in paragraphs)
if (paragraph.Range.Text.Trim()
== string.Empty)
paragraph.Range.Select();
wordapp.Selection.Delete();
// Save the document and close document
doc.Save();
((Word._Document)doc).Close();
// Quit the word application
((Word._Application)wordapp).Quit();
catch(Exception ex)
MessageBox.Show("Exception Occur, error message is: "+ex.Message);
return
false;
finally
// Clean up the unmanaged Word COM resources by explicitly
// call Marshal.FinalReleaseComObject on all accessor objects
if
(paragraphs != null)
Marshal.FinalReleaseComObject(paragraphs);
paragraphs
= null;
if
(doc != null)
Marshal.FinalReleaseComObject(doc);
doc
= null;
if
(wordapp != null)
Marshal.FinalReleaseComObject(wordapp);
wordapp
= null;
return
true;
This link helped me complete my project
https://code.msdn.microsoft.com/office/How-to-remove-blank-pages-e200755d -
How can one display 1 record at a time
How can one display a single record at a time.
The next record should be displayed on the press of a button.
Thanks in advanceVijaya,
I have 3 regions, each contains a check box item,
the label for which is dynamicaly generated through a SQL Select.
( &P1_ANSWER1. P1_ANSWER1 is the hidden item name)
In the Region Source,
I have put
SELECT col1 from (SELECT col1, row_number() over(ORDER BY col1) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
SELECT col3 from (SELECT col3, row_number() over(ORDER BY col3) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
for each of the reqion that contains these items,
Here the table is prototype and P1_QUESTION_NO is the hidden item.
As directed I have included under Processes (after submit and computations) on button "Next Record" clicked:
:P1_QUESTION_NO := ::P1_QUESTION_NO + 1;
When I am doing this, the label seems to blank out.
Thanks
Message was edited by:
faq123 -
How can we create info record using IDOC INFREC?
Hi Friends,
Can we create info record using IDOC INFREC. If Yes. How?
Regards,
NarendraUsing IDOC INFREC & FM IDOC_INBOUND_SINGLE
-
How can I display all records as a end user?
I am applying for jobs with the state and every week they publish a list of new positions that have just been posted on the following link: https://forms.spb.ca.gov/bulletins/weekly.cfm
and also at http://jobs.spb.ca.gov/wvpos/search_p_ejv.cfm?classcode=5393&criteria=associate%20governme ntal
It is a .cfm but only displays 15 records at a time, I was wondering if there is a tag or way to have it display all 300 something records at once? My ultimate goal is to get just the full table into a excel spreadsheet while retaining the HTML formatting so the links still work.
My thought is that the state has set it up this way to only display a set number of records at a time, the data is not private or protected, I am simply seeking a easier way to access it in aggregate.
Thank you in advance for your suggestions and help!I think your best hope is to ask the author of the CFM whether they provide any web service that can get you that data when you call it. like.
https://forms.spb.ca.gov/webservice.cfc?method=getJobsPostings&key={key_goes_here}
There's a chance they may be regulating performance on the resultset, and don't want to return that many records at a time, pagination or not. -
How to create a new record using a custom method?
Hi I want to create Jdev 11 a new record using the contructor following in the footsteps of http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3/state/content/navId.4/navSetId._/vtAnchor.CACCIJAG/vtTopicFile.adfdevguide%7Cweb_adv~htm/.
My problem is the following.
Messages for this page are listed below.
Error
JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
Error
java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
Error
Object: null is not a known entity type.
Someone can help me?
Cristian.Hello Frank, this tutorial make it and was successful but, what I am trying to do is add a new record in the table departments. The steps undertaken are suguientes
drag over page the contructor department, with a submit, this will drag on the button, the method presistencia, set binding action with "$ (bindings.Departments.result)", and when running the application gives me the error
Nov 2, 2007 10:06:22 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
WARNING: ADFc: JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
I need to know if what I am doing is right, because I followed the steps of the tutorials and it is not functioning the insertion of a new record.
Thank you thank you. -
How to open a htmlwebpage by using pl/sql?
my problem is how to open/invoke a existing webpage by using pl/sql.Because I want to do a authentication function,and write a procedure to varify the user ID and password.If they are valid,a welcome webpage can display,otherwise a eror message/webpage will be invoked.
My question is how to display the error message to the webpage or to open a webpage which display the error message by using pl/sql.I think you may be in the wrong forum, but anyways...
What I think your looking for is the htp.print('insert html here'); function. It's plsql, and writes out html to the web server that calls it.
if you search for htp.print you should find loads of examples.
hope this helps.
Merv. -
Displaying diff dates using PL/SQL expression for 'display only' item ?
Hi ,
I am having a display only item -- :P2_FROM_Date . If its Thu,Fri,Sat or Sun I want to set the date as the last Monday's date . If its Mon,Tue or Wed then it should be the present Monday's date .
E.g: Today is Friday and the last Monday was on 18th .
So for yesterday , today,tomorrow and Sunday , the date should be displayed as 18-JUN-2012.
From the coming Monday to Wednesday , the date should of be the coming Monday i.e , 24-JUN-2012
I tried it doing under 'Source ' of item using PL/SQL expression and PL/SQL function body. Not working
Can someone help ?
Thanks & Regards
UmerNice1 wrote:
declare
lv_date number;
begin
select to_char(sysdate,'D') into lv_date from dual;
if lv_date=2 then
:P2_FROM_DATE := to_char(sysdate-1);
end if;
end;I tried this under " PL/SQL function body " in "Source " tab of the item P2_FROM_DATE
When I run this , nothing is displayed corresponding to the item P2_FROM_DATEExactly as expected. This code will only set a value for <tt>P2_FROM_DATE</tt> when run on Mondays in territories where the first day of the week is Sunday, and when run on Tuesdays where Monday is the first day of of the week:
SQL> var P2_FROM_DATE varchar2(30)
SQL> alter session set nls_date_format='Dy DD-MON-YYYY';
Session altered.
SQL> select sysdate from dual
SYSDATE
Mon 25-JUN-2012
SQL> alter session set nls_territory='AMERICA';
Session altered.
SQL> declare
2 lv_date number;
3 begin
4 select to_char(sysdate,'D') into lv_date from dual;
5 if lv_date=2 then
6 :P2_FROM_DATE := to_char(sysdate-1);
7 end if;
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> print p2_from_date
P2_FROM_DATE
Sun 24-JUN-2012
SQL> alter session set nls_territory='UNITED KINGDOM';
Session altered.
SQL> exec :p2_from_date := null
SQL> declare
2 lv_date number;
3 begin
4 select to_char(sysdate,'D') into lv_date from dual;
5 if lv_date=2 then
6 :P2_FROM_DATE := to_char(sysdate-1);
7 end if;
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> print p2_from_date
P2_FROM_DATE
SQL>Hence the questions about language above.
>
I am having a display only item -- :P2_FROM_Date . If its Thu,Fri,Sat or Sun I want to set the date as the last Monday's date . If its Mon,Tue or Wed then it should be the present Monday's date .
E.g: Today is Friday and the last Monday was on 18th .
So for yesterday , today,tomorrow and Sunday , the date should be displayed as 18-JUN-2012.
From the coming Monday to Wednesday , the date should of be the coming Monday i.e , 24-JUN-2012
>
The coming Monday is 25-JUN-2012.
Aren't these rules equivalent to "Monday this week, where Monday is the first day of the week"? In which case the PL/SQL Expression you require is:
trunc(sysdate, 'iw')For example:
SQL> with t as (
2 select date '2012-06-21' + level d from dual connect by level <= 17)
3 select
4 d
5 , trunc(d, 'iw') monday
6 from
7 t;
D MONDAY
Fri 22-JUN-2012 Mon 18-JUN-2012
Sat 23-JUN-2012 Mon 18-JUN-2012
Sun 24-JUN-2012 Mon 18-JUN-2012
Mon 25-JUN-2012 Mon 25-JUN-2012
Tue 26-JUN-2012 Mon 25-JUN-2012
Wed 27-JUN-2012 Mon 25-JUN-2012
Thu 28-JUN-2012 Mon 25-JUN-2012
Fri 29-JUN-2012 Mon 25-JUN-2012
Sat 30-JUN-2012 Mon 25-JUN-2012
Sun 01-JUL-2012 Mon 25-JUN-2012
Mon 02-JUL-2012 Mon 02-JUL-2012
Tue 03-JUL-2012 Mon 02-JUL-2012
Wed 04-JUL-2012 Mon 02-JUL-2012
Thu 05-JUL-2012 Mon 02-JUL-2012
Fri 06-JUL-2012 Mon 02-JUL-2012
Sat 07-JUL-2012 Mon 02-JUL-2012
Sun 08-JUL-2012 Mon 02-JUL-2012
17 rows selected.
SQL> alter session set nls_territory='AMERICA';
Session altered.
SQL> alter session set nls_date_format='Dy DD-MON-YYYY';
Session altered.
SQL> with t as (
2 select date '2012-06-21' + level d from dual connect by level <= 17)
3 select
4 d
5 , trunc(d, 'iw') monday
6 from
7 t;
D MONDAY
Fri 22-JUN-2012 Mon 18-JUN-2012
Sat 23-JUN-2012 Mon 18-JUN-2012
Sun 24-JUN-2012 Mon 18-JUN-2012
Mon 25-JUN-2012 Mon 25-JUN-2012
Tue 26-JUN-2012 Mon 25-JUN-2012
Wed 27-JUN-2012 Mon 25-JUN-2012
Thu 28-JUN-2012 Mon 25-JUN-2012
Fri 29-JUN-2012 Mon 25-JUN-2012
Sat 30-JUN-2012 Mon 25-JUN-2012
Sun 01-JUL-2012 Mon 25-JUN-2012
Mon 02-JUL-2012 Mon 02-JUL-2012
Tue 03-JUL-2012 Mon 02-JUL-2012
Wed 04-JUL-2012 Mon 02-JUL-2012
Thu 05-JUL-2012 Mon 02-JUL-2012
Fri 06-JUL-2012 Mon 02-JUL-2012
Sat 07-JUL-2012 Mon 02-JUL-2012
Sun 08-JUL-2012 Mon 02-JUL-2012
17 rows selected.Also note that using the item source properties will only set the <tt>P2_FROM_DATE</tt> in the rendered page, not in session state. -
How to insert data in tables using loops sql
Oracle 10.2g
using Oracle sql*plus
Table student is
create table student(id)
as
select distinct student_id
from students_table;now
desc student; will retrieve
student
======
Name Null? Type
===========================
ID VARCHAR2(10)Now creating a sequence
create sequence st_seq;
alter table student add column no;
select * from student
no id
=========
234
298
This is the main part
There are 100 student id in the table
now i want to populate the table with sequences using seq.next_val
how to use a loop to insert 100 auto generated numbers in the table.
Thank you.
Expected result
Select * from student
no id
=========
1 234
2 298
.........Why i am doing this way instead of
create table student(no,id)
as
select st_se.nextval,student_id
from students;This will cause duplication of upn
using distinct would throw an error.
create table student(st_id,id)
as select distinct st_seq.nextval,academicyear
from student
as select distinct st_seq.nextval,academicyear
ERROR at line 2:
ORA-02287: sequence number not allowed hereThank you.Follow the example:
SQL> create table students_table (student_id number);
Table created.
SQL> insert into students_table values(10);
1 row created.
SQL> insert into students_table values(10);
1 row created.
SQL> insert into students_table values(20);
1 row created.
SQL> insert into students_table values(30);
1 row created.
SQL> insert into students_table values(40);
1 row created.
SQL>
SQL> commit;
Commit complete.
SQL> select *
2 from students_table;
STUDENT_ID
10
10
20
30
40
SQL> create sequence st_seq;
Sequence created.
SQL> create table student(no,id)
2 as
3 with distinct_table as
4 (
5 select distinct student_id
6 from students_table
7 order by student_id
8 )
9 select st_seq.nextval, student_id
10 from distinct_table
11 ;
Table created.
SQL> select *
2 from student;
NO ID
1 10
2 20
3 30
4 40
SQL>
Cheers,
Davide
Maybe you are looking for
-
ITunes 6.0.4(3) memory leak
I know this topic has popped up on the Windows forum, but I'd like to officially document the same problem in iTunes for OSX. Using the iStat Nano widget, I've been monitoring my memory usage when running iTunes. When I first start the program, memor
-
After installing new hard drive, I tried to reinstall acrobat standard version7. During activation I was redirected due to technology issues, whateve that means. I downloaded from web site and could not activate because serial number (from cd case)
-
Hello, I have updated to the more recent version of iPhoto 9.4.2 to see if that would correct the problem, but my Events in iPhoto refuse to merge. When attempting to drag one onto another, as I've always done, the event stays fixed, unmoveable. I t
-
Really having problems with organising documents in pages. For example, deleting pages deletes the whole section and I cannot insert a section break as its greyed out & sending an object to background deletes several pages and trying to insert a text
-
Can someone point me to the api I should look at to try and "sniff" through a .pdf file and return say the number of form fields it has?