cursor

Exists in cursor where condition is met

可紊 提交于 2019-12-12 03:55:15
问题 I have created a cursor, that returns some data. I then wish to have an if statement in the returned data that checks if the field 'test_field' exists in the cursor where test_field2='A'. I am struggling to get my syntax correct on the if statement though, and can't find any pointers online. CURSOR test_cur IS SELECT * FROM test where name=pk_name; BEGIN FOR trec IN test_cur LOOP --The following line where my syntax is incorrect IF trec.test_field EXISTS IN test_cur WHERE trec.test_field2 =

Symfony QueryBuilder returning MongoDB cursor instead of objects array

蓝咒 提交于 2019-12-12 03:36:49
问题 I am trying to build a custom querying function returning MongoDB documents corresponding to some filters. I have created this function into a specific repository for my document User : namespace LogAnalyzer\CoreBundle\Repository; use Doctrine\ODM\MongoDB\DocumentRepository; class UserRepository extends DocumentRepository { public function getUserTemp($clauses = null) { /* Create query */ $query = $this -> createQueryBuilder(); /* Add clauses */ if($clauses) { if(isset($clauses['id'])) $query

for loop inside a cursor oracle

空扰寡人 提交于 2019-12-12 03:32:00
问题 I have created a TYPE TYPE t_array IS TABLE OF VARCHAR2(15); A function which takes a string which contains ',' as delimiter and the function returns t_array which is basically splitting the string and returning list of values. FUNCTION split_string(id IN VARCHAR2) ... ... .... RETURN t_array; END split_string; Now my stored procedure takes in the long string as input, calls the function to split the string and loops through the t_array and returns a CURSOR. PROCEDURE p_get_xxx(p_id IN

How to return multiple rows from oracle stored procedure from multiple cursors?

[亡魂溺海] 提交于 2019-12-12 03:14:11
问题 I need to have stored procedure where I can run multiple cursors. Loop over each cursor and then do some operation on each row. This way I will have the desired result from these cursors. Result of such multiple cursors then needs to be union with some other rows and then filtered out and return those rows finally from the proc. Please note that each cusror and another queries will have same columns. I am not sure how to do this in the oracle. Please help me out. create or replace PROCEDURE

Sqlite verify if value of column exists

时光怂恿深爱的人放手 提交于 2019-12-12 03:09:28
问题 i'm wondering if this method is right to verify if the value of _username already exists in the column "username" public boolean verification(String _username) throws SQLException{ Cursor c = dataBase.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE "+KEY_USERNAME+"="+_username, null); if (c!=null) return true; // return true if the value of _username already exists return false; // Return false if _username doesn't match with any value of the columns "Username" } Is there a better way to do the

SQL Server XML file with multiple nodes named the same

懵懂的女人 提交于 2019-12-12 02:33:27
问题 I have this inner XML which I am passing across to a SQL Server stored procedure. As you can see, it contains multiple root nodes but additionally, it can also contain 1 to ' n ' number of LotResults child nodes. Is there a way I can manipulate this in the stored procedure so that I can retrieve all LotResults / Result nodes for each root node? So far I have declared the cursor which can deal with the top-level nodes: DECLARE cur CURSOR FOR SELECT tab.col.value('ID[1]','NCHAR(10)') as INT

How to enable cursor selector in GWT TextArea?

半城伤御伤魂 提交于 2019-12-12 02:31:17
问题 In my application I call an API to get the contents of the file as a String and use the TextArea UIWidget to display the file content to the user. I want the user to be able to select the text in the text area in order to be able to copy and paste the contents of the file. When I hover over the TextArea in GWT, text selection is not being enabled. The getCursorPos function in the TextArea seems to be useful when modifying the textarea but not for selections 回答1: Text selection is enabled in

swapCursor(Cursor) is undefined for the type SimpleCursorAdapter

那年仲夏 提交于 2019-12-12 02:23:03
问题 I am receiving a "swapCursor(Cursor) is undefined" error when creating a CursorLoader. I have imported the android.support.v4 (app.LoaderManager, app.LoaderManager.Loader, Content.CursorLoader, content.Loader). Not sure what I can do to correct this issue. please advise. loader: import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content

Something like cursor or recordset iterator in Hibernate or JPA?

☆樱花仙子☆ 提交于 2019-12-12 02:12:15
问题 Are there any means to work with long query results in Hibernate? What if I want to draw table with million of records and allow user to navigate over it? The goal is not to transfer all data to client at the time and handle the current position. 回答1: You can use simple mechanism of FirstResult and MaxResults in a Query object. query.setFirstResult(5); query.setMaxResults(5); Above will fetch 5 records from fifth record. You can use ScrollableResults but it will be slower compared to above

Oracle, how to open cursor and select one column of many into a variable

久未见 提交于 2019-12-12 02:02:03
问题 I have a Oracle stored procedure returning a reference cursor. I want to open the cursor before i return it to check a count and throw an exception if need be, but im having trouble with syntax and how im supposed to do this. V_ASN_COUNT NUMBER; OPEN O_CURSOR FOR SELECT column1, -- a bunch of columns column2, COUNT(DISTINCT SI.ASN_NO) OVER (PARTITION BY SI.ASN_NO) AS ASN_COUNT FROM AN_ORDER_INFO OI, AN_SHIPMENT_INFO SI WHERE -- a bunch of criteria OPEN O_CURSOR; LOOP FETCH ASN_COUNT INTO V