problem with a loop in a cursor
Hello
I wrote following PL/SQL procedure to create indexes on a table to particular warehouse. WAR_ETL_INDEX table is a table of store, I created that contains the table name, column name, and the name of the index of this column. I pick up all these details in the WAR_ETL_INDEX table and create indexes using the following procedure. Now, after compiling the code, when I am trying to execute the following procedure with
"set serveroutput on .
EXEC RECREATE_INDEX("W_General_D"); "it seems that it is not picking all the files lets assume if the cursor has 3 records this code tries to run create 3 index but all three times its operation for the first record." Thus, its closure for 3 times, but for all his race for the first record only loop. Could you please review the code and share if you find any problem.
CREATE or REPLACE PROCEDURE RECREATE_INDEX (par_table_name VARCHAR2)
IS
INDEX_NAME WAR_ETL_INDEX. INDEX_NAME % TYPE;
WAR_ETL_INDEX OF COLUMN_NAME. COLUMN_NAME % TYPE;
l_sql DEFAULT CLOB "TABLESPACE in CREATE BITMAP INDEX INDEX_NAME ON TABLE_NAME ('COLUMN_NAME') 'P1_DW_IDX" ";
CURSOR C1 IS
SELECT INDEX_NAME, COLUMN_NAME
WAR_ETL_INDEX WHERE TABLE_NAME FROM = par_table_name;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO INDEX_NAME, COLUMN_NAME;
WHEN EXIT C1% NOTFOUND;
l_sql: = REPLACE (REPLACE (REPLACE(l_sql,'INDEX_NAME',INDEX_NAME), 'TABLE_NAME', par_table_name), 'COLUMN_NAME', COLUMN_NAME);
dbms_output.put_line (l_sql);
EXECUTE immediate l_sql;
END LOOP;
commit;
CLOSE C1;
END RECREATE_INDEX;
You need to reset your variable l_sql with the SQL model on each loop. You have no need for a commit, DDL has an implicit validation thus creating an index will do. Try something like this...
CREATE or replace PROCEDURE Recreate_index (par_table_name VARCHAR2) IS
l_sql CLOB.
CLOB constant l_templatesql: = "TABLESPACE in CREATE BITMAP INDEX INDEX_NAME ON TABLE_NAME ('COLUMN_NAME') 'P1_DW_IDX" ";
BEGIN
FOR rec in (SELECT index_name,
column_name
OF war_etl_index
WHERE table_name = par_table_name)
LOOP
l_sql: = l_templatesql; -Reset DDL index
l_sql: = Replace (replace (Replace (l_sql, 'INDEX_NAME', rec.index_name))
(('TABLE_NAME', par_table_name), 'COLUMN_NAME', rec.column_name);
dbms_output. Put_line (l_sql);
EXECUTE IMMEDIATE l_sql;
END LOOP;
END recreate_index;
Tags: Database
Similar Questions
-
Windows 7 starts problems with black screen and the cursor because of power failure
I'm on a Windows 7 64-bit Home Premium OS. Start-up problems arose after the power failure (accidentally unplugged the charger, the battery was not in place) during a video call in Skype. Accessories attached to the laptop at the time were a Logitech Webcam, a dongle Bluetooth, microphone and headphones.
When starting my laptop Asus N81VP, he'll go as far as the 'Starting Windows' logo, then I meet a black screen with a mobile cursor. I don't then right click, CTRL + ALT + DELETE.
I tried the things:
Start Up Repair = "cannot automatically repair."
System Restore = no available restore points
Windows Memory Diagnostic = at 100%, no screen of detected problems, then black with mobile cursor
Networking Mode Safe Mode/Safe = black screen with cursor mobile
Activate video low resolution (640 x 480) = black screen with cursor mobile
Good known Configuration = black screen with cursor mobile list
Start Windows normally = black screen with cursor mobile
Please help me. I've had this laptop for less than a year, and it would break my heart to have to re - format.
You seem to have exhausted most of the options available in such cases, except two:
D ' log in under a different account.
-To restore your registry files manually. See below for more details.On your heart that could get broken: have you considered using the imaging facility that is integrated with Windows 7? You can find it in the control panel / backup and restore. This is somewhat marginal in the feature and it can be finicky, but it saved my butt several times.
You can restore your registry files manually to a previous point through the steps described below. The process is complex and requires some careful typing. Ask a computer-savvy friend to help you if you lack experience in this field. Note that it may reset your password to a previous value.
1. keep tapping F8 during the first phase of startup.
2. Select repair in the menu that looks like this:
http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode
3 log in as administrator if you are prompted.
4. Select repair when prompted.
5. Select the command line in the menu that looks like this:
http://Windows.Microsoft.com/en-us/Windows7/what-are-the-system-recovery-options-in-Windows-7
6. identify the correct drive letter for your Windows installation. It could be one drive other than c, but it will not X:. You do this by typing commands
DIR C:\Win*
Dir D:\Win*
dir E:\Win*
until you find the Windows folder.
I'll call this "Q:" drive
7 type these commands:
CD /d Q:\windows\System32\config
xcopy *. * Q:\MyRegBack\
CD RegBack
dir
8. review the dates of the software, system, and SAM files. The files created before or after that is your problem?
9. If they were made before the problem appeared, you can then type these commands:
copy software / y...
/y copy system...
/y copy Sam...
(the two points are part of each order)
10. restart normally. If things don't work then you can go back by copying files from the original register of Q:\MyRegBack to Q:\Windows\System32\config. -
problem with while loop graph y Gráfica
Hola
Estoy realizando UN programa or UN contador cada vez as recibe UN 1, el contador to con resetea a button Reset o autoamticamente cada cierto tiempo (el don't reset por tiempo're para cuando hace mucho tiempo no to recibe una Señal 1 is resetea el contador)
I made UN programa hace eso, pero cuando entered el resets del tiempo contador is ahi, nunca sale is asi Señal cambie has 1.
y mi otra duda are not con the graphic grafica, results quisiera show los datos del contador with the actual date, initiates use las propiedades del chart pero no works... no self if alguien me can help put con problemas
Gracias
Herica M
PD: estoy utilizando LBV9.0
How dice crows, need leer los slideshows you mismo you of the account of that are what you are doing wrong.
Aqui el annex you VI con unos cambios para as haga lo that I think quieres hacer, pero comentarios puse if tienes dudas me questions.
Para lo grafica en las propiedades del eje X, seleccionas as el tiempo absoluto sea dato, y luego con UN nodo propiedad Escalin grafica puedes hacer al eje X shift para as sea the actual date.
Decree No. presidential Te perfect use el foro en Español, TR o lo going poner Aquí, hacerlo in Frances.
-
problems with gradual loop on film loaded
Hey, I help for a about a week ago to make a loop on the progressive responsible films, but I had a problem book only on the keyframe, one and not the keyframe nov 2. Everybody don't know how I can fix that... ?
I have the following text on the keyframe 1, where everything is perfect:
var timedelay:Number = 3;
var video;
var nc:NetConnection;
var ns:NetStream;
NC = new NetConnection();
NC. Connect (null);
NS = new NetStream (nc);
NS.client = this;
ns.addEventListener (NetStatusEvent.NET_STATUS, netStatusf);
function netStatusf(e:NetStatusEvent) {}
If (e.info.code == "NetStream.Play.Stop" & & Math.abs(durationNum-ns.time) <. 1) {}
setTimeout(replayF,timedelay*1000);
}
}
function replayF() {}
NS. Play("film/Film1.F4V");
}
var durationNum:Number;
function onMetaData(iObj:Object):void {}
durationNum = iObj.duration;
}
video = new Video (287,263);
Video.x = 204,1;
Video.y = 140,5;
addChild (video);
video.attachNetStream (ns);
NS. Play("film/Film1.F4V");
and on the keyframe 2 I got this, here we choose a table randome movie, when it ' chose it loop does not work:var moviesA2:Array = ["film/film1.f4v', ' film/film2.f4v', ' film/film2.f4v', ' film/film2.f4v'," film/film2.f4v"];var movie2:String = moviesA2 [Math.floor (Math.random () * moviesA2.length)];var timedelay2:Number = 6;var video2.var nc2:NetConnection;var ns2:NetStream;NC2 = new NetConnection();NC2. Connect (null);Ns2 = new NetStream (nc2);ns2.client = this;ns2.addEventListener (NetStatusEvent.NET_STATUS, netStatusf2);function netStatusf2(e:NetStatusEvent) {}If (e.info.code == "NetStream.Play.Stop" & & Math.abs(durationNum-ns.time) <. 1) {}setTimeout(replayF2,timedelay*1000);}}function replayF2() {}ns2. Play (Movie2);}VIDEO2 = new Video (287,263);VIDEO2.x = 204,1;VIDEO2.y = 140,5;addChild (video2);VIDEO2.attachNetStream (ns2);ns2. Play (Movie2);I guess that you have applied ns.close () when the flow stops a loop which goes to frame 2. then use:
function netStatusf2(e:NetStatusEvent) {}If (e.info.code == "NetStream.Play.Stop" & Math.abs (durationNum -ns2.time))<.1) {="">setTimeout(replayF2,timedelay*1000);}} -
Satellite P100-324: problems with the installation of Vista->; cursor flashing
All greetings. Tried to put one of these days of Windows Vista. But my attempts to failure are completed. After the first? There is a black screen and blinking cursor. So any activity HDD and DVD, it is not respected. Recently updated BIOS updated to v3.30. Help put already and I do not know what to invent.
For English I apologize, I'm of the Russia :)
Hello
Have you tried to format the HARD drive and reinstall Vista?
Try to access the BIOS and check if the HARD drive is recognized in law.What exactly happened during the installation of Vista?
-
Cursors do not work in the development section. I use LR CC - latest version, OS EL Capitan. Cannot close LR
Guess he decided to work on its own.
-
I'm currently updating several records and field that are passed from the previous page. What I can't understand, is how I reference them in the update statement because I don't know their name to complete the form. You can see that fields have all done correctly, as indicated below, the debug. I don't know why I get the error I just don't know how to correct it. I've also attached the code that sends the data and my update code. Any help would be greatly appreciated.
Thank youUse the notation of table for dynamic domain names
UPDATE csd_main_plan
SET csd_focus = ' #form ["csd_focus" & I] #',
... -
Hello
I'm new in plsql, so I need your help. I am rewriting the existing plpgsql function plsql function, but I have an error on line 15: PLS-00103: encountered the symbol "LOOP" when expecting one of the following values:
What is the problem with the LOOP statement?
FUNCTION to CREATE or REPLACE dothework (service_name text string_value)
RETURNS the text AS
BEGIN
DECLARE
result text;
varying (31) of tempId character;
tempFieldId bigint;
text of tempStringValue;
tempCount bigint;
BEGIN
result = ";
FOR IN tempId
SELECT ce.id FROM mfc.card_element this
WHERE the ce.name AS service_name
LOOP
tempCount = 0;
SELECT INTO tempFieldId mfc.card_field CF field_id
WHERE cf.field_name = 'NPAname ';
SELECT INTO tempCount count (*) FROM mfc.card_element_field_value cefv
WHERE the cefv.card_element_id AS a tempId AND field_id = tempFieldId;
IF tempCount = 1 THEN
UPDATE mfc.card_element_field_value
SET field_string_value = string_value
WHERE the card_element_id AS a tempId AND field_id = tempFieldId;
result: = result | tempId | 'UPDATE - YES,';
ELSIF tempCount = 0 THEN
INSERT INTO mfc.card_element_field_value (id, field_date_value, field_integer_value, field_string_value, card_element_id, field_id)
VALUES (HIBERNATE_SEQUENCE.nextval,
NULL,
NULL,
string_value,
tempId,
tempFieldId);
result: = result | tempId | "INSERT - YES, ';
ON THE OTHER
result: = result | tempId | "tempCount,";
END IF;
-END IF;
END LOOP;
RETURN result;
END;
END;
I did the same refatoring I program you unit and put comments to help to understand.
Let me know if it help you
FUNCTION to CREATE or REPLACE dothework (service_name in VARCHAR2
string_value IN VARCHAR2) RETURN VARCHAR2 AS
-Not necessary to define the new block here BEGIN-
-SAYS - you only need the instruction stated in this case if you
-believe that he can raise one exceptional and you want to manage block outsider
--
-You must set the buffer of varchar2
-32767 is the largest amount
RESULT VARCHAR2 (32767).
--
-You can dock this type for the column type, you will receive the data
tempfieldid card_field.field_id%TYPE;
-tempstringvalue VARCHAR2; -you do not use this variable
tempcount NUMBER;
BEGIN
-You don't need to initialize with NULL, in this case. PLSQL has done already for you
-THE RESULT: = ";
--
-It seems to me that this request can be outside of the loop
-Once the table is not the change and the predicate doenst change is
SELECT field_id
IN tempfieldid
Card_field FC
WHERE cf.field_name = 'NPAname ';
--
FOR tempid IN (SELECT ce.id
OF card_element this
WHERE the ce.name AS service_name) LOOP
-It is not necessary to initialize this variable to zero
-tempcount: = 0;
--
--
SELECT COUNT (*)
IN tempcount
OF card_element_field_value cefv
WHERE the cefv.card_element_id AS a tempid
AND field_id = tempfieldid;
--
IF tempcount = 1 THEN
UPDATE card_element_field_value
SET field_string_value = string_value
WHERE the card_element_id AS a tempid
AND field_id = tempfieldid;
RESULT: = RESULT | tempid | 'UPDATE - YES,';
ELSIF tempcount = 0 THEN
INSERT INTO card_element_field_value
(id
field_date_value
field_integer_value
field_string_value
card_element_id
field_id)
VALUES
(hibernate_sequence.nextval
NULL
NULL
string_value
tempid
tempfieldid);
RESULT: = RESULT | tempid | "INSERT - YES, ';
ON THE OTHER
-I remove the tempCount on the "because I think you want to see the number of records
-you do business with
RESULT: = RESULT | tempid | ' ' || tempCount | ', ';
END IF;
END LOOP;
RETURN RESULT;
-END;
END;
Best regards
-
A fundamental problem with timing 1 DO
Hello world
I use a card PCI and Labview 8.5 6229 with XP.
I need to generate every 10 seconds a digital output which is weak for 3 seconds low and high, the rest of the time. I have attached the VI that works very well with my previous values (500 ms and ms 2000). However, I get a weak State for 1 sec, 2 sec or 3 seconds but not permanently 3 dry when I used it with the values 3 s / 10 s.
It works if I use the values 3 seconds / 15 seconds (15 seconds or more).
There must be a problem with my loop, but I don't understant what is the problem, because the outside loop should be expected inside loop to finish before starting a new loop. I don't understand why my time low State is affected by the loop of the outer time...
It is probably a pb of basis for you, but any help would be great,
Kind regards
Marc
It seems too complex. Here's an alternative. I used the delay function since there the error / mistake on connections to enforce data streams. I also changed the type of writing DAQmx since you seem to be writing on one line only.
-
What is the problem with this pl/sql code?
What is the problem with this statement of the cursor? I am getting PLS-00341 error for her:
How to solve this problem?CURSOR cur_rsource(p_sql_stmt IN VARCHAR2) IS SELECT plan_table_output FROM v$sql s, table(dbms_xplan.display_CURSOR(s.sql_id, s.child_number)) t WHERE sql_text LIKE '''%'||p_sql_stmt||'%''';
Thank you
Published by: PhoenixBai on December 14, 2009 14:05I don't have time right now to study exhaustively, but for me his vomit ORA-00942 table or view does not exist on this line:
SELECT sql_id, child_number into tmp_sql_id, tmp_child_number from v$sql where sql_text like sql_statement||'%' and sql_text not like '%v$sql%';
I am able to select from v$ sql in normal SQL as user I am compiling as, so don't know why it's complaing.
Anyone know if there are certain restrictions on access to the views v$ through PL/SQL?
EDIT: http://www.dbasupport.com/forums/showthread.php?t=22299
Access to the views of $ v seems to be through a role - try giving explicit access to it.
As SYS, you must grant select permissions on V_$ SQL (V$ SQL is synonymous with V_$ SQL) to your owner of the procedure. Just tested on my system and it allows him to compile.
Published by: Cyn on December 14, 2009 10:30
-
Animate - problem with the duplication of scripts after loop
Hi all
I have a problem with button simple script to the first frame. All right when the timeline is playing for the first time. After that when timeline loops and stops again to 0 frame button script is fireing twice, when it performs a loop twice is fireing three times etc...
Here is my script:
This.Stop ();
exportRoot.mc_cta.cursor = "pointer";
This.mc_cta.on ("click", clickFunc.bind (this));
function clickFunc() {}
Console.log ("clicked");
EB.userActionCounter ("clicked");
exportRoot.gotoAndPlay (1);
}
Anyone any ideas? Where I'm wrong?
Thank you!
Kris
As an alternative to creating multiple variables, you can also work around this problem by simply checking if the listener already exists:
If (! this.mc_cta.hasEventListener ("click")) {}
This.mc_cta.on ("click", clickFunc);
}
Moreover, you don't need bind() when you use on(). It automatically binds the event handler to the local scope.
-
Problem with cursor and Transactions
Hi friends,
I will carry out the sub set of orders where some records are removed as a transaction. If there is no problem with a set of transactions, this recordset is ignored and following Recordset is executed. With code below, if an error occurs in one of the statement, control passes to the exception block where it cancels the registration point and unwanted instructions are restored. So far so good. But the problem is execution stops here. I need to skip this record id and loop for remaining IDs. Help, please.
create or replace PROCEDURE DeleteRecords
AS
SelectDate date: = SysDate () - 27;
NRTSI varchar2 (100);
CURSOR c_TrnInfoNull IS select id from trn_info where CREATED_TISTMP < SelectDate and trn_tistmp is set to null;
BEGIN
FOR myrows IN c_TrnInfoNull LOOP
SAVEPOINT TrnSavePointNull;
delete from TRN_ERROR_DETAIL where TRN_INFO_ID = myrows.id;
Select code from NRTSI from TRN_PYMT_DETAIL where trn_info_id = myrows.id;
delete from TRN_PYMT_ADDNL_DATA where TRN_PYMT_DETAIL_ID = NRTSI;
delete from TRN_PYMT_DETAIL where ID = NRTSI;
delete from trn_info where id = myrows.id;
COMMIT;
END LOOP;
EXCEPTION, THEN, THEN go BACK to TrnSavePointNull.
DBMS_OUTPUT. Put_line (dbms_utility. FORMAT_ERROR_BACKTRACE());
END;create or replace PROCEDURE DeleteRecords AS SelectDate date:= SysDate()-27; TRNID varchar2(100); CURSOR c_TrnInfoNull IS select id from trn_info where CREATED_TISTMP
-
problem with the CURSOR and WITH clause
Hi guys,.
I have never created a package before. I try to run it, but I get:
ORA-06550: line 8, column 16:
PLS-00382: expression is of the wrong type
ORA-06550: line 8, column 3:
PL/SQL: Statement ignored
I know that my problem is in the next section
OPEN FOR V_io_cursor
with GOT_R_NUM like)
Is the above correct?
When I copy paste the "heart" of the query, it works very well. I really have a problem with the CURSOR and the declaration.
Here's the code in its entirety. I know that the code is much more then he returned, but ignore this overload that was to do some tests to make sure that I can achieve any query request.
CREATE OR REPLACE
PKG_SPF_NATIONALREPORTS PACKAGE BODY IS
PROCEDURE GET_NATIONAL_TOTAL_RESULTS (P_SelectFields IN varchar2, P_SUMFields IN varchar2, io_cursor IN OUT C_RESULTS)
IS
v_io_cursor C_RESULTS;
BEGIN
OPEN FOR V_io_cursor
with GOT_R_NUM like)
SELECT
-START P_SelectFields
r.cli_served,
r.EIER,
-END P_SelectFields
r.RC,
r.Year_ID,
r.period_id,
r.agreement_type_ind,
CONTRACT_NUMBER. CONTRACT_NUMBER_TEXT,
YEARS.year_desc,
RC_CODE.rc_code_id,
RC_CODE.rc_code,
AHRDA HOLDERS. AHRDA_ID,
AHRDA HOLDERS. REGION_ID,
AHRDA HOLDERS. PROVINCE_ID,
AGREEMENT_TYPE. AGREEMENT_TYPE_ID,
AGREEMENT_TYPE. AGREEMENT_TYPE_DESC_EN,
ROW_NUMBER() over (partition R.YEAR_ID, R.CONTRACT_Number_Text
order by
P.PERIOD_desc
(/ / DESC NULLS LAST) AS r_num
RESULT r
JOIN period p ON r.period_id = p.period_id
JOIN CONTRACT_NUMBER ON r.contract_number_text = CONTRACT_NUMBER. CONTRACT_NUMBER_TEXT
JOIN RC_CODE ON contract_number.rc_code_id = rc_code.rc_code_id
JOIN AHRDA holders ON ahrda.ahrda_id = rc_code.ahrda_id
JOIN AGREEMENT_TYPE WE AHRDAS. AGREEMENT_TYPE_ID = AGREEMENT_TYPE. AGREEMENT_TYPE_id
JOIN the YEARS WE r.year_id = YEARS.year_id
)
SELECT year_desc
-START P_SUMFields
SUM (cli_served) AS sum_cli_served
The SUM (eier) AS sum_eier
-END P_SUMFields
OF got_r_num
GROUP BY year_desc
ORDER BY year_desc
;
io_cursor: = v_io_cursor;
END GET_NATIONAL_TOTAL_RESULTS;Agree - all this talk of loops FOR is completely irrelvant.
A refcursor is usually the exact mechanism to return a result set.What is C_RESULTS?
Just use SYS_REFCURSOR.
No need for local variable.
OUT why? Not just walk OUT?
PROCEDURE GET_NATIONAL_TOTAL_RESULTS (P_SelectFields IN varchar2, P_SUMFields IN varchar2, io_cursor OUT SYS_REFCURSOR) IS BEGIN OPEN io_cursor FOR ... END;
-
Problem with cursor - will switch to a link
I was hoping that someone could help with this.
My dad's Mac has a problem with the cursor. It uses the trackpad and when you try to click on a link, it will not work. The arrow does not change into a symbol of the 'hand' and it can not click on it. This makes it almost impossible to navigate. It seems that the links are not recognized. He tried to use a mouse via the USB port and nothing changes.
He tried to update to El Captain but he can't because the mouse doesn't work. The simple, restart or turn off / suite does not work. The problem persists on Chrome and Safari.
Any help appreciated, thanks.
Hi Irbea,
Thank you for using communities of Apple Support. I see that you are the dad had problems with clicking on the links on his MacBook. These are some great troubleshooting steps to try to solve this problem. I am happy using.
According to the steps that he has already done, I'll try to test this in safe mode. This will allow his MacBook making some changes and prevent the loading of the software. Please follow these steps to safe mode:
Try safe mode if your Mac does not end commissioning
While you are in safe mode, you may notice that the MacBook is running slower or the screen flashes. No worries, it's normal. Read this article for more information about this:
Graphics performance limited in recovery of OS X or in safe mode
If you continue to have problems trying to test in a new user:
How to test a question in another account on your Mac.
Have a great day!
-
I stopped using Firefox as nothing I've done has corrected this problem. I tried to close Firefox and restart it, I erased all my Add-ons and then added adblock back (it's the only one), but it still does not work. I deleted files so that I have more space - I can't think of anything that works. I talked to four of my friends with Macs and they are all having the same problem with Firefox since the Mavericks.
Cursor disappears huh? It's quite strange. All of the compatibility of the Mavericks can be followed in [Bug 883824]
Try this work around:
- Go to Firefox > Preferences > advanced > general
- Always check "use the cursor keys to navigate through the pages.
- Press OK.
Or try the Mac preferences noted here: https://discussions.apple.com/message/23542890#24471966
Maybe you are looking for
-
Sometimes there's a 7zip error message says "deny access to" and no has still not updated to the new version.The installation in silent mode of exit process, and a lot of files in the firefox install directory have been added .moz-backup suffix.
-
I deleted cookies and now I can't enter with label. How to cancel it?
I went to tools, Options, privacy and deleted all cookies. Now, I can't get into Tagged. I don't know what I did different, because I deleted cookies before and it didn't happen.
-
Life of the SR memory card?
What is the life expectancy of the SR memory card? They die in a few years?
-
A PDF file can be burned to a DVD
I have 1.4 GB of PDF files I want to keep on a disk - information can be burned to a DVD?
-
Windows Defender won't turn.
recently had the 2012.ran vista antispyware malwarebytes. not sure if she has gone.computer seems fine at the moment, but the windows defender does not work and custom allow in.any pointers please