Date of entry into procedure statement
Hi all.a DVICE me please what is the error in this statement 'a' in this procedure. the procedure to obtain the name of the table and date from the user and execute it.
I think that my error for the format of the date in a statement. So, please give me the correction if you can.
CREATE OR REPLACE PROCEDURE sp (table_name in varchar2, date_begin to date DEFAULT null)
is
type bulk_collect is table of index varchar2 (1000) by PLS_INTEGER;
v_bluk1 bulk_collect;
v_bluk2 bulk_collect;
a varchar2 (300);
c varchar2 (30);
Start
c: = table_name;
r: = ' select rowid, id of ' | c | ' where date_of_ins > = ' | to_date(date_begin,'''dd/mm/yyyy''');
immediately run a bulk collect into v_bluk1, v_bluk2;
b in v_bluk1.first... loop v_bluk1. Last
dbms_output.put_line (v_bluk1 (b));
end loop;
end;
/
SQL > exec sp ('emp', to_date (' 1/2/2006 ',' dd/mm/yyyy'));
START sp ('emp', to_date (' 1/2/2006 ',' dd/mm/yyyy')); END;
*
ERROR on line 1:
ORA-00904: "FEB": invalid identifier
ORA-06512: in the 'END. "SP", line 13
ORA-06512: at line 1
Published by: Isabelle Sep 8, 2012 11:23
Change according to your need...
bkd@Oracle>ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE sp(table_name in varchar2,dt IN date)
2 is
3 type bulk_collect is table of varchar2(1000) index by PLS_INTEGER;
4 v_bluk1 bulk_collect;
5 v_bluk2 bulk_collect;
6 a varchar2(1000);
7 begin
8 a:= 'select last_name from '|| table_name ||' where hire_date <= :dt';
9 dbms_output.put_line (a);
10 execute immediate a bulk collect into v_bluk1 using dt;
11 dbms_output.put_line (a);
12 for b in 1..v_bluk1.count loop
13 dbms_output.put_line (v_bluk1(b));
14 end loop;
15* end;
bkd@Oracle>/
Procedure created.
bkd@Oracle>exec sp('employees',to_date('01/02/2012','dd/mm/yyyy'));
select last_name from employees where hire_date <= :dt
select last_name from employees where hire_date <= :dt
OConnell
Grant
Whalen
Hartstein
Fay
Concerning
Biju
Published by: biju2012 on Sep 9, 2012 12:47 AM
Correction: Replace for b in v_bluk1.first... v_bluk1. Last loop b loop 1.v_bluk1.count
Tags: Database
Similar Questions
-
Need help get data with the most recent date of entry into
Hey guys;
I need help with fine tuning a query to get the one with the most recent implementation.
Here's my current query:
/**********************************************
Select sge.seal_group_id,
SGE.equipment_id,
SGE.effective_date
of seal_group_equipment EMS.
seal_group sg
where equipment_id = 48801
AND EMS. SEAL_GROUP_ID = SG. SEAL_GROUP_ID
and sge.end_date is null
Group of sge.equipment_id, sge.seal_group_id, sge.effective_date
After having sge.effective_date = max (sge.effective_date)
******************************************************/
Which produces the following results:
SEAL_GROUP_ID - EQUIPMENT_ID - EFFECTIVE_DATE
25-48801 - 01/01/1993-00: 00:00
11730-48801 - 22/08/2003 08:42:11
What I really need, is to show only the line with the most recent date of entry into
I hope someone can help
Thank youMAX will not work because the SEAL_GROUP_ID could depart. I would say analytical:
select seal_group_id, equipment_id, effective_date from ( select sge.seal_group_id, sge.equipment_id, sge.effective_date, RANK() over (partition by equipment_id order by effective_date desc) r from seal_group_equipment sge, seal_group sg where equipment_id = 48801 AND SGE.SEAL_GROUP_ID = SG.SEAL_GROUP_ID and sge.end_date is null) where r = 1;
Keep in mind if two records have the same effective_date, they would both appear.
Note: query above has not been tested, since there is no script provided.
-
How to convert the Dates of entry into ReminderInfo in observed activity!
Hello
We read the Date and time of the reminder of the user via the form. We want to link this entry date and time with ReminderInfo data type to set
Reminders in activity Task Assign.
Please find the ppt for more information.
Please help us in this regard.
Thank you
Praveen
Drag a SetValue component and add assignments (see the screenshot to the assignment)
Repeat the same thing for hours and minutes
Nith
-
Date of entry into monthly intervals
Hello
How could I do a count by month but from a certain date.
I want to count the number of decreases from. So count on Jan 14, then another month to Feb. 14, March 14 etc...
Jan - 14 Feb - 14 Mar - 14 Apr - 14 -14 may Jun - 14 Jul - 14 Aug - 14 Sep - 14 50 120 30 etc. example:
SELECT COUNT (*), - the MONTH of
TABLE
Group by MONTH
Hello
Chloe_19 wrote:
Hello
How could I do a count by month but from a certain date.
I want to count the number of decreases from. So count on Jan 14, then another month to Feb. 14, March 14 etc...
Jan - 14 Feb - 14 Mar - 14 Apr - 14 -14 may Jun - 14 Jul - 14 Aug - 14 Sep - 14 50 120 30 etc. example:
SELECT COUNT (*), - the MONTH of
TABLE
Group by MONTH
To map all the dates in a calendar month with a common value, use TRUNC (d, 'MONTH').
However, grouping which will produce a separate line for each month, not a separate column as you asked. For the different columns for different months, use SELECT... PIVOT, like this:
WITH relevant_data AS
(
SELECT TRUNC (MONTHS_BETWEEN (hiredate, DATE ' 1981-01-01')) + 1 AS month_num
FROM scott.emp
)
SELECT *.
OF relevant_data
PIVOT (COUNT (*)
FOR month_num IN (1 AS jan_1981
2 UNDER feb_1981
-- ...
12 AS dec_1981
)
)
;
Fill in the other months should be easy.
Output:
JAN_1981 FEB_1981 DEC_1981
---------- ---------- ----------
0 2 2
For more info on swivel (including other ways besides SELECT... See the FAQ of the PIVOT forum): Re: 4. How can I convert rows to columns?
-
Cannot turn off the field from the date of entry into application workflow
Hello
We implement the workflow application in OIM11g.
We use application templates to achieve this.
We want to disable or remove the field from the effective date in the rationale page that appears when we raise a request. Did one of you has implemented or came across this scenario. Please update if you have an idea about that.
Thank youThe property system will remove the entire page of the process, including the justification box.
-Kevin
-
Date of entry into french? Possible?
Hello
I want to create a label that indicates the date:
{" < mx:Label text =" {}df.format (new Date ())}" / > "
" < mx:DateFormatter formatString ="EEEE DD MMMM YYYY - HH"id =""" df / >
Then it works fine. But how to put french? Possible? : s
Thank you very much!
Chandler
Took too long to respond...
As I said in the previous message, use copylocale.exe in the folder "Applications/Adobe Flex Builder 3/sdks/3.2.0/bin/" command line to create the directories en_US missing.
-
Hi all
using the... 10 gr 2
I have the following in a sql query
I need replace the date format DD-MM-YYYY in the sql above... When I tried the to_date('12-31-9999','MM-DD-YYYY') it throws errorLEAD(data_date, 1, DATE '9999-12-31') OVER (PARTITION BY route_id ORDER BY data_date) AS next_data_date
Grateful for your help!
Thanks in advance
HIt is a fixed format, and you should not have to change this part.
"The date literal ANSI does not contain any portion of time and must be specified in exactly this format ("YYYY-MM-DD'). " You can also specify a date value Oracle... »
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/sql_elements003.htm#sthref365 -
Date of entry into title of report output
Hi all, I know that in BEEP you can insert the current date in the title of the report when a report is sent via FTP. Example my_file_%y%m%d.txt. In our database environment is always a day behind... so we need %d is essentially %d - 1. Does anyone have a creative solution to get around this?
Thank you!If you use the break-up, you can decide on the name of the file.
You use the burst, in that query, you can create your template file name. -
I have a date I want to display in a text control.
I have no problem to display it in the use of English
< mx:DateFormatter id = 'dateFormatter' formatString = "EEEE D MMMM YYYY" / >
and
< mx:Text text = "{dateFormatter.format (mydate)}" / > "
I got: Wednesday, July 11, 2007
But how can I do the same in french: Wednesday, July 11, 2007
Thanks for help
EtienneThere is a DateBase class that contains the messages localized to date in Flex, you can set the values of the DateBase trainer, like this: (this example is in Spanish)
Import mx.formatters.DateBase;
public function setDateBase (): void {}
DateBase.monthNamesLong = ['Dom', "Lun", "Mar", "First", "Game", "Vier", "Sab"];
DateBase.monthNamesShort = ["Ene", "Feb", "Mar", "Apr", "may", "Jun", "Jul", "There is", "Sep", "Oct", "Nov", "Dic"];
}By doing this, you can set whatever string you want and objects Date, appear in your case, you just need define the days, the months in french and made.
More information about the values that you can set:
http://livedocs.Adobe.com/Flex/2/langref/MX/formatters/DateBase.html -
Hello
I'm the problem by entering the date in submitted text (this is the data type is date)
After that date to conclude this textfield cursor does not move to the next textfield.
If I make the data type of this field as a number and then the cursor moves to the next field
What is the problem
Thank you
~ ACEnter the date according to the format of the field mask.
for example. If the format mask 'DD-MON-RR' is then enter data in 4 December 08 ' -
a loop data and insert into another table fail
HI EVEYONE,
I'm new in PL/SQL and apply to develop, which I intend to extract data from PDF directly to the oracle database by looking at its difficulty that I changed the approach of the first extraction of my data to flat file and then convert Excel CSV format that makes it easier for me to handle in my oracle database.
The challenge I'm having here is that
The column id_number is a mixture of 3 identifications
One for the facility, which has the form (YEAR/0145)
The second is for participant with the form (* 01934764 *)
And the last identification is for dependants with the form (0, 1, 2, 3, 4, 5)
As shown below
ID_Number status name
YEAR/0145
* 01934764 * MUOKA
MUOKA main 0
1 joint MUOKA
Child2 3 MUOKA
* 01934769 * TSILIA
JOEL main 0
1 joint TSILIA
2 Child1 TSILIA
3 Child2 TSILIA
4 Child3 TSILIA
5 child4 TSILIA
* 02216419 * OKOLO
OKOLO main 0
1 joint OKOLO
2 Child1 OKOLO
3 Child2 OKOLO
4 Child3 OKOLO
YEAR/0145
EZEOKOLI main 0
1 joint EZEOKOLI
YEAR/0171
* 01580118 * ABDOU
Main 0 ABDOU
1 joint ABDOU
2 Child1 ABDOU
3 Child2 ABDOU
4 Child3 ABDOU
5 child4 ABDOU
BA/0003
* 00992897 * BAKARI
BAKARI main 0
1 joint BAKARI
BA/0004
* 00992011 * MAINA
MAINA main 0
1 joint MAINA
2 Child1 MAINA
3 Child2 MAINA
4 MARCO Child3
5 child4 MAINA
My goal is to separate facilities, participants and beneficiaries so that questioning, I can easily identify a participant and its beneficiaries is under a given installation, so I developed this code.
create or replace procedure my_new
is
cursor c1 is
Select *.
the registry
where id_number like "% / %" or id_number like ' * % *' or id_number in ('0', '1', '2', '3', '4',' 5');
vNhis register.id_number%TYPE: = NULL;
vNhis1 register.id_number%TYPE: = NULL;
Start
I'm in c1
loop
If i.id_number like "% / %".
then
vNhis: = i.id_number;
on the other
vNhis1: = i.id_number;
dbms_output.put_line(vNhis||) e '|| vNhis1);
-loop
-insert into new_REGISTER (FACILITY_CODE, ID_NUMBER)
-values (vNhis, vNhis1);
-commit;
-end loop;
end if;
end loop;
end;
It gives me a good quick result as shown below
YEAR/0145 * 01934764 *.
YEAR/0145 0
1 YEAR/0145
3 YEAR/0145
YEAR/0145 * 01934769 *.
YEAR/0145 0
1 YEAR/0145
2 YEAR/0145
3 YEAR/0145
4 YEAR/0145
5 YEAR/0145
YEAR/0145 * 02216419 *.
YEAR/0145 0
1 YEAR/0145
2 YEAR/0145
3 YEAR/0145
4 YEAR/0145
YEAR/0145 0
1 YEAR/0145
YEAR/0171 * 01580118 *.
YEAR/0171 0
1 YEAR/0171
2 YEAR/0171
3 YEAR/0171
4 YEAR/0171
5 YEAR/0171
BA/0003 * 00992897 *.
BA/0003 0
BA/0003 1
BA/0004 * 00992011 *.
BA/0004 0
BA/0004 1
BA/0004 2
BA/0004 3
BA/0004 4
BA/0004 5
But uncommenting to insert into the newly created table new_register table it is to say this part of the code
Loop
Insert in the REGISTER (FACILITY_CODE, NHIS_NUMBER)
values (vNhis, vNhis1);
commit;
end loop;
end if;
It took all day to run for the first time and subsequent tests fail to run with my hanging of database. any help on this is appreciated
Thanks to you all.It is slow because you do a lot of change between the SQL and PL/SQL engine with inserts all looped and individual context etc.
What you need to do is to treat the external table (CSV file) data in a single SQL statement example
SQL> select id1, id2 2 from ( 3 select case when id1 is not null then id1 else last_value(id1 ignore nulls) over (order by rn) end as id1 4 ,id2 5 ,rn 6 from ( 7 select rownum as rn 8 ,case when id_number like '%/%' then id_number else null end as id1 9 ,case when id_number not like '%/%' then id_number else null end id2 10 from ext_test 11 ) 12 ) 13 where id2 is not null 14 order by rn; ID1 ID2 -------------------- -------------------- AN/0145 *01934764* AN/0145 0 AN/0145 1 AN/0145 3 AN/0145 *01934769* AN/0145 0 AN/0145 1 AN/0145 2 AN/0145 3 AN/0145 4 AN/0145 5 AN/0145 *02216419* AN/0145 0 AN/0145 1 AN/0145 2 AN/0145 3 AN/0145 4 AN/0145 0 AN/0145 1 AN/0171 *01580118* AN/0171 0 AN/0171 1 AN/0171 2 AN/0171 3 AN/0171 4 AN/0171 5 BA/0003 *00992897* BA/0003 0 BA/0003 1 BA/0004 *00992011* BA/0004 0 BA/0004 1 BA/0004 2 BA/0004 3 BA/0004 4 BA/0004 5 36 rows selected.
-
Trying to get ending entry into force for the groups of lines
Hello world
I searched the forums, but I can't find a post that is a problem quite like that.
I have some data that looks like this:
(note: I inserted manually empty lines for clarity)ID_NUM EFFECTIVE ALLOC_PERCENT ACCT ---------- --------- ------------- ---- 101 01-JUL-11 21 A1 101 01-JUL-11 72 A2 101 01-JUL-11 7 A3 101 01-JUL-12 20 B1 101 01-JUL-12 80 B2 101 01-JAN-13 20 A1 101 01-JAN-13 20 A2 101 01-JAN-13 50 A3 101 01-JAN-13 10 B1 101 01-JUN-13 50 A1 101 01-JUN-13 50 A2
Here's the logic: the lines represent an assignment of percentage on the account for the identification number specified for this entry into force. A new date to cancel the previous, and if any line in the conceptual group is replaced, so they are all.
I'll try to find the date when the effective period of each group ended and which includes in the game so that I can calculate then the number of days in a given line has been effective; something like that;
The end_date of the group is the EFFECTIVE_DATE of the next group (ordered by ID_NUM, EFFECTIVE_DATE).ID_NUM EFFECTIVE END_DATE ALLOC_PERCENT ACCT ---------- --------- ---------- ------------- ---- 101 01-JUL-11 01-JUL-12 21 A1 101 01-JUL-11 01-JUL-12 72 A2 101 01-JUL-11 01-JUL-12 7 A3 101 01-JUL-12 01-JAN-13 20 B1 101 01-JUL-12 01-JAN-13 80 B2 101 01-JAN-13 01-JUN-13 20 A1 101 01-JAN-13 01-JUN-13 20 A2 101 01-JAN-13 01-JUN-13 50 A3 101 01-JAN-13 01-JUN-13 10 B1 101 01-JUN-13 <null> 50 A1 101 01-JUN-13 <null> 50 A2
End_date of two rows is zero because there is no group of lines with an effective date the later - in my process, I'll NVL which sysdate so that my calculations of days will be valid.
I tried some analytical queries with LEAD, but I couldn't figure out how to get the next date of the efficient group. I could get the entry into force of the next row, but not the next group. I couldn't specify how many lead lines to look forward, because there is not a number of rows in each group.
How to fill the end_date column?
Here's the code to create the above.
Oracle version information:create table t (id_num number, effective_date date, alloc_percent number, acct_code varchar2(4) ); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',21.0,'A1'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',72.0,'A2'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',7.0,'A3'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2012',20.0,'B1'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2012',80.0,'B2'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',20.0,'A1'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',20.0,'A2'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',50.0,'A3'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',10.0,'B1'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jun-2013',50.0,'A1'); insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jun-2013',50.0,'A2'); commit; select * from t;
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production."
AMT for Solaris: 11.2.0.3.0 - Production Version
NLSRTL Version 11.2.0.3.0 - Production
Thank you very muchHello
Here is one more way to do using lead work.
WITH ds as (id_num, effective_Date, lead (effective_date) select on end_date (id_num order, effective_Date))
t
Id_num group, effective_date)
Select t.*, ds.end_date
DS, t
where t.effective_Date = ds.effective_Date;
-
How can I find a large amount of data from a stored procedure?
How can I find a large amount of data to a stored procedure in an effective way?
For example do not use a cursor to go through all the lines and then assign values to variables.
Thanks in advance!>
How can I find a large amount of data to a stored procedure in an effective way?For example do not use a cursor to go through all the lines and then assign values to variables.
>
Leave the query to create the object back to you.Declare a cursor in a package specification than the result set gives you desired. And to declare a TYPE in the package specification which returns a table composed of % rowtype to this cursor.
Then use this type as the function's return type. Here is the code example that shows how easy it is.
create or replace package pkg4 as CURSOR emp_cur is (SELECT empno, ename, job, mgr, deptno FROM emp); type pkg_emp_table_type is table of emp_cur%rowtype; function get_emp( p_deptno number ) return pkg_emp_table_type pipelined; end; / create or replace package body pkg4 as function get_emp( p_deptno number ) return pkg_emp_table_type pipelined is v_emp_rec emp_cur%rowtype; begin open emp_cur; loop fetch emp_cur into v_emp_rec; exit when emp_cur%notfound; pipe row(v_emp_rec); end loop; end; end; / select * from table(pkg4.get_emp(20)); EMPNO ENAME JOB MGR DEPTNO ---------- ---------- --------- ---------- ---------- 7369 DALLAS CLERK2 7902 20 7566 DALLAS MANAGER 7839 20 7788 DALLAS ANALYST 7566 20 7876 DALLAS CLERK 7788 20 7902 DALLAS ANALYST 7566 20
If you return a line an actual table (all columns of the table) so you don't need to create a cursor with the query a copy you can just declare the type like this % rowtype tables table.
create or replace package pkg3 as type emp_table_type is table of emp%rowtype; function get_emp( p_deptno number ) return emp_table_type pipelined; end; / create or replace package body pkg3 as function get_emp( p_deptno number ) return emp_table_type pipelined is begin for v_rec in (select * from emp where deptno = p_deptno) loop pipe row(v_rec); end loop; end; end; /
-
No data found in the select statement error
Hi all
Find my sample table and data structure:
Now, I create a block like:SQL> desc states; Name Null? Type ----------------------------------------------------- -------- ------------------------------------ SNO NUMBER SNAME VARCHAR2(10) SQL> select*from states; SNO SNAME ---------- ---------- 1 kerala 2 Tamil nadu 3 AP 4 MP 5 jammu
After excecuting this block no data found error takes place.declare v_state varchar2(20):=' AP'; v_no number; begin select sno into v_no from states where sname=v_state; dbms_output.put_line(v_no); end; /
Coz in where defective condition. "AP"="AP."
What oracle function I should use to eliminate this error.
I tried something like
But it defective. Please help mewhere trunc(sname)=trunc(v_state);
/ * Don't know what is your exact question, but: * /.
use the TOPPING instead of TRUNC
Published by: hoek on November 26, 2011 10:00
-
Hi all
I'm a newbee in labview. As part of my project work, I need to get 8 digital inputs and send 4 digital outputs.so I think to use the Parallel Port on the pc.i can make use of 8 datalines for entries. I found the site NOR is it possible to use status for output pins. But is it possible to use status for output pins pins and data for entries to the time.please help even me also mention of the measures to take, or keep in mind while implementing.also include any example vi that could be useful.
Thanks in advance
I would recommed you to NOT use the parallel port. Now a day you have hardly a PC with parallel port. also if you have some old PC then most likely last version of LabVIEW (e.g. 2010) will need a lot more memory RAM and processor.
If you want a solution very very low cost then I would recommend using an arduino to that effect. You can then download LabVIEW Interface for Arduino and start working.
If you continue to use the parallel port, then you could try (I haven't worked with parallel port and have not tested the following solutions)
Download VIPM and then install the enclosed package. It will add the port e/s palette in your labview. and you can use it.
Maybe you are looking for
-
Firefox won't open - taskbar icon looks active but won't display
Firefox does not open on the screen. The icon in my tray tasks shows a window, but the window does not open the monitor. I can RT. Click the icon and select Refresh, or maximize but no help. I'm under Win10. It also will not open on the screen when y
-
How can we customize filename/path for the files you want to download?
Default path for saving downloaded files is (in my case) "/ storage/sdcard0/Downloads."File name by default is seems to be the name of the original file.How can we change these settings? THX
-
Covering of function switch is compatible...
with my dv7 1020US. I ruined mine and need to replace. There are 2 versions available. (501553-001) bronze and silver (480469-001) my understanding is that bronze ones that have been made for AMD based and custom work on Intel based machines machines
-
2-axis... 1 switch House? Find reference
I use a card of e/s NOR-7330 movement, to which it is a Council of I/O UMI 7764 motion. This card is used for the stepper motors closed loop. Currently, I am trying to write a VI that, for each axis, turn each screw lead until running personalties on
-
Connected to the internet, but not connected network magic shows
My network is connect to the internet, both wired and wireless. On the compputer connected by magic cable network shows not connected, but I am connected. Unable to print remotely. Router shows connected but the network card is not.