On please thinking of the CAP: the creation of a range in PL/SQL similar to C++
Well, I had to walk on go "Whoa!"Objective: write a segment of code that will detect and identify a value within a range and then replace it with the following progress on the next item. In other words to rank A.. Z and the value is the current value. I want to detect "D" and update 'E '. I saw an example of use of DECODE as follows:
For example:
You could use the decode function in an SQL statement as follows:
SELECT supplier_name,
decode(supplier_id, 10000, 'IBM',
10001, 'Microsoft',
10002, 'Hewlett Packard',
'Gateway') result
FROM suppliers;
But you must always have logic increment the value in the range to the next higher value. Well, it can be done, but it sounds like it could be painful without a creation based on the Oracle. The code I have adjust below where the AGL - X, or PGL - X should be incremented to AGL - Y, or PGL - Y. It might be easier to use only decode and hard fix 26 values for each case.declare
cursor c1 is
select * from alumni.amrexrt
where amrexrt_pidm = 2895;
cursor c2 is
select * from alumni.amrexrt
where amrexrt_pidm = 2895;
amrexrt_rec alumni.amrexrt%rowtype;
r2 alumni.amrexrt%rowtype;
begin
for amrexrt_rec in c1 loop
if (amrexrt_rec.amrexrt_exrs_code = 'AGL') then
update amrexrt
set amrexrt_exrs_code = 'AGL-X'
where amrexrt_pidm = 2895
and amrexrt_exrs_code = 'AGL';
elsif (amrexrt_rec.amrexrt_exrs_code = 'MGL') then
update amrexrt
set amrexrt_exrs_code = 'MGL-X'
where amrexrt_pidm = 2895
and amrexrt_exrs_code = 'MGL';
elsif (amrexrt_rec.amrexrt_exrs_code = 'PGL') then
update amrexrt
set amrexrt_exrs_code = 'PGL-X'
where amrexrt_pidm = 2895
and amrexrt_exrs_code = 'PGL';
end if;
Insert into alumni.amrexrt
(
amrexrt_pidm,
amrexrt_exrs_code,
amrexrt_ext_value,
amrexrt_ext_score,
amrexrt_ext_level,
amrexrt_activity_date
)
Values
(
amrexrt_rec.amrexrt_pidm,
amrexrt_rec.amrexrt_exrs_code,
amrexrt_rec.amrexrt_ext_value,
'754', --amrexrt_rec.amrexrt_ext_score,
amrexrt_rec.amrexrt_ext_level,
amrexrt_rec.amrexrt_activity_date
);
end loop;
for r2 in C2 loop
dbms_output.put_line('PIDM: ' || r2.amrexrt_pidm || 'EXRS_CODE: ' || r2.amrexrt_exrs_code);
end loop;
--Rollback;
end;
In C++, you can specify a range and write it so that the compiler can detect the position within the range. I do not or think that PL/SQL to do this in the same way. Any thoughts? I'm dry of ideas.Published by: Preston on May 3, 2011 12:05
where the AGL - X, or PGL - X should be incremented to AGL - Y, or PGL - Y
A combination of ASCII and CHR functions could do this:
SQL> with t as (
select 'AGL-X' code from dual union all
select 'SGH-J' code from dual union all
select 'LFG-A' code from dual union all
select 'PGL-X' from dual
)
--
--
select code, substr(code, 1, instr(code,'-')) || chr(ascii(substr(code, instr(code,'-') + 1)) + 1) new_code from t
/
CODE NEW_CODE
------- ---------
AGL-X AGL-Y
SGH-J SGH-K
LFG-A LFG-B
PGL-X PGL-Y
4 rows selected.
Tags: Database
Similar Questions
-
Problem with the creation of date range with PL/SQL WHERE clause
Hello, everyone:
I'm unable to develop and the SQL statement to filter records today and seven days back. My condition is as follows:
I think I'm to mess with the (to_char (ALM_OG_ACTIVITY_DATE, ' mm/dd/yyyy ' ")) statement.from wsualumni.wsu_online_giving_table --where ALM_OG_ACTIVITY_DATE >= ALM_OG_ACTIVITY_DATE - 7 where ALM_OG_ACTIVITY_DATE >= SYSDATE - 7 and ALM_OG_CAMPAIGN_CODE = 'MED' OR ALM_OG_CAMPAIGN_CODE = 'MED1';
The actual code is below to:
Resultsset serveroutput ON SIZE 1000000 set heading off set feedback off set trimspool off set echo off set pagesize 0 DECLARE v_data_line_hdr varchar2(1000); v_data_file varchar2(80); v_sch_code varchar2(10); v_instance_name varchar2(10); ws_path payroll.pybutfl.pybutfl_utl_file_path%TYPE; v_data_line VARCHAR2 (4000) := NULL; fhandle_o UTL_FILE.file_type; v_line_count NUMBER := 0; v_selected_count NUMBER := 0; v_error_count NUMBER := 0; v_written_count NUMBER := 0; v_error_text VARCHAR2 (50) := ' Unable to write the line. '; v_errm VARCHAR2 (255); v_sqlerrm VARCHAR2 (255); CURSOR C1 IS select RTRIM ( ALM_OG_ID ||'|'|| NULL ||'|'|| (to_char(ALM_OG_AMOUNT, '999,999.99')) ||'|'|| 'Cash' ||'|'|| 'Credit Card' ||'|'|| (to_char(ALM_OG_ACTIVITY_DATE, 'mm/dd/yyyy')) ||'|'|| ALM_OG_ACCI_CODE ||'|'|| 'On-Line Giving' ||'|'|| 'On-Line giving' ||'|'|| ALM_OG_HONOR_MEM_NAME ||'|'|| NULL ||'|'|| 'Do not post' ||'|'|| 'StandardThankYou' ||'|'|| 'Not Acknowledged' ||'|'|| 'Do not receipt' ||'|'|| NULL ||'|'|| 'Banner Gift Number' ||'|'|| ALM_OG_BANNER_GIFT_NO ||'.'|| ALM_OG_ACCI_CODE ||'|'|| (to_char(ALM_OG_ACTIVITY_DATE, 'mm/dd/yyyy')) ||'|'|| NULL ||'|'|| 'Web ID' ||'|'|| ALM_OG_WEBID ||'|'|| NULL ||'|'|| 'Source' ||'|'|| ALM_OG_CAMPAIGN_CODE ||'|'|| 'On-Line Giving' ) data_line from wsualumni.wsu_online_giving_table --where ALM_OG_ACTIVITY_DATE >= ALM_OG_ACTIVITY_DATE - 7 where ALM_OG_ACTIVITY_DATE >= SYSDATE - 7 and ALM_OG_CAMPAIGN_CODE = 'MED' OR ALM_OG_CAMPAIGN_CODE = 'MED1'; CURSOR C2 IS select RTRIM( 'ConsID' ||'|'|| 'GFImpID' ||'|'|| 'GFTAmt' ||'|'|| 'GFType' ||'|'|| 'GFPayMeth' ||'|'|| 'GFDate' ||'|'|| 'FundID' ||'|'|| 'CAMPID' ||'|'|| 'GFAppeal' ||'|'|| 'GfRef' ||'|'|| 'GfPostDate' ||'|'|| 'GfPostStatus' ||'|'|| 'GfltrCode' ||'|'|| 'GfAck' ||'|'|| 'GfRcpt' ||'|'|| 'GfAttrlmpID00' ||'|'|| 'GfAttrCat00' ||'|'|| 'GfAttrdesc00' ||'|'|| 'GfAttrDate00' ||'|'|| 'GfAttrlmpD01' ||'|'|| 'GfAttrCat01' ||'|'|| 'GfAttrdesc01' ||'|'|| 'GfAttrlmpID02' ||'|'|| 'GfAttrCat02' ||'|'|| 'GfAttrdesc02' ||'|'|| 'GfSubType' ) line_header from DUAL; /**********************************************************************/ /* Main Program Processing */ /**********************************************************************/ BEGIN DBMS_OUTPUT.put_line ('Program Started in wsualumni.wsu_online_giving_online'); IF UTL_FILE.is_open (fhandle_o) THEN UTL_FILE.fclose (fhandle_o); END IF; /* Name The File Here */ v_data_file := ('MED_SCH_' || TO_CHAR(sysdate, 'dd-MON-yyyy') || '_OG_DATA.txt'); SELECT RTRIM (pybutfl_utl_file_path) INTO ws_path FROM payroll.pybutfl; fhandle_o := UTL_FILE.fopen (ws_path, v_data_file, 'w'); DBMS_OUTPUT.put_line ('UTLFILE file for this run is: ' || ws_path||'/'||v_data_file); v_written_count := 0; FOR c2_rec IN C2 LOOP BEGIN v_selected_count := v_selected_count + 1; v_data_line_hdr := rtrim(c2_rec.line_header); UTL_FILE.put_line (fhandle_o, v_data_line_hdr); v_written_count := v_written_count + 1; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line (v_error_text); v_error_count := v_error_count + 1; END; END LOOP; FOR c1_rec IN C1 LOOP BEGIN v_selected_count := v_selected_count + 1; v_data_line := rtrim(c1_rec.data_line); UTL_FILE.put_line (fhandle_o, v_data_line); v_written_count := v_written_count + 1; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line (v_error_text); v_error_count := v_error_count + 1; END; END LOOP; DBMS_OUTPUT.put_line ('Number of Records Selected: ' || v_selected_count); DBMS_OUTPUT.put_line ('Number of Records Written: ' || v_written_count); IF UTL_FILE.is_open (fhandle_o) THEN UTL_FILE.fclose (fhandle_o); END IF; END; /
ConsID|GFImpID|GFTAmt|GFType|GFPayMeth|GFDate|FundID|CAMPID|GFAppeal|GfRef|GfPostDate|GfPostStatus|GfltrCode|GfAck|GfRcpt|GfAttrlmpID00|GfAttrCat00|GfAttrdesc00|GfAttrDate00|GfAttrlmpD01|GfAttrCat01|GfAttrdesc01|GfAttrlmpID02|GfAttrCat02|GfAttrdesc02|GfSubType 000013505|| 20.00|Cash|Credit Card|06/22/2009|221686|On-Line Giving|On-Line giving|||Do not post|StandardThankYou|Not Acknowledged|Do not receipt||Banner Gift Number|1179534.221686|06/22/2009||Web ID|000013505||Source|MED|On-Line Giving 000013505|| 20.00|Cash|Credit Card|06/22/2009|770830|On-Line Giving|On-Line giving|||Do not post|StandardThankYou|Not Acknowledged|Do not receipt||Banner Gift Number|1179534.770830|06/22/2009||Web ID|000013505||Source|MED|On-Line Giving
Hello
The problem is due to the "OR" condition (I did not pay attention to it earlier).
Because of this condition, your query is given beyond 7 days recovery. You need to rewrite the code as:
ALM_OG_CAMPAIGN_CODE in ('MED', 'MED1')
Instead of
and ALM_OG_CAMPAIGN_CODE = 'MED' OR ALM_OG_CAMPAIGN_CODE = 'MED1';
This will do the magic for you.
Concerning
Asif Momen
http://momendba.blogspot.com -
Please think when the memory usage is too high.
Hi all
My version of Oracle is 11.2.0.4 64-bit
And Linux version: SUSE Linux Enterprise Server 11 (x86_64) SP3.
Use of memory on the server is too high.
AP - GV - SP713:orasop 55 > free t m
total used free shared buffers cached
MEM: 258341 257482 859 43775 8 219455
-/ + buffers/cache: 38018 220322
Swap: 65535 3919 61616
Total: 323877 261401 62475
AP - GV - SP713:orasop 56 >
Top of PAGE process 10 consuming the most memory is below -.
AP - GV - SP713:orasop 56 > ps to the | Sort - nk + 4 | tail
orasop 15385 3.7 0.0 30937152 9916440? SS Nov23 01:40 ora_dbw2_SOP
orasop 15408 3.7 0.0 30933376 9809912? SS Nov23 01:39 ora_dbw5_SOP
orasop 35335 3.8 0.6 30932204 10316356? SS 04:32 03:00 oracleSOP (LOCAL = NO)
orasop 7121 3.8 0.1 30932164 10296904? SS Nov24 01:51 oracleSOP (LOCAL = NO)
orasop 10997 3.9 0.3 30928188 10457696? SS Nov24 03:34 oracleSOP (LOCAL = NO)
orasop 15371 3.9 0.0 30937024 10399132? SS Nov23 01:44 ora_dbw1_SOP
orasop 7216 4.7 0.8 30929072 12475216? SS 05:08 03:55 oracleSOP (LOCAL = NO)
orasop 14793 5.0 0.6 30940416 13390616? SS Nov24 06:29 oracleSOP (LOCAL = NO)
orasop 18524 5.0 0.7 30928112 13329416? SS Nov24 07:08 oracleSOP (LOCAL = NO)
orasop 31019 11.2 5.9 30926108 15609268? RS 06:14 42: 21 oracleSOP (LOCAL = NO)
AP - GV - SP713:orasop 57 >
In the oracle memory setting is:
SQL > select decode(pool,null,name,pool), round (sum (bytes) / 1024/1024,4) MB in Group v$ sgastat by decode (pool, null, name, pool) order by 2 desc;
DECODE (POOL, NULL, NAME, POOL MB
-------------------------- ----------
BUFFER_CACHE 15360
Shared pool 13952
pool of Java 448
log_buffer 56.9688
fixed_sga 2.1634
Please suggest if the memory must be increased and also I see a dynamic memory management is not turn on on the server.
SQL > show parameter sga_target
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
SGA_TARGET large integer 0
SQL > show the memory_target parameter
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
memory_target large integer 0
SQL >
SQL > show parameter sga_max_size
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
very large integer SGA_MAX_SIZE 29952 M
SQL >
Please suggest.
Thank you before acting.
Concerning
Jean Louis
Yvon says:
Please check the error of the alerts log when the database is set automatically.
WARNING: VKTM detected a drift of the time.
Time derivatives may cause unexpected behavior, such as wait times. Check the file path for more details.
Mon 23 Nov 20:41:17 2015
Closure of proceedings (immediate)
Closure of proceedings: in addition to logons disabled
Stop background MMNL process
MMON background process stop
The high waters = 53 license
ALTER DATABASE CLOSE NORMAL
ORA-1507 marked during: ALTER DATABASE CLOSE NORMAL...
ARCH: Disabled archives due to the stop: 1089
Stop process to archive
Archiving is disabled
ARCH: Disabled archives due to the stop: 1089
Stop process to archive
Archiving is disabled
Mon 23 Nov 20:41:20 2015
Stop background VKTM process
Mon 23 Nov 20:41:22 2015
Instance shutdown complete
Concerning
Jean Louis
I say that DB was reduced by human intervention based on below
Accident never issue SHUTDOWN IMMEDIATE
After the accident alert log shows DB followed by BOOT messages running.
> Closing instance (immediate)
Problem exists between keyboard and Chair only.
-
Please help with the creation of text box
Hi all
I'm new in FLEX 4, embarrassed so please excuse my questions.
What I want to do is to create a button that inserts a text box on my canvas, whenever it locks.
How would I do that?
Thank you very much
Tried your code. Got a popup saying:
Error: addChild() is not available in this category. Instead, use addElement(), or change the skin, if you have a.
MyCanvas.addChild (myRichEditableText) has changed; at myCanvas.addElement (myRichEditableText); and it worked.
But you must use a HGroup, a VGroup or a TileGroup instead of a BorderContainer... You wouldn't have the x value and y the text manually box.
-
How can I get the data from a range of AutoFilter in Excel?
I have a spreadsheet with a large number of lines (5000) where I want to extract data. I have opened the workbook successfully, configure an automatic filter and filtered the data to select the data corresponding to the criteria using the nodes property of the ActiveX Excel object and invoke. I now have to enter the selected data in a table for later processing, and this is where I am stuck. Help Excel online seems to suggest the creation of a Range object by using special cells with the xlCellTypeVisible type. If I Range.Count I get the right number of cells, but Range.Value2 produces a variant which contains only the first block of data (a beach filtered automatically seems to consist of several non continuous blocks). Anyone know how I can read the contents of the range in an array of strings?
Thanks in advance
Ken
IT SOLVED!
Found a calling areas of property which returns a collection of the areas of each of them continues a range object. Simply cycled through these areas using the earlier technique, build the table I want. See below
Thank you
Ken
PS I can KUDOS
-
Hi, me - Joshua, using Mozilla Version 38.0.1, please share the information of the creation of tab double... Thank you.
Hello!
https://support.Mozilla.org/en-us/questions/762043
This solution should help you
"
Ctrl-click or middle-click the Reload button to open the current page in a new tab. Ctrl-click or middle-click items in the history of the Back and Forward buttons to open a page from that list in a new tab. Duplicate a tab with its history by pressing CTRL and dragging the tab to a new position on the tab bar. Dragging a tab in the browser window will detach the tab and move it to a new window, this is called tab tearing. Drag a tab back to the tab bar in the original or anther window to undo a detach or move a tab to a specific window. If a window gets empty (you tear off the last tab) then that window will be closed automatically. "
-
We live errors in the creation of recovery media. Please try again
Hello
I bought the windows 8 hp pavilion series laptop and tried to create the recovery with blank disc DVD - R disc.
While burning data first drive the HP Recovery Manager application up the pop-up message like "we live errors in the creation of recovery media. Please try again' with the OK key.
Press the button Ok app closed automatically once.
Model laptap
HP Pavilion n003tx-15 Notebook PC (Windows 8)
Please someone help me.
Thanks in advance
Concerning
Trehout
Have you tried to burn in Mode safe?
-
DEV_SOAINFRA account got locked so that the soa_infra please think whatto do to unlock the purge?
Hello
If you have access to the user SYS (user sys password), then you could change the user DEV_SOAINFRA with the following command.
ALTER USER
IDENTIFIED BY password ACCOUNT UNLOCK; You can also look into changing the default profile for the user above. (LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED; default EDIT PROFILE)
It will be useful.
-
Hello. Hard drive of my computer totally crashed & I had to wipe my hard drive. I wasn't able to log out of my apps for the creation of clouds which my wife has 2 licenses for us. Can someone please explain the process to re download these apps please? Thank you..
Hello
Please refer to the help documents below to download the application Adobe CC:
Download, install, update or uninstall applications
Kind regards
Sheena
-
Please bring back the 'Genius' of Apple TV playlist creation
Us do not subscribe to the Apple's music, but we love music and have a large local library to which we can access the home sharing. In our House, we frequently use the Apple TV to play music when entertaining customers. The Apple TV 3 and earlier versions, we used to pick a song that fits the mood and then now a pressure for the submenu where we would choose the option to create a Genius playlist. It used to work great (and still works beautifully on my Mac in iTunes).
But on Apple TV 4, I can find no option to create a Genius playlist. I hope that they add it in an update. There must be a lot of users like me who don't agree not to music from Apple, but have a great local music library with which they want to create Genius playlists.
What do you think are the prospects of the genius feature brings Apple to Apple TV for us? (because it still works very well in the eco-system)
mrlogic wrote:
What do you think are the prospects of the genius feature brings Apple to Apple TV for us? (because it still works very well in the eco-system)
What we think is irrelevant. Speculation and rumor are banned by Apple Support communities terms of use.
-
the program associated with the creation of a virtual instrument of Lab View. Please help me
I have a question with the program associated with the creation of a virtual instrument of Lab View. 1. creation of virtual instrument based on the NI 9401 module mounted on the chassis NI DAQ of Compaq (nor-cDAQ-9172). Creating a virtual tool should apply the following counting pulses in series of the pulse, visualization of data by means of a digital indicator, by comparing the number of impusite with a predetermined value, this value can be assigned by the user. Indicator light when you get to reach the number of pulses, the ability to reset the counter of a button on the front panel. Digital output switch when reaching the number. I hope someone can help me.
What is your question? You have described what the program is supposed to do, but it is unclear what you're asking about. Do you need help to get started? If so, what you have gone through the tutorials of LabVIEW? You and look at the material in tutorials the NI Developer Zone Learning Center , which provides links to other materials and other. You can also take a course online for free. Have you looked through numerous examples provided with LabVIEW for data acquisition?
-
The creation of sequence error. Help, please
I use following script to create the sequence but in error
Error report:
SQL error: ORA-01722: invalid number
01722 00000 - "invalid number."
CREATE SEQUENCES BL_BTN_MASTER_SEQ
MINVALUE 1
MAXVALUE 999999999999999999
INCREMENT BY 1
START WITH (SELECT MAX (BULLETIN_MASTER_ID) + 1
OF BL_BTN_MASTER)
NOCACHE;
FYI... The bulletin_master_id column data type is NUMBER (22.0)
Help, please.
Published by: user11228834 on May 29, 2013 10:22
Published by: user11228834 on May 29, 2013 10:23
Published by: user11228834 on May 29, 2013 10:25Oracle doesn't like the ' (select max (bulletin_master_id) + 1 bl_btn_master)' statement incorporated in the CREATE SEQUENCE statement because if you look at the syntax it expects an acual number.» You can use run immediately to create the sequence in this way:
{code}
declare
number of v_seq;
v_statement varchar2 (200);
Start
SELECT max (bulletin_master_id) + 1
in v_seq
of bl_btn_master;v_statement: = 'CREATE the SEQUENCE BL_BTN_MASTER_SEQ |
"MINVALUE 1' |
"MAXVALUE 999999999999999999' |
' INCREMENT OF 1' |
'START WITH ' | v_seq |
"NOCACHE";execute immediate (v_statement);
end;
{code} -
My DVD burner has crashed during the creation of media recovery disks.
HP Pavilion p7 - 1269c using Windows 7 Home premium desktop PC. How to reset the creation process so the Recovery Manager will allow me to start over again?
As far as I know, you don't reset the creative process. If the HP Recovery Manager thinks that he has created a set of discs, it's done. Please contact HP and ask for a free set of disks. Explain your situation to them.
-
Problems with the creation of PDFs in Acrobat Pro 11
We are going to have problems with shared PDF files created in Acrobat Pro 11.0.11 or above.
When some users to create shared PDF files and send for shared review, they can be considered as shared PDF in Acrobat Pro (yellow bar appears, with shared PDF functions), but not in Adobe Reader 11.0.11 or higher (without shared review menu bar appears, can't we seem to view manually).
Anyone know what could be the problem? It's only for PDF files created by some users, another shared review, a PDF file created with Acrobat Pro 11.0.11 or superior open fine in drive 11.0.11 or above. I think maybe it's a setting that is not correct for some users...
Thank you!!
-Paul Masalsky
McAfee (which is now part of the security of Intel)
Hi paulm85910772,
Please see this KB document for the creation of a shared review Acrobat help. Starting a PDF review. On the other end uses can participate in a shared review using Adobe Reader help of Acrobat Reader | Share, comment and review from.
Try the most recent Adobe Acrobat Reader DC Adobe - Adobe Acrobat Reader DC Distribution.
Let me know how it goes.
Kind regards
Nicos
-
What is the limit for the creation of a primary key?
Hi friends I have an another question... .Please help me...
What is the limit for the creation of a primary key?
Thank youI think that its 32
Yes from the doc
Primary and unique keys because composites are limited to 32 columns, a composite foreign key is also limited to 32 columns.
Published by: Karthick_Arp on January 13, 2010 22:04
Maybe you are looking for
-
Upgrade my i5 to i7 cpu?
Hello help! I have a HP G62-149WM with an Intel Core i5 - 430 m processor and would like to know if I can pass the processor i7, such as listed in the service of HP for my make and model Guide? Just want to be sure before that I agree! Thanks in adva
-
HP Officejet 6500 E709n prints pink white and sometimes so black printing is selected
Original title: HP Officejet 6500 E709n series Cannot print copies or faxes. Pages come in a pink or white light when you try to copy in black. I did a restore point back a week before it started. Has not fixed the problem.
-
I just bought a new NetGear wireless router and now my laptop lost wireless connection after hibernation I or stop it. Then I have to reset the automatic Wireless Configuration to find my wireless connection. Whenever I stopped him it and I have to
-
Read for the acquisition of data entries are overwritten
Hey there I have a Daq reading input in a spreadsheet file Data acquisition was told that one is supposed to have some time a loop around it and I cannot get it to run without one, so good But my main problem is that it means that it replaces my writ
-
Winload.exe missing or damaged
Hello. I was working to clone my disk to a USB HDD (included). I think I can inadvertently done the USB HDD (empty; no OS) a boot disk. Now, I get the "there has been a change in software/hardware to the system; Winload is missing or corrupted"error