Iterate through a list of strings In SQL scriipt

I’m trying to create a sql file that iterates through a list and get me the information from a group of servers and save it on CSV file. The DB is Oracle, just in case :S.
I’m running the file using sqlplus in a playbook, so I’m able to change the query.

So far, I was able to do the following:

set markup csv on spool 'playbook-dir/roles/instances_db/files/servers.csv'  SELECT * FROM   (<some_internal_query>) WHERE  ROWNUM <= 600000 + 1 ORDER  BY server_name;    spool off 

This query will bring all 5000 servers and I just need 100 or so. I tried to add an array and loop around it Something like this:

DECLARE    arrayvalues sys.odcivarchar2list; BEGIN   arrayvalues := sys.odcivarchar2list('Matt','Joanne','Robert');   FOR x IN ( SELECT m.column_value m_value                FROM table(arrayvalues) m )   LOOP     SELECT *     FROM   (<some_internal_query>)     WHERE  ROWNUM <= 600000 + 1     ORDER  BY server_name;     END LOOP; END; 

But I got this error:

Error report - ORA-06550: line 7, column 1: PLS-00428: an INTO clause is expected in this SELECT statement 06550. 00000 -  "line %s, column %s:\n%s" *Cause:    Usually a PL/SQL compilation error. *Action: 

I’m not entirely sure if I’m doing the LOOP correctly.
Any help will be appreciated.

Information exposure through query strings in url of a POST request [duplicate]

I can’t seem to find any information online for when there is information exposure through query strings in URL of a POST request.

I understand it is an issue for when it’s sent in HTTP GET. Wondering if it would still be an issue for when it’s sent in POST?


POST /api/view?username=USER 

How can I hide a flag from `strings` command

I want to create RE CTF, that the user needs to discover which string he need to write in order to execute a function that will print the flag, but, with a simple strings command in shell, we can discover the flag in the printf function. So, how can we make this not to happen?

#include <stdio.h>  void print_flag() {     printf("secret_string discovered. flag: {eAsy_p3asy}"); }  int main() {     int c;     c = getchar();     while (c != 'secret_string') {         putchar(c);         c = getchar();     }     print_flag();     return 0; } 

strings output: I include only the flag. I don’t want the flag to be visible like this, it makes no sense.

secret_string discovered. flag: {eAsy_p3asy} 

What is the most efficient way to turn a list of directory path strings into a tree?

I’m trying to find out the most efficient way of turning a list of path strings into a hierarchical list of hash maps tree using these rules:

  • Node labels are delimited/split by ‘/’
  • Hash maps have the structure:
{     label: "Node 0",     children: [] } 
  • Node labels are also keys, so for example all nodes with the same label at the root level will be merged

So the following code:

[     "Node 0/Node 0-0",     "Node 0/Node 0-1",     "Node 1/Node 1-0/Node 1-0-0" ] 

Would turn into:

[     {         label: "Node 0",         children: [             {                 label: "Node 0-0",                 children: []             },             {                 label: "Node 0-1",                 children: []             },         ]     },     {         label: "Node 1",         children: [             {                 label: "Node 1-0",                 children: [                     {                         label: "Node 1-0-0",                         children: []                     },                 ]             },         ]     }, ] 

Need help with Trie insertions, I am currently working on a DSA specialization on Coursera, Strings course

I am trying the insertion operation in a Trie and a read operation for the below implementation I am having trouble with insertion.

import java.util.*; class node{ public int val; public node ptrs[]; node(){     this.val =0;     ptrs = new node[26];     for (node ptr : ptrs) {         ptr = null;     }   }     } class Tree{ public node root = new node(); public int pass =0; void insert(String s) {     node trv = root;     for (int i = 0; i < s.length(); i++) {         if (trv.ptrs[s.charAt(i) - 'A'] == null) {             trv.ptrs[s.charAt(i) - 'A'] = new node();             trv.val = ++pass;           //  System.out.println(s.charAt(i)+" val : "+trv.val);         }          trv = trv.ptrs[s.charAt(i) - 'A'];     } } private void visit(node trv){     for(int i =0;i<26;i++){         if(trv.ptrs[i]!=null){             System.out.println((char)(i+'A')+" : "+trv.val);             visit(trv.ptrs[i]);         }     } } void call(){     this.visit(root);  }  } public class trie {   public static void main(String[] args) {     Scanner sc = new Scanner(;     int n = sc.nextInt();     Tree t = new Tree();     while (n-- > 0) {         String s =;         t.insert(s);     };     sc.close();  } } 

my output :

3 ATAGA ATC GAT A : 7 T : 2 A : 6 G : 4 A : 5 C : 6 G : 7 A : 8 T : 9 

expected output :

3 ATAGA ATC GAT A : 1 T : 2 A : 3 G : 4 A : 5 C : 6 G : 7 A : 8 T : 9 

Is there a way to map the concatenation operation over strings to the addition operation over $\mathbb{N}$

Given an alphabet, say $ \Sigma = \{0,1\}$ , I can make a one-to-one mapping from all possible strings $ x \in \Sigma^*$ to $ \mathbb{N}$ . This could be done by ordering $ \Sigma^*$ lexicographically and assigning the $ i$ th string $ x_i$ to number $ i \in \mathbb{N}$ .

But given strings $ x_i,x_j \in \Sigma^*$ , is there any special mapping such that the concatenation operation $ f:\Sigma^* \rightarrow \Sigma^* | (x_i,x_j) \rightarrow x_ix_j$ is also related to the usual addition performed over the corresponding indices $ i,j \in \mathbb{N}$ to which $ x_i$ and $ x_j$ are mapped ?

For instance, if I assign the character $ \{1\}$ to the number $ 1$ , and string $ x$ is assigned the number $ 10$ , is there a mapping such that the string $ x1$ is assigned the number $ 11$ ? (i.e. $ 10 + 1$ )

Strings and Lcp

We are given a string S with |S|=N
We have to answer Q queries
Each query has an integer x as input
We have to report
$ \sum_{i=x}^n LCP(i,x)$
Where Lcp(i,x) denotes the length of the largest common prefix of suffix[i,N] and suffix[x,N]

Strings and suffix

How can we find the sum of sizes of common prefix that a suffix of length r has with all suffices of length greater than r? We have to find this answer for all r. I tried this using suffix trees and got an O(n^2) algorithm where n is the length of the string. The main problem I could not handle was the restriction that only suffice of length greater than r were to be considered.