PL/SQL :: Replicate For Loop Functionality Through SQL Query
Jun 14, 2013
I have a requirement where i need to replicate the for loop functionality through sql query.In pl/sql i can achieve this through cursors or for loop but is there any way to do or replicate the same functionality in sql queries . For example i want to repeat the operation for set of records or iterate through set of records and fire query accordingly .Is it possible through sql query
i have query which scores a customer details on some factors and gives it a rank/I have a table called agents which holds the agents details.
This is how i get the rank: select * from ( select customer_name ,agent_number
[code]....
The agents table has agent_number and agent_Name....By the above query i check various score against all available agents and assign customers to agents who have highest score or rank is 1
But my problem is who to loop through the process.. i mean after the intial customers are assinged with agents it should run again for remaining customers and for agents who are free(and rank for them is 1) should be checked for assignment Once all agents are assigned but still more customers are available then agents even thoug they are already assigned they can be assigned now since no agent is free..
I'm joinging two tables event_types and tmp_acc tables.
event_types contains 2 Billion records tmp_acc contains 20,000 records.
Resulting rows are about 300,000 records in event_types table end_t and account_obj_id0 are joined indexed
no indexs in tmp_acc.
When I run below query with nexted loop it takes 6 hrs to complete. But when I run with hash join even after 4 days it was still running. what is wrong with hash join here. Why it takes so long. I'm joining only 20000 rows. So I think there should be a way to get result rows quickly.
show parameters hash_area_size
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ hash_area_size integer 2097152
explain plan for select --+ parallel(e,6) [code]....
I have a table MYTABLE in database mydb1 duplicated via materialized view and materialized view log and refresh_snapshot commands to a MYTABLE on mydb2 database.
I like to duplicate this table MYTABLE to a third database mydb2, using the same method (materialized view and refresh_snapshot command).
Is it possible ? What's hapend to the materialized view log where I launch a refresh_snapshots on mydb2 ? How is this materialized view log truncated ?
I have a package called getEmpData in database orcl. I want to move/creat the same package on other database called ora. I want to do/simplyfy this work through PLSQL DEVELOPER.
The document says "Propagators are also useful for distributing replication loads in configurations that involve a master database that must replicate to a large number of subscribers".
Link [URL]........
My question is how do we define this " large number ". Is 5 a large number or 10 a large number ? I've a bidirectional legacy replication scheme wherein a node replicates to 10 other nodes. Should i introduce Propagator between these nodes.
I thought that you are not supposed to be able to assign the value of an out parameter to a variable (Feuerstein, 5th ed) and yet I was just able to do this without any compilation error messages. Is Feuerstein wrong or am I missing something? Has the functionality changed?
PROCEDURE Parse_HC (p_timestamp_string IN VARCHAR2, p_timestamp_date OUT DATE) AS v_date DATE;
[Code]....
Here is my banner:
BANNER ---------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 – Production "CORE 11.1.0.7.0 Production" TNS for Linux: Version 11.1.0.7.0 – Production NLSRTL Version 11.1.0.7.0 - Production
We have the following scenario that we need to replicate:
Our current systems are on oracle RAC+ASM with 2 nodes, they are on physical hardware.We would like to replicate from physical to VM, storage is DELL compellent.
Can this be done online without RMAN at SAN level replication? how to replicate the systems.
I am having performance issues on a query in a production environment that I cannot replicate in our test environment. Our test environment is an import of production. Version information is:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi PL/SQL Release 10.2.0.3.0 - Production CORE 10.2.0.3.0 Production TNS for Solaris: Version 10.2.0.3.0 - Production NLSRTL Version 10.2.0.3.0 - ProductionWhen I run the query in test, I get the following results using TKPROF [code]....
Misses in library cache during parse: 1 Optimizer mode: ALL_ROWSThis performance problem started a few weeks ago and the problem seems to be in the high number of consistent reads during fetch. The DBA tried restarting the instance and gathering fresh stats on the tables but that has not made a difference. Now he wants to export the tables, drop the schema and re-import.
Earlier I am using oracle 10g (10.2.0.4) and now we are planning to use 11gR2 (11.2.0.1).we are using oracle stream functionality in 10g. I just want to know is there any new feautre available in 11g which replace the stream functionality? we dont want to use stream (in 11g) any more.
I have my forms application working on both windows and Unix platform. When i am using GET_FILE_NAME ( ), it is working fine in Windows based application but the same is not working in Unix based application..
I would like to use the below decode in DBMS_OUTPUT in place of cur_rec.data_type. Could I know how can I achieve this. The DBMS_OUTPUT is inside a loop and output is shown below as an example.
NOT NULL -- EMP_ID NUMBER ,NOT NULL -- EMP_NAME NUMBER ,NOT NULL -- HIRE_DT DATE ,NOT NULL -- SALARY NUMBER
what is JTF GRID functionality,i have use that grid in custom form. how to proceed with that and what are steps to be taken to display JTF GRID Functionality ?
I am creating triggers for audit operation when any insert/update/delete happens on a table automatically.Now i need the same functionality in procedure.
My requirement is to create procedure for all those triggers.
CREATE OR REPLACE PROCEDURE IND_MONITOR(P_tab VARCHAR2) is type ind_table is table of varchar2(20); p_ind ind_table; v_sql varchar2(2000); begin select index_name bulk collect into P_Ind from user_indexes where table_name=upper(P_tab); for i in 1..p_ind.count loop v_sql :='alter index '||p_ind(i)|| ' monitoring usage' execute immediate v_sql using p_ind(i); end loop; end;
i work in an application that should make the replication from a publusher table to a remote subscribe table, using snapshot,and trigger, replication data of update works perfectly (update,insert,delete), but when i try to add or dropp a clumn in the publisher table, repplication fail, i know that my method d'ont replicate ddl statment like create or alter table, so i would like the better way to do the replication of the ddl statment without loosing tha data in the subscribe table, i'm working with oracle XE,
I am using the Toad10.After i enter the user, Pwd it displays the Toad error that""Access violation at address 6761CB21 in module 'ORA805.dll'. Read of address 00000010 ""
while i try to use the F4 functionality, it again displays the above msg and Object not found...After i execute the query, all the characters data displays in chinees.
I want to create a trigger with the requirement of achieving Primary key functionality.
I have a "EMP" table. the table already contains a duplicate data on "EMPNO" column. i want to restrict entering duplicate data further into table for that i want to create a trigger.
where can i find different triggering events of DML(like update, delete etc...)and DDL(database and schema level).