Function for search string in all table of a particular schema ? (postgres)

Hi ,
i want to create a function postgresql, that can able to search a string from all tables.
I try as below.... please rectify this
CREATE OR REPLACE FUNCTION search_string(str char(50))
returnS character varying AS
$BODY$
DECLARE
     tempCount bigint ;
record_v record;
itemid_v bigint ;
query varchar;
return_v character varying := null;
BEGIN
for record_v in (select table_name ,column_name
                    from information_schema.columns and data_type in ('character','character varying','text')) loop
query := 'select count(*) from '|| record_v.table_name ||' where ' || record_v.column_name || ' like ''%' || str ||'%''' ;
     execute query into tempcount;
          if (tempCount >0) then
          return      'l';
          else
          return      '2572';
          end if;
          end loop;
END;
$BODY$ LANGUAGE plpgsql VOLATILE
COST 100;
in output i need all tables in which string exists :
like table_name      count_of_string_match

Mr. singh wrote:
oracle is the master of all databases - i hope u know
if any body work on oracle .. he can right any query in any database :)Query maybe. but you were asking about functions. ANSI SQL is a pretty good standard for most normal dbs nowadays. But the procedural extensions differ more. Therefor you should go to a postgress forum to ask there. Or upgrade your database to oracle.

Similar Messages

  • Need to update one column of all table in that particular schema

    hi all,
    i am using db10g.
    my task is to update one particular column's value of all the table in that schema.
    to acheive the above
    do i have to write update statement for each table or is there any way to do it in bulk?
    i hope my question make sense.
    Thanks..

    Hi karthick,
    I want to know something which is not related to this thread .
    How to include formatted post while replying to thread .
    I know using will be used  format  code before posting  . But how can we  do  it for posted message .
    I hope you understand my question .
    Thanks in advance .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Prevent user from deleting rows from all tables in his own schema

    Hi,
    How can I prevent user from deleting rows in all tables in his own schema.
    I want the user to not able to delete rows from any existing or new tables that might be added in the future.
    The user does not have the "DELETE ANY TABLE" system privilege.
    Please advise.
    Thanks.

    Nowadays, I'd also avoid triggers (if possible).
    Sometimes, when I daydream, I'm rewriting a few applications that I've contributed to as a newbie, and I'm very ashamed of it nowadays.
    From what I've experienced, in retrospective, the emphasis on teaching 'Oracle stuff' has been lying far too much on PL/SQL row-by-row oriented processing instead of letting Oracle 'crunch' sets at once.
    Most of my debugging hours ended up in discovering one or more database triggers 'doing stuff automagically'.
    Another nice blogpost: http://rwijk.blogspot.com/2007/09/database-triggers-are-evil.html
    Regarding OP's question:
    I would just rethink/reconsider this requirement completely.
    Correctly implementing privileges and roles seems the best way to go, yes.
    Triggers? Nah...
    pre-post-edit, noticed thread got updated just before posting
    Don't know what you mean with 'namedropping', but I think it's legitimate to point other readers to interesting Oracle related opinions/articles that do have a technical background and lots of interesting examples.
    post dreaded OTN outage edit (from here)
    Again: I would just rethink/reconsider this requirement completely.
    Both trigger/vpd are being used to hide a design flaw here.

  • How to search for a string in ALL Function Modules source code

    Hello,
    I want to search for the string "HELLO" in all FUNCTION MODULES source code(FM, no reports/programs).
    Is this possible? How?
    Cheers,
    Andy

    hi,
    Execute RPR_ABAP_SOURCE_SCAN to search for a string in the code ... Press where-used-list button on the program which takes to the function group or the function module where it is used ..
    Regards,
    Santosh

  • Search string in all files into a directory

    hello, i try to search a string into all directory files i think is something like this * ".txt"
    but is not working can you help me please.

    In some ways it would be nice if you could specify a wildcard (or a regex) so that a FileReader would treat ALL the matching files a one file but the current FileReader does not no this. You need to list all the files using File.listFiles() using a file filter if you want to restrict which files are chosen. You can then process the list opening each file in turn.
    The Javadoc for File is your friend.

  • Javascript function for validating string for length

    hi all,
    i am having a string whose datatype is CHAR in the database and length is 7 .
    can any one help me with the javascript validation code(function) for this?
    regards and thanks in advance

    sigh Another user to the ignore list. :)You should see this thread
    http://forum.java.sun.com/thread.jspa?threadID=632908&tstart=0ram.

  • Does the search template provide a date picker function for searching?

    I cannot find a date picker function for this type of search, can anyone help me with this? Thanks.

    Try a copy/paste some of the Greek text out into Word. Does it display as expected in Word?

  • How to make allow null for a column in all table.

    Hi,
    I have a column "col1" in all tables (user made table) , i want to make it allow null
    please tel me how can it be done using single script.
    i mean in short way.
    yours sincerely.

    yes. absolutely you can.
    Look, what i got -
    Ranit>>  select 'alter table ' || table_name || ' modify("TIMESTAMP" null) ; ' from user_tab_columns where column_name='TIMESTAMP' and nullable ='N';
    'ALTERTABLE'||TABLE_NAME||'MODIFY("TIMESTAMP"NULL);'                           
    alter table FIXED_OBJ$ modify("TIMESTAMP" null) ;                              
    alter table SUMPARTLOG$ modify("TIMESTAMP" null) ;                             
    alter table SUMDELTA$ modify("TIMESTAMP" null) ;                               
    alter table ALL_SUMDELTA modify("TIMESTAMP" null) ;                            
    alter table DBA_EXP_FILES modify("TIMESTAMP" null) ;                           
    alter table WRI$_DBU_CPU_USAGE modify("TIMESTAMP" null) ;                      
    alter table DBA_CPU_USAGE_STATISTICS modify("TIMESTAMP" null) ;                
    7 rows selected.But, it is not over.
    Either - You have to do an 'EXECUTE IMMEDIATE' over these 'alter' scripts.
    OR - Take these scripts, put it into a <script_name>.sql file and then execute this file.
    Hope you understand.
    Edited by: ranit B on Dec 22, 2012 3:17 PM
    -- code added

  • Which all table contains a particular field

    Hi
    Can any one give me the query for finding which all tables in the database contains a particular field.
    Like I want to find out all the tables which has fields with field name like '%LOC%'
    Thank You
    .S

    select table_name from dba_tab_columns where column_name like '%LOC%'

  • Viewing all Table names in my schema

    I have lost track of what tables I have created in for my database. I can't find in the SQL documentation where the
    command is to show all the table names in my schema.
    Thanks so much
    Nick

    Or you can pause the output :
    SQL> set pages 24 
    SQL> set pause on
    SQL> set pause "Press Enter " 
    SQL> select * from tab;http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230

  • Searching for a values in all tables in a schema

    Hi All,
    Is there any way/logic to find a value in unknown
    fileds of unknown tables in a schema.
    Just out of curiosity, I am posting this question.
    Thanks in advance.
    Regards,
    Srini

    I already answered to a similar post last week.
    Have a look at this site :
    how do I find in a ViewTable what table has a specific column?
    -- Shailender Mehta --

  • F4 functionality for search help

    Hi all,
    Am  having two select options for cost center groups and for cost centers (s_ksgru and s_kostl ). If i give value in cost center group and after that if i press F4 for cost center it has to display  the cost centers that comes under the given cost center group.
    i wrote code as :
    AT SELECTION-SCREEN  ON S_KSGRU.
    Bapi to get list of cost centers for given group
    CALL FUNCTION 'BAPI_COSTCENTER_GETLIST'
          EXPORTING
            CONTROLLINGAREA = 'AFIL'
            COSTCENTERGROUP = S_KSGRU-LOW
          TABLES
            COSTCENTER_LIST = I_COSTCENTER_LIST.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_KOSTL-LOW.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD               = 'COSTCENTER'
         VALUE_ORG              = 'S'
        MULTIPLE_CHOICE        = 'X'
        TABLES
          VALUE_TAB              = I_COSTCENTER_LIST1
         RETURN_TAB             = RET_TAB.
      MOVE RET_TAB-FIELDVAL TO S_KOSTL-LOW.
    CLEAR RET_TAB-FIELDVAL.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_KOSTL-HIGH.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD               = 'COSTCENTER'
         VALUE_ORG              = 'S'
        MULTIPLE_CHOICE        = 'X'
        TABLES
          VALUE_TAB              = I_COSTCENTER_LIST1
         RETURN_TAB             = RET_TAB.
      MOVE RET_TAB-FIELDVAL TO S_KOSTL-HIGH.
      CLEAR : RET_TAB-FIELDVAL.
      S_KOSTL-SIGN = 'IN'.
      S_KOSTL-OPTION = 'EQ'.
    APPEND S_KOSTL.
    This code is working fine.
    But after giving cost center group in select-options
    again i have to press enter..and then if i press F4 its displaying all the values..
    If i wont press enter its throwing error No inputu values...
    But i want to get F4 values without presing enter.
    Will u plz tell me where to correct the code.
    Its very urgent.
    Thanks and Regards,
    Ramya

    Hi abaper,
    1. The entered value on screen
    IS NOT AVAILABLE
    if we try to detect in
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR MYFIELD.
    2. In such case, we have use the FM
    DYNP_VALUES_READ
    3. To get a taste of this,
    enter value in P_MONAT,
    and it won't be available in F4. (in debuggin)
    But it will be available, after the Fm is called.
    4. Just copy paste
    5.
    report abc.
    PARAMETERS: p_monat LIKE bkpf-monat DEFAULT sy-datum+4(2).
    data : flds like DYNPREAD occurs 0 with header line.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MONAT.
    REFRESH FLDS.
    FLDS-FIELDNAME = 'P_MONAT'.
    APPEND FLDS.
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    DYNAME = SY-REPID
    DYNUMB = SY-DYNNR
    TRANSLATE_TO_UPPER = ' '
    REQUEST = ' '
    PERFORM_CONVERSION_EXITS = ' '
    PERFORM_INPUT_CONVERSION = ' '
    DETERMINE_LOOP_INDEX = ' '
    TABLES
    DYNPFIELDS = flds
    EXCEPTIONS
    INVALID_ABAPWORKAREA = 1
    INVALID_DYNPROFIELD = 2
    INVALID_DYNPRONAME = 3
    INVALID_DYNPRONUMMER = 4
    INVALID_REQUEST = 5
    NO_FIELDDESCRIPTION = 6
    INVALID_PARAMETER = 7
    UNDEFIND_ERROR = 8
    DOUBLE_CONVERSION = 9
    STEPL_NOT_FOUND = 10
    OTHERS = 11
    BREAK-POINT.
    field value is available in FLDS-FIELDVALUE
    regards,
    amit m.

  • Function for search help

    Normally you relate a search help to a input box and let SAP to handle the F4. So after selecting a value, this value will be returned to the input box.
    But i want to react on the value and don't put it automatically in the box, but process it first.
    So my question is : is there a function module or class-method that simulates the search help for a given input and returns the chosen value ?
    regards
    Hans
    [email protected]

    Hi
    As Sergei told, it needs some further coding. I do not know a way to interfere standart search help functions even there is something like "Search help exit", I think it is just an exit for the search help designer about adjusting column widths etc... interfering standart action.
    So it seems you should code your own POV in this case. There has been two long threads in this forum. You can search it. It is about coding POV and deals with "F4IF_FIELD_VALUE_REQUEST"/"F4IF_INTTAB_VALUE_REQUEST". Here are the URLs:
    1. Re: POV : TableControl Multi-line User selection
    2. Re: POV : SAP User Input F4 Value Help
    Hope this helps...
    *--Serdar

  • CAN NOT VIEW ALL TABLES IN MY INSTANCE/SCHEMA

    neither thru an ODBC connection in Access or thru TOAD can I see all of the tables available to me in my instance. In TOAD I can query them, if i know their names and call them in the SQL but when i go to the table view they are not there.... HELP!!!!!

    I ran a 9i RAC with hundreds of tablespaces and several hundred user objects (tables, procedures, etc.) in each tablespace (product development environment). I HAD to use roles for privileges or it was unmanageable. Access to the DB was mostly from MS Access users who didn't know how to write real SQL or use an enterprise-level reporting tool. I set up a lot of ODBC-links for people who only had privileges granted via roles, and the biggest problem wasn't the explicit grants, but not having READ access. All had a default role (and I frequently ran into the role limit issue) selected and this didn't seem to affect the selection of tables via ODBC. I strongly recommend that you check and verify that the user you are trying to connect through ODBC has READ rights on the tables in question, not just EXECUTE, REFERENCES, INSERT, UPDATE, DELETE, etc.

  • Search for a string in SAP Script

    Hello Experts,
    Is there a way to search for a string in all Z SAP scripts, like ABAP source scan?
    Regards,
    Hari.

    Try using function module "READ_FORM" (you will have to write a simple z-program to find all SAPscripts in your system then use this function module to search the SAPScript Forms for a particular string).
    All you have to do is supply the "FORM" name and it will return all of the Pages, Paragraphs, and Texts etc....
    More specifically, try looping at the "FORM_LINES" internal table result and you will see the SAPScript text there....
    Have fun    !
    Edited by: Christopher Twirbutt on Sep 16, 2009 12:43 AM

Maybe you are looking for

  • Horizontal tabs when they are on the left side of tab control

    I have a tab control for a touch screen where I was going to use buttons along the left side to change tabs, and hide the tabs. However, I realized I can put the tabs on the left side of the tab control and remove my buttons all together. Only issue

  • Which audio interfaces are compatible with a Lightning to USB Camera adapter???

    Would like to use my iPad Mini with Lightning Adapter in conjunction with an audio interface. What are the requirements for a device that would accept the adapter (what type of USB input/output). Thanks!

  • Cant restore iphone 5

    Hello everyone i have a huge problem with my iphone 5. it turned off today because i went out of battery, so i charged it and tried to restart it but nothing happend. it stucked at the apple logo and nothing happens. so i tried to reatore it with itu

  • Adobe CS5 on MBP?

    Hey, I already got an iMac to do the main work with all the applications of Adobe CS5 Master but want a MBP to get mobile going to custumors for presentations and so on. I should therefore be able not to run the complete Adobe CS Master Suite; just P

  • PanelStretchLayout: change height of the top facet

    Hi, I've defined a panelStretchlayout panel. In the top facet I've placed a ShowPanelHeader. What I now wanted to do is to change the height of top facet each time the showpanelheader is disclosed. Just to show some data. I've defined a disclosurelis